|
...
|
...
|
@@ -13,6 +13,8 @@ Page({ |
|
|
|
exp_date: {},
|
|
|
|
resultCoupon: '', //0未领取 1已领取
|
|
|
|
},
|
|
|
|
myModal: '',
|
|
|
|
myToast :'',
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
...
|
...
|
@@ -35,13 +37,15 @@ Page({ |
|
|
|
id: options.id || obj.id,
|
|
|
|
sid: options.sid || obj.sid,
|
|
|
|
oid: options.oid,
|
|
|
|
types: options.types || obj.types, //1是邀请函过来的(邀请函的券或者点击意见反馈买券) 2是提前点餐 3是商家APP分享的或者短信的链接
|
|
|
|
types: options.types || obj.types, //1是邀请函过来的(邀请函的券或者点击意见反馈买券) 2是提前点餐 3是商家APP分享的或者短信的链接 4好友赠送的券
|
|
|
|
rid: options.rid ? options.rid : '',
|
|
|
|
activity_id:options.activity_id || '',
|
|
|
|
}
|
|
|
|
})
|
|
|
|
console.log('opt', {
|
|
|
|
...this.data.opt
|
|
|
|
});
|
|
|
|
this.myModal = this.selectComponent("#myModal");
|
|
|
|
},
|
|
|
|
// 购买完成券之后关注公众号
|
|
|
|
wananchi() {
|
|
...
|
...
|
@@ -68,6 +72,28 @@ Page({ |
|
|
|
icon: 'none'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
// 好友分享的券
|
|
|
|
if(this.data.opt.types=='4'){
|
|
|
|
App.Activity.GetStatusByActivityId({
|
|
|
|
activity_id: this.data.opt.activity_id
|
|
|
|
}).then(res => {
|
|
|
|
// status 0未核销 1已核销
|
|
|
|
if (res.ret === 200 && res.data.status == '0') {
|
|
|
|
this.getActivityCouponFun('1')
|
|
|
|
}else{
|
|
|
|
this.myModal.showModal()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
this.getActivityCouponFun()
|
|
|
|
}
|
|
|
|
}, 3000),
|
|
|
|
// 关闭领券失败弹框
|
|
|
|
closeCouponModal() {
|
|
|
|
this.myModal.closeModal()
|
|
|
|
},
|
|
|
|
// 领券
|
|
|
|
getActivityCouponFun(type){
|
|
|
|
let detail = this.data.detail
|
|
|
|
detail.name = this.data.sellername;
|
|
|
|
detail.oid = this.data.opt.oid;
|
|
...
|
...
|
@@ -76,16 +102,28 @@ Page({ |
|
|
|
rid: this.data.opt.oid,
|
|
|
|
}).then((json) => {
|
|
|
|
if (json.ret == 200) {
|
|
|
|
util.toast('领取成功', 'none');
|
|
|
|
if(type == '1'){//核销分享人的券
|
|
|
|
this.writeOff()
|
|
|
|
}else{
|
|
|
|
this.myToast.showToast('领取成功', 2000)
|
|
|
|
this.getCoupon()
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
wx.showToast({
|
|
|
|
title: res.msg,
|
|
|
|
duration: 2000,
|
|
|
|
mask: true
|
|
|
|
})
|
|
|
|
this.myToast.showToast(res.msg, 2000)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}, 3000),
|
|
|
|
},
|
|
|
|
// 好友领取后核销
|
|
|
|
writeOff(){
|
|
|
|
App.Activity.SetActivityStatus({
|
|
|
|
id: this.data.opt.activity_id
|
|
|
|
}).then(res => {
|
|
|
|
if (res.ret == '200') {
|
|
|
|
this.myToast.showToast('领取成功', 2000)
|
|
|
|
this.getCoupon()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 获取券信息
|
|
|
|
getDetail() {
|
|
|
|
App.Activity.GetActivityById({
|
|
...
|
...
|
@@ -167,26 +205,17 @@ Page({ |
|
|
|
firstTitle
|
|
|
|
};
|
|
|
|
},
|
|
|
|
// 点转发后核销
|
|
|
|
writeOff(){
|
|
|
|
console.log('点转发后',{...this.data.detail});
|
|
|
|
if(this.data.detail.arule.is_share_have == '0' && this.data.detail.activity_id){
|
|
|
|
App.Activity.SetActivityStatus({
|
|
|
|
id: this.data.detail.activity_id,
|
|
|
|
}).then(res => {
|
|
|
|
if (res.ret == '200') {
|
|
|
|
console.log('转发核销');
|
|
|
|
wx.hideShareMenu()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
sharesetting() {
|
|
|
|
let data = this.data.opt;
|
|
|
|
let detail = this.data.detail;
|
|
|
|
let types = detail.arule.is_share_have == '0' && detail.activity_id ? '4': data.types;
|
|
|
|
let path = `/pack-activity/pack/receiveCoupon?id=${data.id}&oid=${data.oid}&rid=${data.rid}&sid=${data.sid}&types=${types}`
|
|
|
|
if(detail.arule.is_share_have == '0' && detail.activity_id){
|
|
|
|
path += '&activity_id='+detail.activity_id
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
title: `送你${this.data.sellername}${detail.price}元代金券,点击查看详情,领取到卡包吧!`,
|
|
|
|
path: `/pack-activity/pack/receiveCoupon?id=${data.id}&oid=${data.oid}&rid=${data.rid}&sid=${data.sid}&types=${data.types}`,
|
|
|
|
path,
|
|
|
|
imageUrl: 'https://nosqn.colorcun.com/share_money.png',
|
|
|
|
}
|
|
|
|
},
|
|
...
|
...
|
@@ -209,6 +238,7 @@ Page({ |
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
|
|
onReady() {
|
|
|
|
this.myToast = this.selectComponent("#myToast")
|
|
|
|
this.getDetail();
|
|
|
|
this.getSellerDetail();
|
|
|
|
this.getCoupon()
|
|
...
|
...
|
@@ -253,7 +283,6 @@ Page({ |
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage() {
|
|
|
|
this.writeOff()
|
|
|
|
return this.sharesetting();
|
|
|
|
}
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|