123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- 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,
- })
- }
- },
- })
|