From c2b172f411e5c565cbfd107d200908b4880d7dfa Mon Sep 17 00:00:00 2001 From: XiaoXinPro 14 IAH5R <568170040@qq.com> Date: Wed, 22 Mar 2023 17:59:21 +0800 Subject: [PATCH] upload --- pages/coupon/detail/index.js | 74 +++--------------------------------- 1 file changed, 6 insertions(+), 68 deletions(-) diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 8bd8a6c..873c7e8 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -484,7 +484,7 @@ Page({ * 获取用户信息 */ onLoad(options) { - if (app.globalData.token) { + const dealData = options => { console.log(options, 'options'); if (options.mallTenantId || options.tenantId) { tt.setStorageSync('locationSwitch', 0); @@ -552,75 +552,13 @@ Page({ cardType: options.cardType }) } + } + + if (app.globalData.token) { + dealData(options) } else { app.tokenCallback = token => { - console.log(options, 'options'); - if (options.mallTenantId || options.tenantId) { - tt.setStorageSync('locationSwitch', 0); - this.setData({ - mallTenantId: options.mallTenantId || options.tenantId, - }) - } - - Http.get({ - url: '/mall/subMall?isAll=1', - }).then(res => { - console.log(res.data, 'subMall'); - const mallList = res.data - mallList.forEach((item, index) => { - if (item.tenantId == (options.mallTenantId || options.tenantId)) { - tt.setStorageSync('mallTenantId', options.mallTenantId || options.tenantId) - tt.setStorageSync('mallIndex', index) - } - }) - }).catch(err => {}) - - this.setData({ - mouldType: app.globalData.mouldType, - }) - let that = this; - if (options.g) { - app.globalData.havePlayEd1 = true; - } - tt.showLoading({ - title: "加载中..." - }); - that.setData({ - onshow: false - }) - if (options && (options.couponChannelId || options.couponIds)) { - - if (options.couponIds) { - this.setData({ - couponIds: options.couponIds - }) - that.getDetail(options.couponIds, 'notendclock'); - } else { - that.getDetail(options.couponChannelId, 'notendclock'); - that.getSupId(options.couponChannelId) - } - - - } - /** - * 转赠判断 - */ - if (options.cuserId) { - this.setData({ - showCardOffer: true, - cardData: options - }) - this.getUserInfo() - } - that.setData({ - couponChannelId: options.couponChannelId, - title: that.data.data.title ? that.data.data.title : '', - }); - if (options.cardType) { - that.setData({ - cardType: options.cardType - }) - } + dealData(options) } }