import Navi from '../../utils/navi' import { getUser } from '../../utils/util' const menuData = [ [ { title: '收货地址', tit: '', url: '/pages/mine/myaddr/list/index', type: 'address', }, { title: '优惠券', tit: '', url: '', type: 'coupon', }, { title: '积分', tit: '', url: '', type: 'point', }, ], [ { title: '购物卡余额查询', tit: '', url: '', type: 'point', }, { title: '客服热线', tit: '', url: '', type: 'service', icon: 'service', }, { title: '我要反馈', tit: '', url: '', type: 'help-center', }, ], ] const orderTagInfos = [ { title: '待付款', iconName: 'daifukuan', orderNum: 0, tabType: 5, status: 1, }, { title: '待发货', iconName: 'daifahuo', orderNum: 0, tabType: 10, status: 1, }, { title: '待收货', iconName: 'daishouhuo', orderNum: 0, tabType: 40, status: 1, }, { title: '待评价', iconName: 'daipingjia', orderNum: 0, tabType: 60, status: 1, }, { title: '退款/售后', iconName: 'tuikuantuihuo', orderNum: 0, tabType: 0, status: 1, }, ] const getDefaultData = () => ({ showMakePhone: false, userInfo: { avatarUrl: '', nickName: '请登录', phoneNumber: '', }, menuData, orderTagInfos, customerServiceInfo: {}, currAuthStep: 1, showKefu: true, versionNo: '', }) Page({ /** * 页面的初始数据 */ data: getDefaultData(), /** * 生命周期函数--监听页面加载 */ onLoad() {}, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() {}, /** * 生命周期函数--监听页面显示 */ onShow() { this.getUserInfo() this.getVersionInfo() this.getTabBar().init() }, /** * 生命周期函数--监听页面隐藏 */ onHide() {}, /** * 生命周期函数--监听页面卸载 */ onUnload() {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom() {}, /** * 用户点击右上角分享 */ onShareAppMessage() {}, getUserInfo() { const info = getUser() if (info != null) { this.setData({ userInfo: info as any, }) } else { this.setData({ userInfo: { avatarUrl: '', nickName: '请登录', phoneNumber: '', }, }) } }, getVersionInfo() { const versionInfo = wx.getAccountInfoSync() const { version, envVersion = __wxConfig } = versionInfo.miniProgram this.setData({ versionNo: envVersion === 'release' ? version : envVersion, }) }, gotoLogin() { Navi.navigateTo({ url: '/pages/login/index', }) }, gotoSetting() { Navi.navigateTo({ url: '/pages/mine/setting/index', }) }, jumpAllOrder() { Navi.navigateTo({ url: '/pages/mine/myorder/list/index', }) }, jumpNav(e: WechatMiniprogram.CustomEvent<{}>) { console.log('jump', e) }, onClickCell( e: WechatMiniprogram.CustomEvent< {}, {}, { item: { title: string tit: string url: string type: string icon: string } } >, ) { const item = e.currentTarget.dataset.item if (item.url && item.url.length > 0) { Navi.navigateTo({ url: item.url, }) } }, })