From 7204b4edd136c311fb20636dea2c6a7ffdae0f76 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Fri, 28 May 2021 18:01:35 +0800 Subject: [PATCH] 不包邮的运算~~· --- pages/cart/cart2/cart2.js | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index deebde2..5517e31 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -1118,6 +1118,7 @@ Page({ } //如果有设置不包邮区商品 if(by_qc.goods_list!="" && by_qc.goods_list!=undefined && by_qc!=null && freight_free>0){ + freight_free=0; no_ex_good=by_qc.goods_list; } } @@ -1210,24 +1211,34 @@ Page({ continue; } + + var no_ex_good_arr=null; + if(no_ex_good) no_ex_good_arr=no_ex_good.split(','); + //----------------如果是选择了物流--------------------- - if(cart_item.exp_type == 0 && item[j].is_free_shipping==0){ - //如果地址不为空 - if (th.data.user_addr!=null){ - switch (item[j]['exp_sum_type']) { - case 1: - //统一运费 - o_shipping_price += item[j]['uniform_exp_sum'];break; - case 2: - if (goods_weight < 0) goods_weight = 0; - //累积商品重量 每种商品的重量 * 数量 - goods_weight += item[j]['weight'] * item[j]['goods_num']; break; - case 3: - if (goods_piece < 0) goods_piece = 0; - //累积商品数量 - goods_piece += item[j]['goods_num'];break; - } - } + if(cart_item.exp_type == 0 && item[j].is_free_shipping==0 && (!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id+'')>-1 )){ + + + //如果地址不为空 + if (th.data.user_addr!=null){ + switch (item[j]['exp_sum_type']) { + case 1: + //统一运费 + o_shipping_price += item[j]['uniform_exp_sum'];break; + case 2:+'' + if (goods_weight < 0) goods_weight = 0; + //累积商品重量 每种商品的重量 * 数量 + goods_weight += item[j]['weight'] * item[j]['goods_num']; + + break; + case 3: + if (goods_piece < 0) goods_piece = 0; + //累积商品数量 + goods_piece += item[j]['goods_num']; + break; + } + } + } } -- libgit2 0.21.4