From b39365c7c39820c8e4d22ae063fb3e8e4637e207 Mon Sep 17 00:00:00 2001 From: abson Date: Thu, 13 Jan 2022 17:15:20 +0800 Subject: [PATCH] 积分购 物流超重优化 --- packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js | 37 +++++++++++++++++++++---------------- packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js | 21 +++++++++++++++++++-- packageC/pages/presell/cart/cart.js | 4 ++-- packageC/pages/presell/cart/cart2.js | 4 ++-- packageC/pages/presell/cart/cart2_pre.js | 4 ++-- pages/cart/cart2/cart2.js | 4 ++-- pages/cart/cart2/zh_calculate.js | 1 - pages/cart/cart2_inte/cart2_inte.js | 8 ++++---- pages/cart/cart2_pt/cart2_pt.js | 6 +++--- pages/cart/cart_wk/cart_wk.js | 6 +++--- 10 files changed, 58 insertions(+), 37 deletions(-) diff --git a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js index efeb85c..a3b8843 100644 --- a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js +++ b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js @@ -1374,13 +1374,11 @@ Page({ o_price += item[j].goods_price * item[j].goods_num; //判断是否有设置限制重量包邮 - if(weight_free){ - if( item[j]['exp_sum_type']==2 ){ - if (goods_weight < 0) goods_weight = 0; - //累积商品重量 每种商品的重量 * 数量 - goods_weight += item[j]['weight'] * item[j]['goods_num']; - out_of_weight = (weight_free*1000) - goods_weight; - } + if(item[j]['is_past']!==1 && item[j]['exp_sum_type']==2 && weight_free>0){ + if (goods_weight < 0) goods_weight = 0; + //累积商品重量 每种商品的重量 * 数量 + goods_weight += item[j]['weight'] * item[j]['goods_num']; + out_of_weight = (weight_free*1000) - goods_weight; } } //判断是不是有组合购的金额 @@ -1560,9 +1558,11 @@ Page({ } }else{ - if(goods_weight && out_of_weight !== 0){ - goods_weight=-1; - out_of_weight=0; + if(item[j]['exp_sum_type']==2){ + if(out_of_weight !==0){ + goods_weight=-1; + out_of_weight=0; + } } } } @@ -1866,7 +1866,9 @@ Page({ if (goods_weight < 0) goods_weight = 0; //累积商品重量 每种商品的重量 * 数量 goods_weight += good['weight'] * good['buynum']; - out_of_weight = (weight_free * 1000 ) - goods_weight; + if(weight_free > 0){ + out_of_weight = (weight_free * 1000 ) - goods_weight; + } break; case 3: if (goods_piece < 0) goods_piece = 0; @@ -2863,7 +2865,7 @@ Page({ var price = 0, th = this; price += parseFloat(o_shipping_price); //如果是包邮 - if (freight_free > 0 && o_price >= freight_free && out_of_weight > 0) { + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; } if (user_addr == null) { @@ -2881,7 +2883,7 @@ Page({ item = item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight >= 0 && item['money'] && out_of_weight > 0) { + if (goods_weight >= 0 && item['money']) { fw_price = parseFloat(item['money']); if (goods_weight > item['first_weight']) { var fw = goods_weight - item['first_weight']; @@ -2890,11 +2892,14 @@ Page({ } } //------超出重量---------- - if(out_of_weight < 0){ + if(out_of_weight < 0 && o_price >= freight_free){ fw_price = parseFloat(item['money']); var out_of_weight = Math.abs(out_of_weight); - var n = Math.ceil(out_of_weight / item['second_weight']) - fw_price = fw_price + n * parseFloat(item['add_money']); + if (out_of_weight > item['first_weight']) { + var fw = out_of_weight - item['first_weight']; + var n = Math.ceil(fw / item['second_weight']) + fw_price = fw_price + n * parseFloat(item['add_money']); + } } //------按件数---------- if (goods_piece > 0 && item['piecemoney']) { diff --git a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js index 79d7362..e4222b5 100644 --- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js +++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js @@ -513,6 +513,10 @@ Page({ var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; + var out_of_weight=null; //超出多少重量 + var freight_free = ee.freight_free; //全场满多少包邮 + var weight_free = ee.weight_free; //多少kg内包邮 + var no_ex_id = ee.no_ex_id; //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) { @@ -525,6 +529,9 @@ Page({ if (goods_weight < 0) goods_weight = 0; //累积商品重量 每种商品的重量 * 数量 goods_weight += good['weight'] * good['buynum']; + if(weight_free > 0){ + out_of_weight = (weight_free * 1000 ) - goods_weight; + } break; case 3: if (goods_piece < 0) goods_piece = 0; @@ -1042,7 +1049,7 @@ Page({ th = this; price += parseFloat(o_shipping_price); //如果是包邮 - if (freight_free > 0 && o_price >= freight_free) { + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; } if (user_addr == null) { @@ -1061,7 +1068,7 @@ Page({ item = item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight > 0) { + if (goods_weight > 0 && item['money']) { fw_price = parseFloat(item['money']); if (goods_weight > item['first_weight']) { var fw = goods_weight - item['first_weight']; @@ -1069,6 +1076,16 @@ Page({ fw_price = fw_price + n * parseFloat(item['add_money']); } } + //------超出重量---------- + if(out_of_weight < 0 && o_price >= freight_free){ + fw_price = parseFloat(item['money']); + var out_of_weight = Math.abs(out_of_weight); + if (out_of_weight > item['first_weight']) { + var fw = out_of_weight - item['first_weight']; + var n = Math.ceil(fw / item['second_weight']) + fw_price = fw_price + n * parseFloat(item['add_money']); + } + } //------按件数---------- if (goods_piece > 0) { fp_price = parseFloat(item['piecemoney']); diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js index 38be4f7..2703208 100644 --- a/packageC/pages/presell/cart/cart.js +++ b/packageC/pages/presell/cart/cart.js @@ -875,7 +875,7 @@ Page({ item = item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) { + if (goods_weight >= 0 && item['money']) { fw_price = parseFloat(item['money']); if (goods_weight > item['first_weight']) { var fw = goods_weight - item['first_weight']; @@ -884,7 +884,7 @@ Page({ } } //------超出重量---------- - if(out_of_weight < 0){ + if(out_of_weight < 0 && o_price >= freight_free){ fw_price = parseFloat(item['money']); var out_of_weight = Math.abs(out_of_weight); if (out_of_weight > item['first_weight']) { diff --git a/packageC/pages/presell/cart/cart2.js b/packageC/pages/presell/cart/cart2.js index 68ce70d..9cc7c3b 100644 --- a/packageC/pages/presell/cart/cart2.js +++ b/packageC/pages/presell/cart/cart2.js @@ -1693,7 +1693,7 @@ Page({ item = item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) { + if (goods_weight >= 0 && item['money']) { fw_price = parseFloat(item['money']); if (goods_weight > item['first_weight']) { var fw = goods_weight - item['first_weight']; @@ -1703,7 +1703,7 @@ Page({ } //------超出重量---------- - if(out_of_weight < 0){ + if(out_of_weight < 0 && o_price >= freight_free){ fw_price = parseFloat(item['money']); var out_of_weight = Math.abs(out_of_weight); var n = Math.ceil(out_of_weight / item['second_weight']) diff --git a/packageC/pages/presell/cart/cart2_pre.js b/packageC/pages/presell/cart/cart2_pre.js index 249683d..cbf65f4 100644 --- a/packageC/pages/presell/cart/cart2_pre.js +++ b/packageC/pages/presell/cart/cart2_pre.js @@ -727,7 +727,7 @@ Page({ item=item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) { + if (goods_weight >= 0 && item['money']) { fw_price =parseFloat(item['money']); if (goods_weight > item['first_weight']){ var fw = goods_weight - item['first_weight']; @@ -736,7 +736,7 @@ Page({ } } //------超出重量---------- - if(out_of_weight < 0){ + if(out_of_weight < 0 && o_price >= freight_free){ fw_price = parseFloat(item['money']); var out_of_weight = Math.abs(out_of_weight); if (out_of_weight > item['first_weight']) { diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 28293a9..8e80c81 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -3057,7 +3057,7 @@ Page({ item = item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) { + if (goods_weight >= 0 && item['money']) { fw_price = parseFloat(item['money']); if (goods_weight > item['first_weight']) { var fw = goods_weight - item['first_weight']; @@ -3066,7 +3066,7 @@ Page({ } } //------超出重量---------- - if(out_of_weight < 0){ + if(out_of_weight < 0 && o_price >= freight_free){ fw_price = parseFloat(item['money']); var out_of_weight = Math.abs(out_of_weight); if (out_of_weight > item['first_weight']) { diff --git a/pages/cart/cart2/zh_calculate.js b/pages/cart/cart2/zh_calculate.js index 149d638..a1c204e 100644 --- a/pages/cart/cart2/zh_calculate.js +++ b/pages/cart/cart2/zh_calculate.js @@ -153,7 +153,6 @@ module.exports = { if (zhqty_bz.length > 1) { let zhqty_bz_arr = []; let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr); - if (zhqty_bz_flag) { for (let i = 0; i < zhqty_bz.length; i++) { var vv = zhqty_bz[i]; diff --git a/pages/cart/cart2_inte/cart2_inte.js b/pages/cart/cart2_inte/cart2_inte.js index d5358b2..140cdb9 100644 --- a/pages/cart/cart2_inte/cart2_inte.js +++ b/pages/cart/cart2_inte/cart2_inte.js @@ -502,7 +502,7 @@ Page({ th.data.is_by[th.data.bn_pick]=0; //--------------开始计算物流------------------ var shipping_price= - th.calculatewuliu(code, o_shipping_price, goods_weight, + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, goods_piece, th.data.user_addr, freight_free, allpice-cut_price, rs); if(shipping_price<=0){ th.data.is_by[th.data.bn_pick]=1; //已经是包邮了,就不要选择包邮券 @@ -925,7 +925,7 @@ Page({ th.calculatePrice(); }, //-------------------计算物流--------------- - calculatewuliu:function(code, o_shipping_price, goods_weight, + calculatewuliu:function(code, o_shipping_price, goods_weight,out_of_weight, goods_piece,user_addr, freight_free, o_price, rs){ var price =0,th=this; price +=parseFloat(o_shipping_price); @@ -944,7 +944,7 @@ Page({ item=item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) { + if (goods_weight >= 0 && item['money']) { fw_price =parseFloat(item['money']); if (goods_weight > item['first_weight']){ var fw = goods_weight - item['first_weight']; @@ -953,7 +953,7 @@ Page({ } } //------超出重量---------- - if(out_of_weight < 0){ + if(out_of_weight < 0 && o_price >= freight_free){ fw_price = parseFloat(item['money']); var out_of_weight = Math.abs(out_of_weight); if (out_of_weight > item['first_weight']) { diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js index f80416d..f12ecca 100644 --- a/pages/cart/cart2_pt/cart2_pt.js +++ b/pages/cart/cart2_pt/cart2_pt.js @@ -800,7 +800,7 @@ Page({ item=item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) { + if (goods_weight >= 0 && item['money']) { fw_price =parseFloat(item['money']); if (goods_weight > item['first_weight']){ var fw = goods_weight - item['first_weight']; @@ -809,7 +809,7 @@ Page({ } } //------超出重量---------- - if(out_of_weight < 0){ + if(out_of_weight < 0 && o_price >= freight_free){ fw_price = parseFloat(item['money']); var out_of_weight = Math.abs(out_of_weight); if (out_of_weight > item['first_weight']) { @@ -819,7 +819,7 @@ Page({ } } //------按件数---------- - if (goods_piece > 0) { + if (goods_piece > 0 ) { fp_price = parseFloat(item['piecemoney']); if (goods_piece > item['first_piece']) { var fp = goods_piece - item['first_piece']; diff --git a/pages/cart/cart_wk/cart_wk.js b/pages/cart/cart_wk/cart_wk.js index b34316d..0ff9d42 100644 --- a/pages/cart/cart_wk/cart_wk.js +++ b/pages/cart/cart_wk/cart_wk.js @@ -420,7 +420,7 @@ Page({ var to = getApp(), th = this; to.getConfig2(function (ee) { to.getwuliuprice(function (rs) { - var o_shipping_price = 0,goods_weight = -1,goods_piece = -1; + var o_shipping_price = 0,goods_weight = -1,goods_piece = -1,good=th.data.goods; var out_of_weight=null; //超出多少重量 var freight_free = ee.freight_free; //全场满多少包邮 var weight_free = ee.weight_free; //多少kg内包邮 @@ -486,7 +486,7 @@ Page({ item = item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) { + if (goods_weight >= 0 && item['money']) { fw_price = parseFloat(item['money']); if (goods_weight > item['first_weight']) { var fw = goods_weight - item['first_weight']; @@ -495,7 +495,7 @@ Page({ } } //------超出重量---------- - if(out_of_weight < 0){ + if(out_of_weight < 0 && o_price >= freight_free){ fw_price = parseFloat(item['money']); var out_of_weight = Math.abs(out_of_weight); if (out_of_weight > item['first_weight']) { -- libgit2 0.21.4