Commit 16fb08f88a775354f42b7eba7fd07c8f7c143388
1 parent
39f61005
包邮券的优化,多个商品商品不不包邮的情况bug修复
Showing
1 changed file
with
16 additions
and
10 deletions
pages/cart/cart2/cart2.js
... | ... | @@ -507,15 +507,15 @@ Page({ |
507 | 507 | //--有不包邮区域,且不免运费,全场的计算-- |
508 | 508 | if(no_ex_id && freight_free>0 && o_price>freight_free && c_arr[i].exp_type == 0 && (by_qc.region_list || by_qc.goods_list) ){ |
509 | 509 | //如果有设置不包邮区域的时候 |
510 | - if(by_qc.region_list){ | |
510 | + if(by_qc.region_list!="" && by_qc.region_list!=null && by_qc.region_list!=undefined ){ | |
511 | 511 | if(th.check_by_area(by_qc.region_list)){ |
512 | 512 | freight_free=0; |
513 | 513 | th.data.is_no_by[pickid]=1; |
514 | 514 | } |
515 | 515 | } |
516 | 516 | //如果有设置不包邮区商品 |
517 | - if(by_qc.goods_list && freight_free){ | |
518 | - no_ex_good=res.data.data.goods_list; | |
517 | + if(by_qc.goods_list!="" && by_qc.goods_list!=undefined && by_qc!=null && freight_free>0){ | |
518 | + no_ex_good=by_qc.goods_list; | |
519 | 519 | } |
520 | 520 | } |
521 | 521 | |
... | ... | @@ -525,7 +525,7 @@ Page({ |
525 | 525 | if(!th.data.isget_by_quan[pickid]){ |
526 | 526 | //--判断要不要显示包邮券,链式调用接口--- |
527 | 527 | getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea",{ |
528 | - data:{store_id:os.stoid,isuse:0,condition:o_price,user_id:getApp().globalData.user_id} | |
528 | + data:{store_id:os.stoid,isuse:0,condition:o_price,user_id:getApp().globalData.user_id,pageSize:2000} | |
529 | 529 | }).then(res=>{ |
530 | 530 | if(res.data.code==0 && res.data.data.total>0){ |
531 | 531 | //此时要循环判断包邮的地区,不包邮商品是不是符合 |
... | ... | @@ -571,6 +571,8 @@ Page({ |
571 | 571 | var arr2=quan.goods_list.split(","); |
572 | 572 | if(ut.isContained(arr,arr2)){ |
573 | 573 | getApp().my_warnning("全场不包邮商品和包邮券的重复",0,th); |
574 | + th.data.using_quan[pickid]={}; | |
575 | + th.setData({using_quan:th.data.using_quan}) | |
574 | 576 | return false; |
575 | 577 | } |
576 | 578 | var n_arr=ut.mergeArray(arr,arr2); |
... | ... | @@ -621,10 +623,11 @@ Page({ |
621 | 623 | |
622 | 624 | //计算物流价格 |
623 | 625 | if (c_arr[i].exp_type == 0) { |
626 | + freight_free=0; //后面不在进行判断 | |
624 | 627 | var code = th.data.wu_arr[c_arr[i].wind].code; |
625 | 628 | th.data.cartlist[i].shipping_price = |
626 | 629 | th.calculatewuliu(code, o_shipping_price, goods_weight, |
627 | - goods_piece,th.data.user_addr, freight_free, o_price, rs); | |
630 | + goods_piece,th.data.user_addr, freight_free, o_price, rs,); | |
628 | 631 | |
629 | 632 | if(!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby!=1){ |
630 | 633 | if( th.data.cartlist[i].shipping_price ==0) th.data.is_by[pickid]=0; //已经全场包邮,就不要选择券了 |
... | ... | @@ -758,7 +761,7 @@ Page({ |
758 | 761 | if(!th.data.isget_by_quan[th.data.bn_pick]){ |
759 | 762 | //--判断要不要显示包邮券,链式调用接口--- |
760 | 763 | getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea",{ |
761 | - data:{store_id:os.stoid,isuse:0,condition:allpice,user_id:getApp().globalData.user_id} | |
764 | + data:{store_id:os.stoid,isuse:0,condition:allpice,user_id:getApp().globalData.user_id,pageSize:2000} | |
762 | 765 | }).then(res=>{ |
763 | 766 | if(res.data.code==0 && res.data.data.total>0){ |
764 | 767 | //此时要循环判断包邮的地区,不包邮商品是不是符合 |
... | ... | @@ -1293,11 +1296,14 @@ Page({ |
1293 | 1296 | } |
1294 | 1297 | |
1295 | 1298 | th.setData({ is_all_zt: iszt }); |
1296 | - | |
1297 | - | |
1298 | 1299 | |
1299 | - if(th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby==1){ | |
1300 | - th.setData({using_quan:{}}); | |
1300 | + var ind=t.currentTarget.dataset.ind; | |
1301 | + var c_item=th.data.cartlist[ind]; | |
1302 | + var pickid=c_item.pickup_id; | |
1303 | + | |
1304 | + if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby==1){ | |
1305 | + th.data.using_quan[pickid]={}; | |
1306 | + th.setData({using_quan:th.data.using_quan}); | |
1301 | 1307 | } |
1302 | 1308 | |
1303 | 1309 | ... | ... |