| @@ -63,7 +63,24 @@ Page({ | |||||
| }); | }); | ||||
| }, | }, | ||||
| goToTranser(){ | 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() { | more: function() { | ||||
| @@ -142,7 +159,8 @@ Page({ | |||||
| res.data.expiredTime = util.formatTime(res.data.expiredTime, "yyyy-MM-dd hh:mm:ss") | res.data.expiredTime = util.formatTime(res.data.expiredTime, "yyyy-MM-dd hh:mm:ss") | ||||
| that.setData({ | that.setData({ | ||||
| showPage: true, | showPage: true, | ||||
| cardDetail: res.data | |||||
| cardDetail: res.data, | |||||
| supportTransfer: res.data.supportTransfer | |||||
| }) | }) | ||||
| if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length<=4){ | if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length<=4){ | ||||
| that.setData({ | that.setData({ | ||||
| @@ -36,5 +36,5 @@ | |||||
| <image src="{{dingdanUrl}}" mode="widthFix"></image> | <image src="{{dingdanUrl}}" mode="widthFix"></image> | ||||
| <text>暂无交易明细</text> | <text>暂无交易明细</text> | ||||
| </view> | </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> | </view> | ||||
| @@ -224,6 +224,12 @@ Page({ | |||||
| wx.showLoading({ | wx.showLoading({ | ||||
| title: "加载中..." | title: "加载中..." | ||||
| }); | }); | ||||
| /** | |||||
| * 转赠判断 | |||||
| */ | |||||
| if (options.cuserId){ | |||||
| } | |||||
| that.setData({ | that.setData({ | ||||
| couponChannelId: options.couponChannelId, | couponChannelId: options.couponChannelId, | ||||
| couponId: options.couponId, | couponId: options.couponId, | ||||
| @@ -652,6 +658,7 @@ Page({ | |||||
| that.checkuerstatus(couponChannelId, couponId, orderId); | that.checkuerstatus(couponChannelId, couponId, orderId); | ||||
| } else { | } else { | ||||
| that.checkuerstatus(); | that.checkuerstatus(); | ||||
| } | } | ||||
| }) | }) | ||||
| .catch(err => { | .catch(err => { | ||||
| @@ -32,22 +32,36 @@ Page({ | |||||
| } | } | ||||
| app.getLocation(); | app.getLocation(); | ||||
| if (options.couponChannelId && options.couponId || options.orderId) { | 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 { | } else { | ||||
| that.userLogin() | that.userLogin() | ||||
| } | } | ||||
| }, | }, | ||||
| checkuerstatus(couponChannelId, couponId, orderId) { | |||||
| checkuerstatus(couponChannelId, couponId, orderId, cuserId, coverImg) { | |||||
| let that = this; | let that = this; | ||||
| Http.post({ | Http.post({ | ||||
| url: config.api.checkUserStatus, | url: config.api.checkUserStatus, | ||||
| data: {} | data: {} | ||||
| }) | }) | ||||
| .then(res => { | .then(res => { | ||||
| if (couponChannelId && couponId) { | |||||
| if (couponChannelId && couponId && !cuserId) { | |||||
| wx.redirectTo({ | wx.redirectTo({ | ||||
| url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}`, | 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) { | } else if (orderId) { | ||||
| wx.redirectTo({ | wx.redirectTo({ | ||||
| url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${orderId}&from='${"discount"}`, | 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; | var that = this; | ||||
| // 登录 | // 登录 | ||||
| wx.login({ | wx.login({ | ||||
| @@ -123,7 +137,7 @@ Page({ | |||||
| app.globalData.token = res.data.token; | app.globalData.token = res.data.token; | ||||
| Http.setToken(res.data.token); | Http.setToken(res.data.token); | ||||
| if (couponChannelId&&couponId || orderId){ | if (couponChannelId&&couponId || orderId){ | ||||
| that.checkuerstatus(couponChannelId, couponId, orderId); | |||||
| that.checkuerstatus(couponChannelId, couponId, orderId, cuserId, coverImg); | |||||
| }else{ | }else{ | ||||
| that.checkuerstatus(); | that.checkuerstatus(); | ||||
| } | } | ||||