|
@@ -13,6 +13,8 @@ Page({ |
|
@@ -13,6 +13,8 @@ Page({ |
|
13
|
exp_date: {},
|
13
|
exp_date: {},
|
|
14
|
resultCoupon: '', //0未领取 1已领取
|
14
|
resultCoupon: '', //0未领取 1已领取
|
|
15
|
},
|
15
|
},
|
|
|
|
16
|
+ myModal: '',
|
|
|
|
17
|
+ myToast :'',
|
|
16
|
/**
|
18
|
/**
|
|
17
|
* 生命周期函数--监听页面加载
|
19
|
* 生命周期函数--监听页面加载
|
|
18
|
*/
|
20
|
*/
|
|
@@ -35,13 +37,15 @@ Page({ |
|
@@ -35,13 +37,15 @@ Page({ |
|
35
|
id: options.id || obj.id,
|
37
|
id: options.id || obj.id,
|
|
36
|
sid: options.sid || obj.sid,
|
38
|
sid: options.sid || obj.sid,
|
|
37
|
oid: options.oid,
|
39
|
oid: options.oid,
|
|
38
|
- types: options.types || obj.types, //1是邀请函过来的(邀请函的券或者点击意见反馈买券) 2是提前点餐 3是商家APP分享的或者短信的链接
|
40
|
+ types: options.types || obj.types, //1是邀请函过来的(邀请函的券或者点击意见反馈买券) 2是提前点餐 3是商家APP分享的或者短信的链接 4好友赠送的券
|
|
39
|
rid: options.rid ? options.rid : '',
|
41
|
rid: options.rid ? options.rid : '',
|
|
|
|
42
|
+ activity_id:options.activity_id || '',
|
|
40
|
}
|
43
|
}
|
|
41
|
})
|
44
|
})
|
|
42
|
console.log('opt', {
|
45
|
console.log('opt', {
|
|
43
|
...this.data.opt
|
46
|
...this.data.opt
|
|
44
|
});
|
47
|
});
|
|
|
|
48
|
+ this.myModal = this.selectComponent("#myModal");
|
|
45
|
},
|
49
|
},
|
|
46
|
// 购买完成券之后关注公众号
|
50
|
// 购买完成券之后关注公众号
|
|
47
|
wananchi() {
|
51
|
wananchi() {
|
|
@@ -68,6 +72,28 @@ Page({ |
|
@@ -68,6 +72,28 @@ Page({ |
|
68
|
icon: 'none'
|
72
|
icon: 'none'
|
|
69
|
})
|
73
|
})
|
|
70
|
}
|
74
|
}
|
|
|
|
75
|
+ // 好友分享的券
|
|
|
|
76
|
+ if(this.data.opt.types=='4'){
|
|
|
|
77
|
+ App.Activity.GetStatusByActivityId({
|
|
|
|
78
|
+ activity_id: this.data.opt.activity_id
|
|
|
|
79
|
+ }).then(res => {
|
|
|
|
80
|
+ // status 0未核销 1已核销
|
|
|
|
81
|
+ if (res.ret === 200 && res.data.status == '0') {
|
|
|
|
82
|
+ this.getActivityCouponFun('1')
|
|
|
|
83
|
+ }else{
|
|
|
|
84
|
+ this.myModal.showModal()
|
|
|
|
85
|
+ }
|
|
|
|
86
|
+ })
|
|
|
|
87
|
+ }else{
|
|
|
|
88
|
+ this.getActivityCouponFun()
|
|
|
|
89
|
+ }
|
|
|
|
90
|
+ }, 3000),
|
|
|
|
91
|
+ // 关闭领券失败弹框
|
|
|
|
92
|
+ closeCouponModal() {
|
|
|
|
93
|
+ this.myModal.closeModal()
|
|
|
|
94
|
+ },
|
|
|
|
95
|
+ // 领券
|
|
|
|
96
|
+ getActivityCouponFun(type){
|
|
71
|
let detail = this.data.detail
|
97
|
let detail = this.data.detail
|
|
72
|
detail.name = this.data.sellername;
|
98
|
detail.name = this.data.sellername;
|
|
73
|
detail.oid = this.data.opt.oid;
|
99
|
detail.oid = this.data.opt.oid;
|
|
@@ -76,16 +102,28 @@ Page({ |
|
@@ -76,16 +102,28 @@ Page({ |
|
76
|
rid: this.data.opt.oid,
|
102
|
rid: this.data.opt.oid,
|
|
77
|
}).then((json) => {
|
103
|
}).then((json) => {
|
|
78
|
if (json.ret == 200) {
|
104
|
if (json.ret == 200) {
|
|
79
|
- util.toast('领取成功', 'none');
|
105
|
+ if(type == '1'){//核销分享人的券
|
|
|
|
106
|
+ this.writeOff()
|
|
|
|
107
|
+ }else{
|
|
|
|
108
|
+ this.myToast.showToast('领取成功', 2000)
|
|
|
|
109
|
+ this.getCoupon()
|
|
|
|
110
|
+ }
|
|
80
|
} else {
|
111
|
} else {
|
|
81
|
- wx.showToast({
|
|
|
|
82
|
- title: res.msg,
|
|
|
|
83
|
- duration: 2000,
|
|
|
|
84
|
- mask: true
|
|
|
|
85
|
- })
|
112
|
+ this.myToast.showToast(res.msg, 2000)
|
|
86
|
}
|
113
|
}
|
|
87
|
})
|
114
|
})
|
|
88
|
- }, 3000),
|
115
|
+ },
|
|
|
|
116
|
+ // 好友领取后核销
|
|
|
|
117
|
+ writeOff(){
|
|
|
|
118
|
+ App.Activity.SetActivityStatus({
|
|
|
|
119
|
+ id: this.data.opt.activity_id
|
|
|
|
120
|
+ }).then(res => {
|
|
|
|
121
|
+ if (res.ret == '200') {
|
|
|
|
122
|
+ this.myToast.showToast('领取成功', 2000)
|
|
|
|
123
|
+ this.getCoupon()
|
|
|
|
124
|
+ }
|
|
|
|
125
|
+ })
|
|
|
|
126
|
+ },
|
|
89
|
// 获取券信息
|
127
|
// 获取券信息
|
|
90
|
getDetail() {
|
128
|
getDetail() {
|
|
91
|
App.Activity.GetActivityById({
|
129
|
App.Activity.GetActivityById({
|
|
@@ -167,26 +205,17 @@ Page({ |
|
@@ -167,26 +205,17 @@ Page({ |
|
167
|
firstTitle
|
205
|
firstTitle
|
|
168
|
};
|
206
|
};
|
|
169
|
},
|
207
|
},
|
|
170
|
- // 点转发后核销
|
|
|
|
171
|
- writeOff(){
|
|
|
|
172
|
- console.log('点转发后',{...this.data.detail});
|
|
|
|
173
|
- if(this.data.detail.arule.is_share_have == '0' && this.data.detail.activity_id){
|
|
|
|
174
|
- App.Activity.SetActivityStatus({
|
|
|
|
175
|
- id: this.data.detail.activity_id,
|
|
|
|
176
|
- }).then(res => {
|
|
|
|
177
|
- if (res.ret == '200') {
|
|
|
|
178
|
- console.log('转发核销');
|
|
|
|
179
|
- wx.hideShareMenu()
|
|
|
|
180
|
- }
|
|
|
|
181
|
- })
|
|
|
|
182
|
- }
|
|
|
|
183
|
- },
|
|
|
|
184
|
sharesetting() {
|
208
|
sharesetting() {
|
|
185
|
let data = this.data.opt;
|
209
|
let data = this.data.opt;
|
|
186
|
let detail = this.data.detail;
|
210
|
let detail = this.data.detail;
|
|
|
|
211
|
+ let types = detail.arule.is_share_have == '0' && detail.activity_id ? '4': data.types;
|
|
|
|
212
|
+ let path = `/pack-activity/pack/receiveCoupon?id=${data.id}&oid=${data.oid}&rid=${data.rid}&sid=${data.sid}&types=${types}`
|
|
|
|
213
|
+ if(detail.arule.is_share_have == '0' && detail.activity_id){
|
|
|
|
214
|
+ path += '&activity_id='+detail.activity_id
|
|
|
|
215
|
+ }
|
|
187
|
return {
|
216
|
return {
|
|
188
|
title: `送你${this.data.sellername}${detail.price}元代金券,点击查看详情,领取到卡包吧!`,
|
217
|
title: `送你${this.data.sellername}${detail.price}元代金券,点击查看详情,领取到卡包吧!`,
|
|
189
|
- path: `/pack-activity/pack/receiveCoupon?id=${data.id}&oid=${data.oid}&rid=${data.rid}&sid=${data.sid}&types=${data.types}`,
|
218
|
+ path,
|
|
190
|
imageUrl: 'https://nosqn.colorcun.com/share_money.png',
|
219
|
imageUrl: 'https://nosqn.colorcun.com/share_money.png',
|
|
191
|
}
|
220
|
}
|
|
192
|
},
|
221
|
},
|
|
@@ -209,6 +238,7 @@ Page({ |
|
@@ -209,6 +238,7 @@ Page({ |
|
209
|
* 生命周期函数--监听页面初次渲染完成
|
238
|
* 生命周期函数--监听页面初次渲染完成
|
|
210
|
*/
|
239
|
*/
|
|
211
|
onReady() {
|
240
|
onReady() {
|
|
|
|
241
|
+ this.myToast = this.selectComponent("#myToast")
|
|
212
|
this.getDetail();
|
242
|
this.getDetail();
|
|
213
|
this.getSellerDetail();
|
243
|
this.getSellerDetail();
|
|
214
|
this.getCoupon()
|
244
|
this.getCoupon()
|
|
@@ -253,7 +283,6 @@ Page({ |
|
@@ -253,7 +283,6 @@ Page({ |
|
253
|
* 用户点击右上角分享
|
283
|
* 用户点击右上角分享
|
|
254
|
*/
|
284
|
*/
|
|
255
|
onShareAppMessage() {
|
285
|
onShareAppMessage() {
|
|
256
|
- this.writeOff()
|
|
|
|
257
|
return this.sharesetting();
|
286
|
return this.sharesetting();
|
|
258
|
}
|
287
|
}
|
|
259
|
}) |
288
|
}) |