diff --git a/app.js b/app.js index d7949d0..dd92963 100644 --- a/app.js +++ b/app.js @@ -74,6 +74,7 @@ App({ }, login() { + console.log('login!'); let that = this; tt.login({ success: (res => { diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 9efec9f..8bd8a6c 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -484,73 +484,147 @@ Page({ * 获取用户信息 */ onLoad(options) { - console.log(options, 'options'); - if (options.mallTenantId || options.tenantId) { - tt.setStorageSync('locationSwitch', 0); + if (app.globalData.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({ - mallTenantId: options.mallTenantId || options.tenantId, + 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)) { - 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) + if (options.couponIds) { + this.setData({ + couponIds: options.couponIds + }) + that.getDetail(options.couponIds, 'notendclock'); + } else { + that.getDetail(options.couponChannelId, 'notendclock'); + that.getSupId(options.couponChannelId) } - }) - }).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) { + } + /** + * 转赠判断 + */ + if (options.cuserId) { this.setData({ - couponIds: options.couponIds + showCardOffer: true, + cardData: options }) - that.getDetail(options.couponIds, 'notendclock'); - } else { - that.getDetail(options.couponChannelId, 'notendclock'); - that.getSupId(options.couponChannelId) + this.getUserInfo() } + that.setData({ + couponChannelId: options.couponChannelId, + title: that.data.data.title ? that.data.data.title : '', + }); + if (options.cardType) { + that.setData({ + cardType: options.cardType + }) + } + } 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 + }) + } + } } - /** - * 转赠判断 - */ - 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 - }) - } + }, getHtml(couponChannelId) { Http.get({ diff --git a/project.config.json b/project.config.json index 7f71225..7c64a33 100644 --- a/project.config.json +++ b/project.config.json @@ -17,7 +17,7 @@ "projectname": "tt富茂C", "condition": { "miniprogram": { - "current": 1679365133968, + "current": 1679474738627, "list": [ { "id": 1678508631604, @@ -72,6 +72,15 @@ "scene": "990001", "launchFrom": "scan", "location": "qr_code" + }, + { + "id": 1679474738627, + "name": "detail", + "pathName": "pages/coupon/detail/index", + "query": "type=cd&couponChannelId=792625127019700224&tenantId=1033", + "scene": "027005", + "launchFrom": "live", + "location": "live_cart_card" } ] }