From c584cb08033e0c6bb2f5216b8c25ba41280622a5 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Fri, 7 Jul 2023 23:09:10 +0800 Subject: [PATCH] 包邮券的使用 --- packageE/pages/cart/cart2/cart2.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index 45addc6..1724fec 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -3021,7 +3021,6 @@ Page({ //--------循环计算总价----------- for (var j = 0; j < item.length; j++) { - //如果是一件代发商品,不计算运费 if (item[j].whsle_id) continue; //如果商品本身是包邮了 @@ -3033,9 +3032,9 @@ Page({ continue; } - + //-- 如果有达到包邮条件,同时判断商品有没有在不包邮商品里面 -- if (back_data && back_data['is_by_all'] && item[j].is_post_temp - && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) { + && (!back_data.no_free_goods || !th.ck_no_goods_arr(back_data.no_free_goods,item[j].goods_id))) { if (item[j]['exp_sum_type'] == 2 && back_data.weight_free > 0) { if (goods_weight < 0) goods_weight = 0; @@ -3161,7 +3160,6 @@ Page({ var order_m = 0; - //么有使用券,或者活动没有限制使用优惠券 if (ord_prom && (quan_price <= 0 || !ord_prom.is_xz_yh)) { order_prom_id = ord_prom['id']; @@ -3515,6 +3513,18 @@ Page({ } }, + //-- 判断商品是不是在不包邮商品里面 -- + ck_no_goods_arr(no_free_goods,goods_id){ + for (var j = 0; j < no_free_goods.length; j++) { + var ck_gd_id= parseInt(no_free_goods[j]+''); + var goods_id= parseInt(goods_id+''); + if(ck_gd_id==goods_id){ + return true; + } + } + return false; + }, + //---------计算立即购买---------- calculatePrice2: async function (qfunc) { var th = this, good = this.data.bn_goods; @@ -3721,7 +3731,7 @@ Page({ //-- 代发商品不算运费 -- if (good.whsle_id) continue; - if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || !th.ck_no_goods_arr(back_data.no_free_goods,item.goods_id))) { if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { if (goods_weight < 0) goods_weight = 0; @@ -3825,6 +3835,7 @@ Page({ th.setData({ [wl_txt]: 0, }) } } + //-----------------支付价,优惠券不减物流----------------- var total_m = (parseFloat(allpice1)).toFixed(2); var order_m = (parseFloat(allpice - cut_price) - quan_price).toFixed(2); -- libgit2 0.21.4