Commit 30d86bc5752d4149eedaee2fd578da527727d760
1 parent
38a7deba
尾款的平摊优化
Showing
2 changed files
with
7 additions
and
2 deletions
packageE/pages/cart/cart_wk/cart_wk.js
@@ -338,6 +338,10 @@ Page({ | @@ -338,6 +338,10 @@ Page({ | ||
338 | } | 338 | } |
339 | }) | 339 | }) |
340 | 340 | ||
341 | + //-- 之前用的券要清理掉,从头选 -- | ||
342 | + if(order.coupon_no){ | ||
343 | + await getApp().request.promiseDelete('/api/weshop/users/frozenQuan/del/'+order.user_id+'/'+order.coupon_no) | ||
344 | + } | ||
341 | 345 | ||
342 | if(act_set.is_order_yh){ | 346 | if(act_set.is_order_yh){ |
343 | th.data.bn_is_order_yh=1; | 347 | th.data.bn_is_order_yh=1; |
utils/request.js
@@ -270,16 +270,17 @@ module.exports = { | @@ -270,16 +270,17 @@ module.exports = { | ||
270 | //---promise的使用delete---- | 270 | //---promise的使用delete---- |
271 | promiseDelete: function (url, data) { | 271 | promiseDelete: function (url, data) { |
272 | var th = this; | 272 | var th = this; |
273 | + if(!data) data={}; | ||
273 | if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url; | 274 | if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url; |
274 | return new Promise((resolve, reject) => { | 275 | return new Promise((resolve, reject) => { |
275 | - data.isShowLoading && th.showLoading(); | 276 | + data && data.isShowLoading && th.showLoading(); |
276 | wx.request({ | 277 | wx.request({ |
277 | url, | 278 | url, |
278 | method: 'DELETE', | 279 | method: 'DELETE', |
279 | header: { "content-type": "application/x-www-form-urlencoded" }, | 280 | header: { "content-type": "application/x-www-form-urlencoded" }, |
280 | data: data.data, | 281 | data: data.data, |
281 | success(res) { | 282 | success(res) { |
282 | - data.isShowLoading && th.hideLoading(); | 283 | + data && data.isShowLoading && th.hideLoading(); |
283 | resolve(res); | 284 | resolve(res); |
284 | }, | 285 | }, |
285 | fail(err) { data.isShowLoading && th.hideLoading(); reject(err); } | 286 | fail(err) { data.isShowLoading && th.hideLoading(); reject(err); } |