Commit f9782f733e333052a5ff6b0b9e9d341dbebe532d
1 parent
ccea7b80
购物车商品清空优化
Showing
1 changed file
with
17 additions
and
7 deletions
pages/cart/cart/cart.js
| ... | ... | @@ -221,6 +221,7 @@ Page({ |
| 221 | 221 | state:0 |
| 222 | 222 | }, |
| 223 | 223 | success:async function(su) { |
| 224 | + console.log(su,10000); | |
| 224 | 225 | //按门店分类的数组 |
| 225 | 226 | var arr = new Array(), |
| 226 | 227 | carr = su.data.data.pageData; |
| ... | ... | @@ -387,9 +388,11 @@ Page({ |
| 387 | 388 | if(!th.data.zuhe_map[item.prom_id]){ |
| 388 | 389 | //如果有组合购 |
| 389 | 390 | var isok = 1; |
| 391 | + var is_flag=1; | |
| 390 | 392 | var act=null; |
| 391 | 393 | var url="/api/weshop/prom/zhbuy/get/"+os.stoid+"/"+item.prom_id+"/"+getApp().globalData.userInfo.user_id; |
| 392 | 394 | await getApp().request.promiseGet(url, {}).then(res => { |
| 395 | + console.log(res,1000); | |
| 393 | 396 | if(res.data.code==0 && res.data.data){ |
| 394 | 397 | if(res.data.data.is_show!=1){ |
| 395 | 398 | isok=0; |
| ... | ... | @@ -407,12 +410,11 @@ Page({ |
| 407 | 410 | isok=0; |
| 408 | 411 | } |
| 409 | 412 | act=res.data.data; |
| 410 | - | |
| 411 | - } | |
| 412 | - // else{ | |
| 413 | - // //未找到商品的活动 | |
| 414 | - // isok = 0; | |
| 415 | - // } | |
| 413 | + | |
| 414 | + }else{ | |
| 415 | + //未找到商品的活动 | |
| 416 | + is_flag = 0; | |
| 417 | + } | |
| 416 | 418 | }) |
| 417 | 419 | if (!isok){ |
| 418 | 420 | var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
| ... | ... | @@ -421,7 +423,6 @@ Page({ |
| 421 | 423 | continue; |
| 422 | 424 | } |
| 423 | 425 | th.data.zuhe_map[item.prom_id]=act; |
| 424 | - | |
| 425 | 426 | var url1 = "/api/weshop/prom/zhbuyGoods/page"; |
| 426 | 427 | var req_data = { |
| 427 | 428 | page: 1, |
| ... | ... | @@ -432,8 +433,17 @@ Page({ |
| 432 | 433 | await getApp().request.promiseGet(url1, { |
| 433 | 434 | data: req_data |
| 434 | 435 | }).then(res => { |
| 436 | + console.log(res,2000); | |
| 435 | 437 | if (ut.ajax_ok(res)) { |
| 436 | 438 | var gdlist = res.data.data.pageData; |
| 439 | + gdlist.forEach(i=>{ | |
| 440 | + if(item.goods_id==i.goods_id&&!is_flag){ | |
| 441 | + item.prom_type=0; | |
| 442 | + item.prom_type1=0; | |
| 443 | + item.prom_id=0; | |
| 444 | + item.prom_id1=0 | |
| 445 | + } | |
| 446 | + }) | |
| 437 | 447 | th.data.zuhe_map_good[item.prom_id]=gdlist; |
| 438 | 448 | } |
| 439 | 449 | }) | ... | ... |