Commit 86c41f15eb1ea242317bb655303de0b6da3110ea
Merge branch 'test' into 'qa'
Test See merge request !1128
Showing
2 changed files
with
53 additions
and
50 deletions
pages/cart/cart/cart.js
@@ -267,7 +267,7 @@ Page({ | @@ -267,7 +267,7 @@ Page({ | ||
267 | 267 | ||
268 | }, | 268 | }, |
269 | //清空失效宝贝 | 269 | //清空失效宝贝 |
270 | - delInva(obj=null){ | 270 | + delInva_all(obj=null){ |
271 | 271 | ||
272 | var th = this; | 272 | var th = this; |
273 | wx.showModal({ | 273 | wx.showModal({ |
@@ -275,62 +275,65 @@ Page({ | @@ -275,62 +275,65 @@ Page({ | ||
275 | content: '确认要清空全部失效商品吗?', | 275 | content: '确认要清空全部失效商品吗?', |
276 | success(res) { | 276 | success(res) { |
277 | if (res.confirm) { | 277 | if (res.confirm) { |
278 | - let ainvalid=''; | ||
279 | - let binvalid=''; | ||
280 | - var user_id = getApp().globalData.user_id; | ||
281 | - | ||
282 | - let ab = 0; //选中 | ||
283 | - let abc = 0; // | ||
284 | - let arr = obj.id ? [obj] : th.data.invalidList | ||
285 | - console.log('失效-----') | ||
286 | - console.log(arr); | ||
287 | - arr.map(item=>{ | ||
288 | - if (item.classType ==0 ) { | ||
289 | - ainvalid+=item.id + ','; | ||
290 | - ab = 1; | ||
291 | - } | ||
292 | - if (item.classType ==1 ) { | ||
293 | - binvalid+=item.id + ','; | ||
294 | - abc = 1; | ||
295 | - } | ||
296 | - }); | ||
297 | - | ||
298 | - | ||
299 | - if (ab == 0 && abc == 0 ) { | ||
300 | - t.my_warnning('没有需要清空的失效宝贝', 0, th); | ||
301 | - return false; | ||
302 | - } | ||
303 | - if (ab) { | ||
304 | - ainvalid = ainvalid.substring(0, ainvalid.length - 1); | ||
305 | - //要删除购物车中的商品 | ||
306 | - var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' + user_id + '/' + ainvalid; | ||
307 | - getApp().request.delete(url, { | ||
308 | - success: function (t) { | ||
309 | - th.getCardList(); | ||
310 | - getApp().requestCardNum(th); | ||
311 | - } | ||
312 | - }); | ||
313 | - } | ||
314 | - if (abc) { | ||
315 | - binvalid = binvalid.substring(0, binvalid.length - 1); | ||
316 | - //要删除购物车中的商品 | ||
317 | - var url = '/api/weshop/cartService/delIds/' + oo.stoid + '/' + user_id + '/' + binvalid; | ||
318 | - getApp().request.delete(url, { | ||
319 | - success: function (t) { | ||
320 | - th.getCardList(); | ||
321 | - getApp().requestCardNum(th); | ||
322 | - } | ||
323 | - }); | ||
324 | - } | ||
325 | - | 278 | + th.delInva(obj); |
326 | } | 279 | } |
327 | } | 280 | } |
328 | }) | 281 | }) |
282 | + }, | ||
283 | + | ||
284 | + | ||
285 | + delInva(obj){ | ||
286 | + var th=this; | ||
287 | + let ainvalid=''; | ||
288 | + let binvalid=''; | ||
289 | + var user_id = getApp().globalData.user_id; | ||
329 | 290 | ||
291 | + let ab = 0; //选中 | ||
292 | + let abc = 0; // | ||
293 | + let arr = obj.id ? [obj] : th.data.invalidList | ||
294 | + console.log('失效-----') | ||
295 | + console.log(arr); | ||
296 | + arr.map(item=>{ | ||
297 | + if (item.classType ==0 ) { | ||
298 | + ainvalid+=item.id + ','; | ||
299 | + ab = 1; | ||
300 | + } | ||
301 | + if (item.classType ==1 ) { | ||
302 | + binvalid+=item.id + ','; | ||
303 | + abc = 1; | ||
304 | + } | ||
305 | + }); | ||
330 | 306 | ||
331 | 307 | ||
308 | + if (ab == 0 && abc == 0 ) { | ||
309 | + t.my_warnning('没有需要清空的失效宝贝', 0, th); | ||
310 | + return false; | ||
311 | + } | ||
312 | + if (ab) { | ||
313 | + ainvalid = ainvalid.substring(0, ainvalid.length - 1); | ||
314 | + //要删除购物车中的商品 | ||
315 | + var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' + user_id + '/' + ainvalid; | ||
316 | + getApp().request.delete(url, { | ||
317 | + success: function (t) { | ||
318 | + th.getCardList(); | ||
319 | + getApp().requestCardNum(th); | ||
320 | + } | ||
321 | + }); | ||
322 | + } | ||
323 | + if (abc) { | ||
324 | + binvalid = binvalid.substring(0, binvalid.length - 1); | ||
325 | + //要删除购物车中的商品 | ||
326 | + var url = '/api/weshop/cartService/delIds/' + oo.stoid + '/' + user_id + '/' + binvalid; | ||
327 | + getApp().request.delete(url, { | ||
328 | + success: function (t) { | ||
329 | + th.getCardList(); | ||
330 | + getApp().requestCardNum(th); | ||
331 | + } | ||
332 | + }); | ||
333 | + } | ||
332 | }, | 334 | }, |
333 | 335 | ||
336 | + | ||
334 | //---------点击收藏------------ | 337 | //---------点击收藏------------ |
335 | collectGoods: async function () { | 338 | collectGoods: async function () { |
336 | 339 |
pages/cart/cart/cart.wxml
@@ -246,7 +246,7 @@ | @@ -246,7 +246,7 @@ | ||
246 | <view class="shmd fs30" >失效宝贝{{invalidList.length}}件</view> | 246 | <view class="shmd fs30" >失效宝贝{{invalidList.length}}件</view> |
247 | <view class="flex fs26 ctb"> | 247 | <view class="flex fs26 ctb"> |
248 | <view bindtap="collectGoods">移到收藏夹</view> | 248 | <view bindtap="collectGoods">移到收藏夹</view> |
249 | - <view class="mgl20" bindtap="delInva">清空失效宝贝</view> | 249 | + <view class="mgl20" bindtap="delInva_all">清空失效宝贝</view> |
250 | </view> | 250 | </view> |
251 | </view> | 251 | </view> |
252 | <view class="order-item" style="border: none;" data-item="{{idx}}" wx:for="{{invalidList}}" wx:for-item="items" wx:for-index="idx" wx:key="{{index}}"> | 252 | <view class="order-item" style="border: none;" data-item="{{idx}}" wx:for="{{invalidList}}" wx:for-item="items" wx:for-index="idx" wx:key="{{index}}"> |