|
|
|
|
|
|
|
|
ticketUser:[],//优惠券信息 |
|
|
ticketUser:[],//优惠券信息 |
|
|
titleWord:"", |
|
|
titleWord:"", |
|
|
presentId:"",//接受的id |
|
|
presentId:"",//接受的id |
|
|
|
|
|
ticketNum:0, |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
app.globalData.present_id = options.shareId; |
|
|
app.globalData.present_id = options.shareId; |
|
|
this.data.presentId = options.shareId; |
|
|
this.data.presentId = options.shareId; |
|
|
app.globalData.number = options.number; |
|
|
app.globalData.number = options.number; |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
ticketNum: options.number |
|
|
|
|
|
}) |
|
|
this.getTicketUser(options.shareId, options.number); |
|
|
this.getTicketUser(options.shareId, options.number); |
|
|
// wx.showToast({ |
|
|
|
|
|
// title: options.number, |
|
|
|
|
|
// duration:2000 |
|
|
|
|
|
|
|
|
// wx.showModal({ |
|
|
|
|
|
// title: "options.shareId=" + options.shareId + "&options.number=" + options.number, |
|
|
|
|
|
// content: '', |
|
|
// }) |
|
|
// }) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
getTicketUser: function (id,number) {//获取优惠券信息 |
|
|
getTicketUser: function (id,number) {//获取优惠券信息 |
|
|
app.wxRequest(app.globalData.httpUrl + 'couponbuy/presentstate', { present_id: id, present_num: number }, e => { |
|
|
|
|
|
|
|
|
app.wxRequest(app.globalData.httpUrl + 'couponbuy/presentvisit', { present_id: id, present_num: number }, e => { |
|
|
console.log(e) |
|
|
console.log(e) |
|
|
if (e.code == 201) { |
|
|
if (e.code == 201) { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
|
|
|
|
|
|
onShareAppMessage: function () { |
|
|
onShareAppMessage: function () { |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
// "p1583395285z86" |
|
|
|
|
|
|
|
|
// "p1583474312b94" |
|
|
getTicketFn:function(){//点击领取优惠券 |
|
|
getTicketFn:function(){//点击领取优惠券 |
|
|
var id = this.data.presentId; |
|
|
var id = this.data.presentId; |
|
|
app.wxRequest(app.globalData.httpUrl + 'couponbuy/receive', { present_id: id }, e => { |
|
|
|
|
|
|
|
|
app.wxRequest(app.globalData.httpUrl + 'couponbuy/receivepresen', { present_id: id }, e => { |
|
|
console.log(e) |
|
|
console.log(e) |
|
|
if (e.code == 200) { |
|
|
if (e.code == 200) { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
|
|
|
|
|
|
url: '/pages/index/index' |
|
|
url: '/pages/index/index' |
|
|
}) |
|
|
}) |
|
|
},500) |
|
|
},500) |
|
|
} else if (e.code == -201) {//用户未注册 |
|
|
|
|
|
console.log(e.message) |
|
|
|
|
|
} else if (e.code == -202) {//没有相应赠品记录 |
|
|
|
|
|
console.log(e.message) |
|
|
|
|
|
}else if (e.code == -203){//无法领取自己的优惠券 |
|
|
|
|
|
console.log(e.message) |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '领取失败', |
|
|
|
|
|
duration: 500 |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (e.code == -204) {//赠送优惠券已领取 |
|
|
|
|
|
console.log(e.message) |
|
|
|
|
|
} else if (e.code == -205) {//优惠券已失效 |
|
|
|
|
|
console.log(e.message) |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '优惠券已失效', |
|
|
|
|
|
duration: 500 |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
}, this,"POST") |
|
|
}, this,"POST") |
|
|
}, |
|
|
}, |
|
|
backIndex:function(){//优惠券已被领取,点击确定返回首页 |
|
|
backIndex:function(){//优惠券已被领取,点击确定返回首页 |