Browse Source

转赠分享传值处理

tags/富茂链客4.1.0
刘晖 6 years ago
parent
commit
3442300264
4 changed files with 47 additions and 8 deletions
  1. +20
    -2
      pages/ConsumeDetail/ConsumeDetail.js
  2. +1
    -1
      pages/ConsumeDetail/ConsumeDetail.wxml
  3. +7
    -0
      pages/coupon/detail/index.js
  4. +19
    -5
      pages/index/index.js

+ 20
- 2
pages/ConsumeDetail/ConsumeDetail.js View File

@@ -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({


+ 1
- 1
pages/ConsumeDetail/ConsumeDetail.wxml View File

@@ -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>

+ 7
- 0
pages/coupon/detail/index.js View File

@@ -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 => {


+ 19
- 5
pages/index/index.js View File

@@ -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();
} }


Loading…
Cancel
Save