import {
    getMyInfo,
} from '~/api/user'
import event from '~/mixins/event'
import {
    getSaleData
} from '~/api/sale'
import {
    createStoreBindings
} from 'mobx-miniprogram-bindings'
import {
    store
} from '~/store/index'
Page({
    behaviors: [event],
    data: {
        allIncome: {}
    },
    async onLoad() {
        // 手工绑定 
        this.storeBindings = createStoreBindings(this, {
            store,
            fields: {
                userInfo: 'userInfo',
            }
        })
    },
    async onShow() {
        let allIncome = await getSaleData()
        this.setData({
            allIncome
        })
    },
    jump({
        currentTarget
    }) {
        wx.navigateTo({
            url: `/salesperson/pages/${currentTarget.dataset.url}/index`,
        })
    },
    openInvite() {
        this.selectComponent("#InvitePop").openInvite()
    },
    onShareAppMessage() {
        return {
            title: '这个小程序太赞了！孩子朗读能力蹭蹭上涨，推荐你试试！',
            path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
            imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/375-300.png',
        }
    }
})