Commit b29b5dd8c6148728369853717228408f75de8330
1 parent
57973d9d
物流
Showing
7 changed files
with
126 additions
and
48 deletions
packageC/pages/presell/cart/cart.js
| ... | ... | @@ -852,12 +852,12 @@ Page({ |
| 852 | 852 | th.calculatePrice2(); |
| 853 | 853 | }, |
| 854 | 854 | //-------------------计算物流--------------- |
| 855 | - calculatewuliu: function (code, o_shipping_price, goods_weight, | |
| 855 | + calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight, | |
| 856 | 856 | goods_piece, user_addr, freight_free, o_price, rs) { |
| 857 | 857 | var price = 0, th = this; |
| 858 | 858 | price += parseFloat(o_shipping_price); |
| 859 | 859 | //如果是包邮 |
| 860 | - if (freight_free > 0 && o_price >= freight_free) { | |
| 860 | + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0) { | |
| 861 | 861 | return 0; |
| 862 | 862 | } |
| 863 | 863 | if (user_addr == null) { |
| ... | ... | @@ -875,7 +875,7 @@ Page({ |
| 875 | 875 | item = item.config; |
| 876 | 876 | if (item == null) return o_shipping_price; |
| 877 | 877 | //------按重量---------- |
| 878 | - if (goods_weight >= 0 && item['money']) { | |
| 878 | + if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) { | |
| 879 | 879 | fw_price = parseFloat(item['money']); |
| 880 | 880 | if (goods_weight > item['first_weight']) { |
| 881 | 881 | var fw = goods_weight - item['first_weight']; |
| ... | ... | @@ -883,6 +883,16 @@ Page({ |
| 883 | 883 | fw_price = fw_price + n * parseFloat(item['add_money']); |
| 884 | 884 | } |
| 885 | 885 | } |
| 886 | + //------超出重量---------- | |
| 887 | + if(out_of_weight < 0){ | |
| 888 | + fw_price = parseFloat(item['money']); | |
| 889 | + var out_of_weight = Math.abs(out_of_weight); | |
| 890 | + if (out_of_weight > item['first_weight']) { | |
| 891 | + var fw = out_of_weight - item['first_weight']; | |
| 892 | + var n = Math.ceil(fw / item['second_weight']) | |
| 893 | + fw_price = fw_price + n * parseFloat(item['add_money']); | |
| 894 | + } | |
| 895 | + } | |
| 886 | 896 | //------按件数---------- |
| 887 | 897 | if (goods_piece > 0 && item['piecemoney']) { |
| 888 | 898 | fp_price = parseFloat(item['piecemoney']); |
| ... | ... | @@ -1713,6 +1723,9 @@ Page({ |
| 1713 | 1723 | var quan_no = null; |
| 1714 | 1724 | var bn_pick=th.data.pickup.pickup_id; |
| 1715 | 1725 | var allpice =th.data.all_price; |
| 1726 | + var out_of_weight=null; //超出多少重量 | |
| 1727 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
| 1728 | + var weight_free = ee.weight_free; //多少kg内包邮 | |
| 1716 | 1729 | |
| 1717 | 1730 | if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) |
| 1718 | 1731 | quan_no = th.data.using_quan[bn_pick].coupon_no; |
| ... | ... | @@ -1793,6 +1806,9 @@ Page({ |
| 1793 | 1806 | if (goods_weight < 0) goods_weight = 0; |
| 1794 | 1807 | //累积商品重量 每种商品的重量 * 数量 |
| 1795 | 1808 | goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; |
| 1809 | + if(weight_free > 0){ | |
| 1810 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
| 1811 | + } | |
| 1796 | 1812 | break; |
| 1797 | 1813 | case 3: |
| 1798 | 1814 | if (goods_piece < 0) goods_piece = 0; |
| ... | ... | @@ -1802,7 +1818,6 @@ Page({ |
| 1802 | 1818 | } |
| 1803 | 1819 | |
| 1804 | 1820 | var code = th.data.wu_arr[th.data.index].code; |
| 1805 | - var freight_free = ee.freight_free; //全场满多少包邮 | |
| 1806 | 1821 | var shipping_price = |
| 1807 | 1822 | th.calculatewuliu(code, o_shipping_price, goods_weight, |
| 1808 | 1823 | goods_piece, th.data.user_addr, freight_free, allpice, rs); | ... | ... |
packageC/pages/presell/cart/cart2.js
| ... | ... | @@ -734,7 +734,7 @@ Page({ |
| 734 | 734 | |
| 735 | 735 | //如果有赠品的时候,也要计算赠品的物流费用 |
| 736 | 736 | if (th.data.buy_now_gift_goods) { |
| 737 | - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,gift_weight_free, | |
| 737 | + shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,out_of_weight,gift_weight_free, | |
| 738 | 738 | parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); |
| 739 | 739 | } |
| 740 | 740 | |
| ... | ... | @@ -2540,7 +2540,7 @@ Page({ |
| 2540 | 2540 | }, |
| 2541 | 2541 | |
| 2542 | 2542 | //计算立即购买赠品的物流费用 |
| 2543 | - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { | |
| 2543 | + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free,out_of_weight,allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { | |
| 2544 | 2544 | var good = this.data.buy_now_gift_goods; |
| 2545 | 2545 | var goods_weight = -1, goods_piece = -1; |
| 2546 | 2546 | var gift_shipping_price = 0; |
| ... | ... | @@ -2556,8 +2556,9 @@ Page({ |
| 2556 | 2556 | //累积商品重量 每种商品的重量 * 数量 |
| 2557 | 2557 | goods_weight += good['weight'] * good['buynum']; |
| 2558 | 2558 | if (goods_weight1 > 0) { |
| 2559 | + out_of_weight = gift_weight_free - goods_weight; | |
| 2560 | + //不能调换位置 下面goods_weight会变大 | |
| 2559 | 2561 | goods_weight += goods_weight1; |
| 2560 | - out_of_weight = (gift_weight_free*1000) - goods_weight; | |
| 2561 | 2562 | } |
| 2562 | 2563 | break; |
| 2563 | 2564 | case 3: | ... | ... |
packageC/pages/presell/cart/cart2_pre.js
| ... | ... | @@ -342,7 +342,11 @@ Page({ |
| 342 | 342 | |
| 343 | 343 | app.getConfig2(function (ee) { |
| 344 | 344 | app.getwuliuprice(function (rs) { |
| 345 | - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | |
| 345 | + var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | |
| 346 | + var out_of_weight=null; //超出多少重量 | |
| 347 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
| 348 | + var weight_free = ee.weight_free; //多少kg内包邮 | |
| 349 | + var no_ex_id = ee.no_ex_id; | |
| 346 | 350 | //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- |
| 347 | 351 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 |
| 348 | 352 | && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){ |
| ... | ... | @@ -353,7 +357,11 @@ Page({ |
| 353 | 357 | case 2: |
| 354 | 358 | if (goods_weight < 0) goods_weight = 0; |
| 355 | 359 | //累积商品重量 每种商品的重量 * 数量 |
| 356 | - goods_weight += good['weight'] * good['buynum'];break; | |
| 360 | + goods_weight += good['weight'] * good['buynum']; | |
| 361 | + if(weight_free > 0){ | |
| 362 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
| 363 | + } | |
| 364 | + break; | |
| 357 | 365 | case 3: |
| 358 | 366 | if (goods_piece < 0) goods_piece = 0; |
| 359 | 367 | //累积商品数量 |
| ... | ... | @@ -361,9 +369,8 @@ Page({ |
| 361 | 369 | } |
| 362 | 370 | |
| 363 | 371 | var code = th.data.wu_arr[th.data.index].code; |
| 364 | - var freight_free = ee.freight_free; //全场满多少包邮 | |
| 365 | 372 | var shipping_price= |
| 366 | - th.calculatewuliu(code, o_shipping_price, goods_weight, | |
| 373 | + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, | |
| 367 | 374 | goods_piece, th.data.user_addr, freight_free, allpice, rs); |
| 368 | 375 | |
| 369 | 376 | shipping_price = parseFloat(shipping_price).toFixed(2); |
| ... | ... | @@ -701,12 +708,12 @@ Page({ |
| 701 | 708 | }, |
| 702 | 709 | |
| 703 | 710 | //-------------------计算物流--------------- |
| 704 | - calculatewuliu:function(code, o_shipping_price, goods_weight, | |
| 711 | + calculatewuliu:function(code, o_shipping_price, goods_weight,out_of_weight, | |
| 705 | 712 | goods_piece,user_addr, freight_free, o_price, rs){ |
| 706 | 713 | var price =0,th=this; |
| 707 | 714 | price +=parseFloat(o_shipping_price); |
| 708 | 715 | //如果是包邮 |
| 709 | - if (freight_free > 0 && o_price >= freight_free){ return 0;} | |
| 716 | + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0){ return 0;} | |
| 710 | 717 | if (user_addr==null) { return 0; } |
| 711 | 718 | //计算物流的config item; |
| 712 | 719 | var item=null; |
| ... | ... | @@ -720,7 +727,7 @@ Page({ |
| 720 | 727 | item=item.config; |
| 721 | 728 | if (item == null) return o_shipping_price; |
| 722 | 729 | //------按重量---------- |
| 723 | - if (goods_weight>0) { | |
| 730 | + if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) { | |
| 724 | 731 | fw_price =parseFloat(item['money']); |
| 725 | 732 | if (goods_weight > item['first_weight']){ |
| 726 | 733 | var fw = goods_weight - item['first_weight']; |
| ... | ... | @@ -728,6 +735,16 @@ Page({ |
| 728 | 735 | fw_price = fw_price + n * parseFloat(item['add_money']); |
| 729 | 736 | } |
| 730 | 737 | } |
| 738 | + //------超出重量---------- | |
| 739 | + if(out_of_weight < 0){ | |
| 740 | + fw_price = parseFloat(item['money']); | |
| 741 | + var out_of_weight = Math.abs(out_of_weight); | |
| 742 | + if (out_of_weight > item['first_weight']) { | |
| 743 | + var fw = out_of_weight - item['first_weight']; | |
| 744 | + var n = Math.ceil(fw / item['second_weight']) | |
| 745 | + fw_price = fw_price + n * parseFloat(item['add_money']); | |
| 746 | + } | |
| 747 | + } | |
| 731 | 748 | //------按件数---------- |
| 732 | 749 | if (goods_piece > 0) { |
| 733 | 750 | fp_price = parseFloat(item['piecemoney']); | ... | ... |
pages/cart/cart2/cart2.js
| ... | ... | @@ -1484,13 +1484,11 @@ Page({ |
| 1484 | 1484 | o_price += item[j].goods_price * item[j].goods_num; |
| 1485 | 1485 | |
| 1486 | 1486 | //判断是否有设置限制重量包邮,先看商品有没有包邮 |
| 1487 | - if(item[j]['is_past']!==1 && weight_free){ | |
| 1488 | - if( item[j]['exp_sum_type']==2 ){ | |
| 1489 | - if (goods_weight < 0) goods_weight = 0; | |
| 1490 | - //累积商品重量 每种商品的重量 * 数量 | |
| 1491 | - goods_weight += item[j]['weight'] * item[j]['goods_num']; | |
| 1492 | - out_of_weight = (weight_free*1000) - goods_weight; | |
| 1493 | - } | |
| 1487 | + if(item[j]['is_past']!==1 && item[j]['exp_sum_type']==2 && weight_free>0){ | |
| 1488 | + if (goods_weight < 0) goods_weight = 0; | |
| 1489 | + //累积商品重量 每种商品的重量 * 数量 | |
| 1490 | + goods_weight += item[j]['weight'] * item[j]['goods_num']; | |
| 1491 | + out_of_weight = (weight_free*1000) - goods_weight; | |
| 1494 | 1492 | } |
| 1495 | 1493 | } |
| 1496 | 1494 | //判断是不是有组合购的金额 |
| ... | ... | @@ -1666,7 +1664,7 @@ Page({ |
| 1666 | 1664 | o_shipping_price += item[j]['uniform_exp_sum']; |
| 1667 | 1665 | break; |
| 1668 | 1666 | // case 2: //1464行已计算 不必重复计算 注释为:判断是否有设置限制重量包邮 |
| 1669 | - // +'' | |
| 1667 | + // +'' | |
| 1670 | 1668 | // if (goods_weight < 0) goods_weight = 0; |
| 1671 | 1669 | // //累积商品重量 每种商品的重量 * 数量 |
| 1672 | 1670 | // goods_weight += item[j]['weight'] * item[j]['goods_num']; |
| ... | ... | @@ -1679,12 +1677,14 @@ Page({ |
| 1679 | 1677 | break; |
| 1680 | 1678 | } |
| 1681 | 1679 | } |
| 1682 | - | |
| 1683 | 1680 | }else{ |
| 1684 | - if(goods_weight && out_of_weight !==0){ | |
| 1685 | - goods_weight=-1; | |
| 1686 | - out_of_weight=0; | |
| 1681 | + if(item[j]['exp_sum_type']==2){ | |
| 1682 | + if(out_of_weight !==0){ | |
| 1683 | + goods_weight=-1; | |
| 1684 | + out_of_weight=0; | |
| 1685 | + } | |
| 1687 | 1686 | } |
| 1687 | + | |
| 1688 | 1688 | } |
| 1689 | 1689 | } |
| 1690 | 1690 | |
| ... | ... | @@ -1999,7 +1999,9 @@ Page({ |
| 1999 | 1999 | //dw |
| 2000 | 2000 | //累积商品重量 每种商品的重量 * 数量 |
| 2001 | 2001 | goods_weight += good['weight'] * good['buynum']; |
| 2002 | - out_of_weight = (weight_free * 1000 ) - goods_weight; | |
| 2002 | + if(weight_free > 0){ | |
| 2003 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
| 2004 | + } | |
| 2003 | 2005 | break; |
| 2004 | 2006 | case 3: |
| 2005 | 2007 | if (goods_piece < 0) goods_piece = 0; |
| ... | ... | @@ -3067,8 +3069,6 @@ Page({ |
| 3067 | 3069 | if(out_of_weight < 0){ |
| 3068 | 3070 | fw_price = parseFloat(item['money']); |
| 3069 | 3071 | var out_of_weight = Math.abs(out_of_weight); |
| 3070 | - // var n = Math.ceil(out_of_weight / item['second_weight']) | |
| 3071 | - // fw_price = fw_price + n * parseFloat(item['add_money']); | |
| 3072 | 3072 | if (out_of_weight > item['first_weight']) { |
| 3073 | 3073 | var fw = out_of_weight - item['first_weight']; |
| 3074 | 3074 | var n = Math.ceil(fw / item['second_weight']) |
| ... | ... | @@ -3985,7 +3985,7 @@ Page({ |
| 3985 | 3985 | }, |
| 3986 | 3986 | |
| 3987 | 3987 | //计算立即购买赠品的物流费用 |
| 3988 | - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { | |
| 3988 | + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,out_of_weight, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { | |
| 3989 | 3989 | var good = this.data.buy_now_gift_goods; |
| 3990 | 3990 | var goods_weight = -1, goods_piece = -1; |
| 3991 | 3991 | var gift_shipping_price = 0; | ... | ... |
pages/cart/cart2_inte/cart2_inte.js
| ... | ... | @@ -442,6 +442,9 @@ Page({ |
| 442 | 442 | to.getwuliuprice(async function (rs) { |
| 443 | 443 | |
| 444 | 444 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
| 445 | + var out_of_weight=null; //超出多少重量 | |
| 446 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
| 447 | + var weight_free = ee.weight_free; //多少kg内包邮 | |
| 445 | 448 | //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- |
| 446 | 449 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past!=1 ){ |
| 447 | 450 | |
| ... | ... | @@ -452,7 +455,11 @@ Page({ |
| 452 | 455 | case 2: |
| 453 | 456 | if (goods_weight < 0) goods_weight = 0; |
| 454 | 457 | //累积商品重量 每种商品的重量 * 数量 |
| 455 | - goods_weight += good['weight'] * good['buynum'];break; | |
| 458 | + goods_weight += good['weight'] * good['buynum']; | |
| 459 | + if(weight_free > 0){ | |
| 460 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
| 461 | + } | |
| 462 | + break; | |
| 456 | 463 | case 3: |
| 457 | 464 | if (goods_piece < 0) goods_piece = 0; |
| 458 | 465 | //累积商品数量 |
| ... | ... | @@ -461,8 +468,7 @@ Page({ |
| 461 | 468 | |
| 462 | 469 | var code =""; |
| 463 | 470 | if(th.data.wu_arr && th.data.wu_arr[th.data.index]) code=th.data.wu_arr[th.data.index].code; |
| 464 | - var freight_free = ee.freight_free; //全场满多少包邮 | |
| 465 | - var no_ex_id=ee.no_ex_id; | |
| 471 | + var no_ex_id=ee.no_ex_id; | |
| 466 | 472 | th.data.is_no_by[th.data.bn_pick]=0; |
| 467 | 473 | |
| 468 | 474 | var no_by_data=null; |
| ... | ... | @@ -924,7 +930,7 @@ Page({ |
| 924 | 930 | var price =0,th=this; |
| 925 | 931 | price +=parseFloat(o_shipping_price); |
| 926 | 932 | //如果是包邮 |
| 927 | - if (freight_free > 0 && o_price >= freight_free){ return 0;} | |
| 933 | + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0){ return 0;} | |
| 928 | 934 | if (user_addr==null) { return 0; } |
| 929 | 935 | //计算物流的config item; |
| 930 | 936 | var item=null; |
| ... | ... | @@ -938,7 +944,7 @@ Page({ |
| 938 | 944 | item=item.config; |
| 939 | 945 | if (item == null) return o_shipping_price; |
| 940 | 946 | //------按重量---------- |
| 941 | - if (goods_weight>=0 && item['money']) { | |
| 947 | + if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) { | |
| 942 | 948 | fw_price =parseFloat(item['money']); |
| 943 | 949 | if (goods_weight > item['first_weight']){ |
| 944 | 950 | var fw = goods_weight - item['first_weight']; |
| ... | ... | @@ -946,6 +952,16 @@ Page({ |
| 946 | 952 | fw_price = fw_price + n * parseFloat(item['add_money']); |
| 947 | 953 | } |
| 948 | 954 | } |
| 955 | + //------超出重量---------- | |
| 956 | + if(out_of_weight < 0){ | |
| 957 | + fw_price = parseFloat(item['money']); | |
| 958 | + var out_of_weight = Math.abs(out_of_weight); | |
| 959 | + if (out_of_weight > item['first_weight']) { | |
| 960 | + var fw = out_of_weight - item['first_weight']; | |
| 961 | + var n = Math.ceil(fw / item['second_weight']) | |
| 962 | + fw_price = fw_price + n * parseFloat(item['add_money']); | |
| 963 | + } | |
| 964 | + } | |
| 949 | 965 | //------按件数---------- |
| 950 | 966 | if (goods_piece > 0 && item['piecemoney']) { |
| 951 | 967 | fp_price = parseFloat(item['piecemoney']); | ... | ... |
pages/cart/cart2_pt/cart2_pt.js
| ... | ... | @@ -395,7 +395,6 @@ Page({ |
| 395 | 395 | }, |
| 396 | 396 | //---------计算立即购买---------- |
| 397 | 397 | calculatePrice2: function () { |
| 398 | - console.log('calculatePrice2'); | |
| 399 | 398 | var th = this, good = this.data.bn_goods; |
| 400 | 399 | //-----------计算商品总价-------------- |
| 401 | 400 | var allpice = good.shop_price * good.buynum; |
| ... | ... | @@ -408,7 +407,10 @@ Page({ |
| 408 | 407 | to.getwuliuprice(function (rs) { |
| 409 | 408 | console.log('calculatePrice2222'); |
| 410 | 409 | console.log(rs); |
| 411 | - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | |
| 410 | + var o_shipping_price = 0,goods_weight = -1,goods_piece = -1; | |
| 411 | + var out_of_weight=null; //超出多少重量 | |
| 412 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
| 413 | + var weight_free = ee.weight_free; //多少kg内包邮 | |
| 412 | 414 | //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- |
| 413 | 415 | 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) ){ |
| 414 | 416 | switch (good['exp_sum_type']) { |
| ... | ... | @@ -418,7 +420,12 @@ Page({ |
| 418 | 420 | case 2: |
| 419 | 421 | if (goods_weight < 0) goods_weight = 0; |
| 420 | 422 | //累积商品重量 每种商品的重量 * 数量 |
| 421 | - goods_weight += good['weight'] * good['buynum'];break; | |
| 423 | + goods_weight += good['weight'] * good['buynum']; | |
| 424 | + if(weight_free > 0){ | |
| 425 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
| 426 | + } | |
| 427 | + break; | |
| 428 | + // goods_weight += good['weight'] * good['buynum'];break; | |
| 422 | 429 | case 3: |
| 423 | 430 | if (goods_piece < 0) goods_piece = 0; |
| 424 | 431 | //累积商品数量 |
| ... | ... | @@ -430,7 +437,7 @@ Page({ |
| 430 | 437 | var code = th.data.wu_arr[th.data.index].code; |
| 431 | 438 | var freight_free = ee.freight_free; //全场满多少包邮 |
| 432 | 439 | var shipping_price= |
| 433 | - th.calculatewuliu(code, o_shipping_price, goods_weight, | |
| 440 | + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, | |
| 434 | 441 | goods_piece, th.data.user_addr, freight_free, allpice, rs); |
| 435 | 442 | |
| 436 | 443 | shipping_price = parseFloat(shipping_price).toFixed(2); |
| ... | ... | @@ -779,7 +786,7 @@ Page({ |
| 779 | 786 | var price =0,th=this; |
| 780 | 787 | price +=parseFloat(o_shipping_price); |
| 781 | 788 | //如果是包邮 |
| 782 | - if (freight_free > 0 && o_price >= freight_free){ return 0;} | |
| 789 | + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0){ return 0;} | |
| 783 | 790 | if (user_addr==null) { return 0; } |
| 784 | 791 | //计算物流的config item; |
| 785 | 792 | var item=null; |
| ... | ... | @@ -793,7 +800,7 @@ Page({ |
| 793 | 800 | item=item.config; |
| 794 | 801 | if (item == null) return o_shipping_price; |
| 795 | 802 | //------按重量---------- |
| 796 | - if (goods_weight>=0) { | |
| 803 | + if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) { | |
| 797 | 804 | fw_price =parseFloat(item['money']); |
| 798 | 805 | if (goods_weight > item['first_weight']){ |
| 799 | 806 | var fw = goods_weight - item['first_weight']; |
| ... | ... | @@ -801,6 +808,16 @@ Page({ |
| 801 | 808 | fw_price = fw_price + n * parseFloat(item['add_money']); |
| 802 | 809 | } |
| 803 | 810 | } |
| 811 | + //------超出重量---------- | |
| 812 | + if(out_of_weight < 0){ | |
| 813 | + fw_price = parseFloat(item['money']); | |
| 814 | + var out_of_weight = Math.abs(out_of_weight); | |
| 815 | + if (out_of_weight > item['first_weight']) { | |
| 816 | + var fw = out_of_weight - item['first_weight']; | |
| 817 | + var n = Math.ceil(fw / item['second_weight']) | |
| 818 | + fw_price = fw_price + n * parseFloat(item['add_money']); | |
| 819 | + } | |
| 820 | + } | |
| 804 | 821 | //------按件数---------- |
| 805 | 822 | if (goods_piece > 0) { |
| 806 | 823 | fp_price = parseFloat(item['piecemoney']); | ... | ... |
pages/cart/cart_wk/cart_wk.js
| ... | ... | @@ -420,10 +420,10 @@ Page({ |
| 420 | 420 | var to = getApp(), th = this; |
| 421 | 421 | to.getConfig2(function (ee) { |
| 422 | 422 | to.getwuliuprice(function (rs) { |
| 423 | - var o_shipping_price = 0, | |
| 424 | - goods_weight = -1, | |
| 425 | - goods_piece = -1, | |
| 426 | - good = th.data.goods; | |
| 423 | + var o_shipping_price = 0,goods_weight = -1,goods_piece = -1; | |
| 424 | + var out_of_weight=null; //超出多少重量 | |
| 425 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
| 426 | + var weight_free = ee.weight_free; //多少kg内包邮 | |
| 427 | 427 | //-----------当地址不为空,且是物流时,计算物流费用---------- |
| 428 | 428 | if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { |
| 429 | 429 | switch (good['exp_sum_type']) { |
| ... | ... | @@ -435,6 +435,9 @@ Page({ |
| 435 | 435 | if (goods_weight < 0) goods_weight = 0; |
| 436 | 436 | //累积商品重量 每种商品的重量 * 数量 |
| 437 | 437 | goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; |
| 438 | + if(weight_free > 0){ | |
| 439 | + out_of_weight = (weight_free * 1000 ) - goods_weight; | |
| 440 | + } | |
| 438 | 441 | break; |
| 439 | 442 | case 3: |
| 440 | 443 | if (goods_piece < 0) goods_piece = 0; |
| ... | ... | @@ -443,7 +446,6 @@ Page({ |
| 443 | 446 | break; |
| 444 | 447 | } |
| 445 | 448 | var code = th.data.wu_arr[th.data.index].code; |
| 446 | - var freight_free = ee.freight_free; //全场满多少包邮 | |
| 447 | 449 | //--全部金额-- |
| 448 | 450 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; |
| 449 | 451 | var shipping_price = |
| ... | ... | @@ -470,7 +472,7 @@ Page({ |
| 470 | 472 | var price = 0, th = this; |
| 471 | 473 | price += parseFloat(o_shipping_price); |
| 472 | 474 | //如果是包邮 |
| 473 | - if (freight_free > 0 && o_price >= freight_free) { return 0; } | |
| 475 | + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0) { return 0; } | |
| 474 | 476 | if (user_addr == null) { return 0; } |
| 475 | 477 | //计算物流的config item; |
| 476 | 478 | var item = null; |
| ... | ... | @@ -484,7 +486,7 @@ Page({ |
| 484 | 486 | item = item.config; |
| 485 | 487 | if (item == null) return o_shipping_price; |
| 486 | 488 | //------按重量---------- |
| 487 | - if (goods_weight > 0) { | |
| 489 | + if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) { | |
| 488 | 490 | fw_price = parseFloat(item['money']); |
| 489 | 491 | if (goods_weight > item['first_weight']) { |
| 490 | 492 | var fw = goods_weight - item['first_weight']; |
| ... | ... | @@ -492,6 +494,16 @@ Page({ |
| 492 | 494 | fw_price = fw_price + n * parseFloat(item['add_money']); |
| 493 | 495 | } |
| 494 | 496 | } |
| 497 | + //------超出重量---------- | |
| 498 | + if(out_of_weight < 0){ | |
| 499 | + fw_price = parseFloat(item['money']); | |
| 500 | + var out_of_weight = Math.abs(out_of_weight); | |
| 501 | + if (out_of_weight > item['first_weight']) { | |
| 502 | + var fw = out_of_weight - item['first_weight']; | |
| 503 | + var n = Math.ceil(fw / item['second_weight']) | |
| 504 | + fw_price = fw_price + n * parseFloat(item['add_money']); | |
| 505 | + } | |
| 506 | + } | |
| 495 | 507 | //------按件数---------- |
| 496 | 508 | if (goods_piece > 0) { |
| 497 | 509 | fp_price = parseFloat(item['piecemoney']); | ... | ... |