| @@ -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({ | |||
| @@ -36,5 +36,5 @@ | |||
| <image src="{{dingdanUrl}}" mode="widthFix"></image> | |||
| <text>暂无交易明细</text> | |||
| </view> | |||
| <button type="primary" class='support-tansfer' bindtap='goToTranser'><image src="{{weixinTitle}}" class='share' mode="widthFix"></image>转赠给微信好友</button> | |||
| <button type="primary" open-type="share" wx:if="{{supportTransfer==1}}" class='support-tansfer'><image src="{{weixinTitle}}" class='share' mode="widthFix"></image>转赠给微信好友</button> | |||
| </view> | |||
| @@ -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 => { | |||
| @@ -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(); | |||
| } | |||