Commit 35e87dd4f5f176669eecb80fcc5fc23afc5e2727
1 parent
e35671c4
红包连续点击问题修改
Showing
1 changed file
with
43 additions
and
36 deletions
packageA/pages/hongBao/hongBao.js
... | ... | @@ -12,6 +12,7 @@ Page({ |
12 | 12 | data: { |
13 | 13 | url: app.globalData.setting.imghost, |
14 | 14 | qiangHongBao: false, |
15 | + qianging: false, | |
15 | 16 | time: null, |
16 | 17 | |
17 | 18 | // hongBaoData: null, //保存抢红包活动的相关时间等信息 |
... | ... | @@ -223,42 +224,47 @@ Page({ |
223 | 224 | }, |
224 | 225 | |
225 | 226 | qiangHongBao() { |
226 | - app.request.promisePost('/api/weshop/redmoney/redRecord/saveRecord', { | |
227 | - data: { | |
228 | - store_id: app.globalData.setting.stoid, | |
229 | - user_id: app.globalData.user_id, | |
230 | - redid: this.data.hongBaoData.id, | |
231 | - } | |
232 | - }) | |
233 | - .then(res => { | |
234 | - if(res.data.code == 0){ | |
235 | - // wx.hideLoading(); | |
236 | - // wx.showToast({ | |
237 | - // title: '领取成功', | |
238 | - // icon: 'success', | |
239 | - // duration: 2000 | |
240 | - // }); | |
241 | - console.log('请求提交成功',res.data); | |
242 | - // if(callback) { | |
243 | - // callback(res.data.data); | |
244 | - // } | |
245 | - } else if(res.data.code === -1) { | |
246 | - // wx.hideLoading(); | |
247 | - // wx.showToast({ | |
248 | - // title: '领取失败:' + res.data.msg, | |
249 | - // icon: 'none', | |
250 | - // duration: 2000 | |
251 | - // }); | |
252 | - // self.setData({ | |
253 | - // result: res.data | |
254 | - // }); | |
255 | - | |
256 | - }; | |
257 | - self.setData({ | |
258 | - result: res.data, | |
259 | - qiangHongBao: true, | |
260 | - }); | |
261 | - }) | |
227 | + if(!this.data.qianging) { | |
228 | + this.data.qianging = true; | |
229 | + app.request.promisePost('/api/weshop/redmoney/redRecord/saveRecord', { | |
230 | + data: { | |
231 | + store_id: app.globalData.setting.stoid, | |
232 | + user_id: app.globalData.user_id, | |
233 | + redid: this.data.hongBaoData.id, | |
234 | + } | |
235 | + }) | |
236 | + .then(res => { | |
237 | + // if(res.data.code == 0){ | |
238 | + // // wx.hideLoading(); | |
239 | + // // wx.showToast({ | |
240 | + // // title: '领取成功', | |
241 | + // // icon: 'success', | |
242 | + // // duration: 2000 | |
243 | + // // }); | |
244 | + // console.log('请求提交成功',res.data); | |
245 | + | |
246 | + // // if(callback) { | |
247 | + // // callback(res.data.data); | |
248 | + // // } | |
249 | + // } else if(res.data.code === -1) { | |
250 | + // // wx.hideLoading(); | |
251 | + // // wx.showToast({ | |
252 | + // // title: '领取失败:' + res.data.msg, | |
253 | + // // icon: 'none', | |
254 | + // // duration: 2000 | |
255 | + // // }); | |
256 | + // // self.setData({ | |
257 | + // // result: res.data | |
258 | + // // }); | |
259 | + | |
260 | + // }; | |
261 | + self.setData({ | |
262 | + result: res.data, | |
263 | + qiangHongBao: true, | |
264 | + }); | |
265 | + }) | |
266 | + } | |
267 | + | |
262 | 268 | |
263 | 269 | }, |
264 | 270 | |
... | ... | @@ -310,6 +316,7 @@ Page({ |
310 | 316 | closePopup() { |
311 | 317 | this.setData({ |
312 | 318 | qiangHongBao: false, |
319 | + qianging: false, | |
313 | 320 | }); |
314 | 321 | }, |
315 | 322 | ... | ... |