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() {
        // #if MP
        return {
            title: '这个小程序太赞了！孩子朗读能力蹭蹭上涨，推荐你试试！',
            path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
            imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/375-300.png',
        }
        // #elif ANDROID
        return {
            title: '这个小程序太赞了！孩子朗读能力蹭蹭上涨，推荐你试试！',
            userName: 'gh_50f61361ad1d',
            path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
            imagePath: '/static/375-300-1.jpg',
            webpageUrl: 'http://www.efunbox.cn',
            withShareTicket: true,
            miniprogramType: 1,
            scene: 0,
        }
        // #endif
    }
})