diff --git a/pages/ConsumeDetail/ConsumeDetail.js b/pages/ConsumeDetail/ConsumeDetail.js index b0f7a7b..cd9ad70 100644 --- a/pages/ConsumeDetail/ConsumeDetail.js +++ b/pages/ConsumeDetail/ConsumeDetail.js @@ -63,7 +63,24 @@ Page({ }); }, goToTranser(){ - // wx. + this.onShareAppMessage(); + // wx.navigateTo({ + // url: '/pages/index/index?couponChannelId=' + this.data.cardDetail.couponChannelId + '&cuserId=' + this.data.cardDetail.cuserId + '&couponId=' + this.data.cardDetail.couponId, + // }) + }, + onShareAppMessage: function (res) { + let _this = this; + return { + title: '领取卡', + path: '/pages/index/index?couponChannelId=' + this.data.cardDetail.couponChannelId + '&cuserId=' + this.data.cardDetail.cuserId + '&couponId=' + this.data.cardDetail.couponId + '&coverImg' + this.data.cardDetail.coverImg, + imageUrl: this.data.cardDetail.coverImg, + success: function (res) { + // 转发成功 + }, + fail: function (res) { + // 转发失败 + } + } }, // 点击查看更多 more: function() { @@ -142,7 +159,8 @@ Page({ res.data.expiredTime = util.formatTime(res.data.expiredTime, "yyyy-MM-dd hh:mm:ss") that.setData({ showPage: true, - cardDetail: res.data + cardDetail: res.data, + supportTransfer: res.data.supportTransfer }) if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length<=4){ that.setData({ diff --git a/pages/ConsumeDetail/ConsumeDetail.wxml b/pages/ConsumeDetail/ConsumeDetail.wxml index 73bde19..d17d19c 100644 --- a/pages/ConsumeDetail/ConsumeDetail.wxml +++ b/pages/ConsumeDetail/ConsumeDetail.wxml @@ -36,5 +36,5 @@ 暂无交易明细 - + \ No newline at end of file diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 9a379c4..31a7e98 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -224,6 +224,12 @@ Page({ wx.showLoading({ title: "加载中..." }); + /** + * 转赠判断 + */ + if (options.cuserId){ + + } that.setData({ couponChannelId: options.couponChannelId, couponId: options.couponId, @@ -652,6 +658,7 @@ Page({ that.checkuerstatus(couponChannelId, couponId, orderId); } else { that.checkuerstatus(); + } }) .catch(err => { diff --git a/pages/index/index.js b/pages/index/index.js index b29ec3b..894e6c6 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -32,22 +32,36 @@ Page({ } app.getLocation(); if (options.couponChannelId && options.couponId || options.orderId) { - that.userLogin(options.couponChannelId, options.couponId, options.orderId); + if (options.cuserId){ + /** + * 转赠判断 + */ + that.userLogin(options.couponChannelId, options.couponId, null, options.cuserId, options.coverImg); + }else{ + that.userLogin(options.couponChannelId, options.couponId, options.orderId); + } } else { that.userLogin() } }, - checkuerstatus(couponChannelId, couponId, orderId) { + checkuerstatus(couponChannelId, couponId, orderId, cuserId, coverImg) { let that = this; Http.post({ url: config.api.checkUserStatus, data: {} }) .then(res => { - if (couponChannelId && couponId) { + if (couponChannelId && couponId && !cuserId) { wx.redirectTo({ url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}`, }) + } else if (couponChannelId && couponId && cuserId){ + /** + * 转赠判断 + */ + wx.redirectTo({ + url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}&cuserId=${cuserId}&coverImg=${coverImg}`, + }) } else if (orderId) { wx.redirectTo({ url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${orderId}&from='${"discount"}`, @@ -80,7 +94,7 @@ Page({ /** * 用户登录 */ - userLogin: function(couponChannelId, couponId, orderId) { + userLogin: function (couponChannelId, couponId, orderId, cuserId) { var that = this; // 登录 wx.login({ @@ -123,7 +137,7 @@ Page({ app.globalData.token = res.data.token; Http.setToken(res.data.token); if (couponChannelId&&couponId || orderId){ - that.checkuerstatus(couponChannelId, couponId, orderId); + that.checkuerstatus(couponChannelId, couponId, orderId, cuserId, coverImg); }else{ that.checkuerstatus(); }