import R from '../../utils/request'; import C from '../../utils/constant'; import * as F from '../../utils/func'; Page({ data: { cdnHost: C.cdnHost, phone: '', name: '', price_sum: '', share_cnt: '', share_view_cnt: '', is_share: false, show_vip_link: false, payed_vip_link: '', }, onLoad() { }, onShow() { this.getTabBar().init(); this.init(); }, onPullDownRefresh() { this.init(); }, init() { this.fetUserInfoHandle(); }, fetUserInfoHandle() { R.get('/index.php/api/v1/my').then(({ model }) => { this.setData({ name: model.real_name || model.nick_name || '微信用户', phone: model.phone || '-', share_cnt: model.share_cnt, share_view_cnt: model.share_view_cnt, price_sum: F.formatePrice(model.price_sum || 0), is_share: !!model.is_share, show_vip_link: model.show_vip_link || false, payed_vip_link: model.payed_vip_link || '', }); }) }, getPhoneNumber(e) { console.log(e.detail.code) // 动态令牌 console.log(e.detail.errMsg) // 回调信息(成功失败都会返回) console.log(e.detail.errno) // 错误码(失败时返回) if (!e.detail.errno) { R.post('/index.php/api/v1/bind_auth_phone', { code: e.detail.code }).then(() => { this.setData({ hasPhone: true }) this.goH5Shop(); }) } else { // e.detail.errMsg } }, goShared() { wx.switchTab({ url: '/pages/faxianlist/faxianlist', }) }, goOrder() { wx.navigateTo({ url: '/pages/paylist/paylist' }) }, toVipLink() { wx.navigateTo({ url: '/pages/webview/webview?url='+encodeURIComponent(this.data.payed_vip_link) }) }, goSharelist() { wx.navigateTo({ url: '/pages/sharelist/sharelist' }) }, goInfo() { wx.navigateTo({ url: '/pages/usercenter/info', }) }, });