Commit dd2f15e0c5652ddb47b71513560bdec81f0c87fe
1 parent
1fe94491
购物车添加多个商品的时候
Showing
1 changed file
with
15 additions
and
11 deletions
pages/cart/cart2/cart2.js
... | ... | @@ -471,23 +471,27 @@ Page({ |
471 | 471 | var ie = { |
472 | 472 | pickup_id: pcid, pname: pikname, goods: narr, wind: m_wind, distr_t: dis_t,card_cut_price:0,exp_type:e_t, |
473 | 473 | goods_price: 0, shipping_price: 0, user_money: 0, total_amount: 0, order_amount: 0, user_note:0}; |
474 | - | |
475 | - //-- 如果是回退回来的情况 -- | |
476 | - if(th.data.cartlist && th.data.cartlist.length>0) { | |
477 | - for(var kj in th.data.cartlist){ | |
478 | - if(ie.pickup_id==th.data.cartlist[kj].pickup_id){ | |
479 | - ie.exp_type=th.data.cartlist[kj].exp_type; | |
480 | - break; | |
481 | - } | |
482 | - } | |
483 | - } | |
484 | - | |
474 | + | |
485 | 475 | //-- 把等级卡会优惠多少钱装进去 -- |
486 | 476 | if(item.cut_price1) ie.card_cut_price+=item.cut_price1; |
487 | 477 | arr.push(ie); |
488 | 478 | |
489 | 479 | } |
490 | 480 | } |
481 | + | |
482 | + //-- 如果是回退回来的情况 -- | |
483 | + if(th.data.cartlist && th.data.cartlist.length>0) { | |
484 | + for(var kj in th.data.cartlist){ | |
485 | + for(var ih in arr){ | |
486 | + var ie=arr[ih]; | |
487 | + if(ie.pickup_id==th.data.cartlist[kj].pickup_id){ | |
488 | + ie.exp_type=parseInt(th.data.cartlist[kj].exp_type); | |
489 | + break; | |
490 | + } | |
491 | + } | |
492 | + } | |
493 | + } | |
494 | + | |
491 | 495 | //深拷贝 |
492 | 496 | th.data.old_cartlist= JSON.parse(JSON.stringify(arr)); |
493 | 497 | th.setData({ | ... | ... |