Commit b29b5dd8c6148728369853717228408f75de8330

Authored by abson
1 parent 57973d9d

物流

packageC/pages/presell/cart/cart.js
@@ -852,12 +852,12 @@ Page({ @@ -852,12 +852,12 @@ Page({
852 th.calculatePrice2(); 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 goods_piece, user_addr, freight_free, o_price, rs) { 856 goods_piece, user_addr, freight_free, o_price, rs) {
857 var price = 0, th = this; 857 var price = 0, th = this;
858 price += parseFloat(o_shipping_price); 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 return 0; 861 return 0;
862 } 862 }
863 if (user_addr == null) { 863 if (user_addr == null) {
@@ -875,7 +875,7 @@ Page({ @@ -875,7 +875,7 @@ Page({
875 item = item.config; 875 item = item.config;
876 if (item == null) return o_shipping_price; 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 fw_price = parseFloat(item['money']); 879 fw_price = parseFloat(item['money']);
880 if (goods_weight > item['first_weight']) { 880 if (goods_weight > item['first_weight']) {
881 var fw = goods_weight - item['first_weight']; 881 var fw = goods_weight - item['first_weight'];
@@ -883,6 +883,16 @@ Page({ @@ -883,6 +883,16 @@ Page({
883 fw_price = fw_price + n * parseFloat(item['add_money']); 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 if (goods_piece > 0 && item['piecemoney']) { 897 if (goods_piece > 0 && item['piecemoney']) {
888 fp_price = parseFloat(item['piecemoney']); 898 fp_price = parseFloat(item['piecemoney']);
@@ -1713,6 +1723,9 @@ Page({ @@ -1713,6 +1723,9 @@ Page({
1713 var quan_no = null; 1723 var quan_no = null;
1714 var bn_pick=th.data.pickup.pickup_id; 1724 var bn_pick=th.data.pickup.pickup_id;
1715 var allpice =th.data.all_price; 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 if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) 1730 if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined)
1718 quan_no = th.data.using_quan[bn_pick].coupon_no; 1731 quan_no = th.data.using_quan[bn_pick].coupon_no;
@@ -1793,6 +1806,9 @@ Page({ @@ -1793,6 +1806,9 @@ Page({
1793 if (goods_weight < 0) goods_weight = 0; 1806 if (goods_weight < 0) goods_weight = 0;
1794 //累积商品重量 每种商品的重量 * 数量 1807 //累积商品重量 每种商品的重量 * 数量
1795 goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; 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 break; 1812 break;
1797 case 3: 1813 case 3:
1798 if (goods_piece < 0) goods_piece = 0; 1814 if (goods_piece < 0) goods_piece = 0;
@@ -1802,7 +1818,6 @@ Page({ @@ -1802,7 +1818,6 @@ Page({
1802 } 1818 }
1803 1819
1804 var code = th.data.wu_arr[th.data.index].code; 1820 var code = th.data.wu_arr[th.data.index].code;
1805 - var freight_free = ee.freight_free; //全场满多少包邮  
1806 var shipping_price = 1821 var shipping_price =
1807 th.calculatewuliu(code, o_shipping_price, goods_weight, 1822 th.calculatewuliu(code, o_shipping_price, goods_weight,
1808 goods_piece, th.data.user_addr, freight_free, allpice, rs); 1823 goods_piece, th.data.user_addr, freight_free, allpice, rs);
packageC/pages/presell/cart/cart2.js
@@ -734,7 +734,7 @@ Page({ @@ -734,7 +734,7 @@ Page({
734 734
735 //如果有赠品的时候,也要计算赠品的物流费用 735 //如果有赠品的时候,也要计算赠品的物流费用
736 if (th.data.buy_now_gift_goods) { 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 parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); 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,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 var good = this.data.buy_now_gift_goods; 2544 var good = this.data.buy_now_gift_goods;
2545 var goods_weight = -1, goods_piece = -1; 2545 var goods_weight = -1, goods_piece = -1;
2546 var gift_shipping_price = 0; 2546 var gift_shipping_price = 0;
@@ -2556,8 +2556,9 @@ Page({ @@ -2556,8 +2556,9 @@ Page({
2556 //累积商品重量 每种商品的重量 * 数量 2556 //累积商品重量 每种商品的重量 * 数量
2557 goods_weight += good['weight'] * good['buynum']; 2557 goods_weight += good['weight'] * good['buynum'];
2558 if (goods_weight1 > 0) { 2558 if (goods_weight1 > 0) {
  2559 + out_of_weight = gift_weight_free - goods_weight;
  2560 + //不能调换位置 下面goods_weight会变大
2559 goods_weight += goods_weight1; 2561 goods_weight += goods_weight1;
2560 - out_of_weight = (gift_weight_free*1000) - goods_weight;  
2561 } 2562 }
2562 break; 2563 break;
2563 case 3: 2564 case 3:
packageC/pages/presell/cart/cart2_pre.js
@@ -342,7 +342,11 @@ Page({ @@ -342,7 +342,11 @@ Page({
342 342
343 app.getConfig2(function (ee) { 343 app.getConfig2(function (ee) {
344 app.getwuliuprice(function (rs) { 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 if (th.data.user_addr != null && th.data.bn_exp_type == 0 351 if (th.data.user_addr != null && th.data.bn_exp_type == 0
348 && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){ 352 && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){
@@ -353,7 +357,11 @@ Page({ @@ -353,7 +357,11 @@ Page({
353 case 2: 357 case 2:
354 if (goods_weight < 0) goods_weight = 0; 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 case 3: 365 case 3:
358 if (goods_piece < 0) goods_piece = 0; 366 if (goods_piece < 0) goods_piece = 0;
359 //累积商品数量 367 //累积商品数量
@@ -361,9 +369,8 @@ Page({ @@ -361,9 +369,8 @@ Page({
361 } 369 }
362 370
363 var code = th.data.wu_arr[th.data.index].code; 371 var code = th.data.wu_arr[th.data.index].code;
364 - var freight_free = ee.freight_free; //全场满多少包邮  
365 var shipping_price= 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 goods_piece, th.data.user_addr, freight_free, allpice, rs); 374 goods_piece, th.data.user_addr, freight_free, allpice, rs);
368 375
369 shipping_price = parseFloat(shipping_price).toFixed(2); 376 shipping_price = parseFloat(shipping_price).toFixed(2);
@@ -701,12 +708,12 @@ Page({ @@ -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 goods_piece,user_addr, freight_free, o_price, rs){ 712 goods_piece,user_addr, freight_free, o_price, rs){
706 var price =0,th=this; 713 var price =0,th=this;
707 price +=parseFloat(o_shipping_price); 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 if (user_addr==null) { return 0; } 717 if (user_addr==null) { return 0; }
711 //计算物流的config item; 718 //计算物流的config item;
712 var item=null; 719 var item=null;
@@ -720,7 +727,7 @@ Page({ @@ -720,7 +727,7 @@ Page({
720 item=item.config; 727 item=item.config;
721 if (item == null) return o_shipping_price; 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 fw_price =parseFloat(item['money']); 731 fw_price =parseFloat(item['money']);
725 if (goods_weight > item['first_weight']){ 732 if (goods_weight > item['first_weight']){
726 var fw = goods_weight - item['first_weight']; 733 var fw = goods_weight - item['first_weight'];
@@ -728,6 +735,16 @@ Page({ @@ -728,6 +735,16 @@ Page({
728 fw_price = fw_price + n * parseFloat(item['add_money']); 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 if (goods_piece > 0) { 749 if (goods_piece > 0) {
733 fp_price = parseFloat(item['piecemoney']); 750 fp_price = parseFloat(item['piecemoney']);
pages/cart/cart2/cart2.js
@@ -1484,13 +1484,11 @@ Page({ @@ -1484,13 +1484,11 @@ Page({
1484 o_price += item[j].goods_price * item[j].goods_num; 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,7 +1664,7 @@ Page({
1666 o_shipping_price += item[j]['uniform_exp_sum']; 1664 o_shipping_price += item[j]['uniform_exp_sum'];
1667 break; 1665 break;
1668 // case 2: //1464行已计算 不必重复计算 注释为:判断是否有设置限制重量包邮 1666 // case 2: //1464行已计算 不必重复计算 注释为:判断是否有设置限制重量包邮
1669 - // +'' 1667 + // +''
1670 // if (goods_weight < 0) goods_weight = 0; 1668 // if (goods_weight < 0) goods_weight = 0;
1671 // //累积商品重量 每种商品的重量 * 数量 1669 // //累积商品重量 每种商品的重量 * 数量
1672 // goods_weight += item[j]['weight'] * item[j]['goods_num']; 1670 // goods_weight += item[j]['weight'] * item[j]['goods_num'];
@@ -1679,12 +1677,14 @@ Page({ @@ -1679,12 +1677,14 @@ Page({
1679 break; 1677 break;
1680 } 1678 }
1681 } 1679 }
1682 -  
1683 }else{ 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,7 +1999,9 @@ Page({
1999 //dw 1999 //dw
2000 //累积商品重量 每种商品的重量 * 数量 2000 //累积商品重量 每种商品的重量 * 数量
2001 goods_weight += good['weight'] * good['buynum']; 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 break; 2005 break;
2004 case 3: 2006 case 3:
2005 if (goods_piece < 0) goods_piece = 0; 2007 if (goods_piece < 0) goods_piece = 0;
@@ -3067,8 +3069,6 @@ Page({ @@ -3067,8 +3069,6 @@ Page({
3067 if(out_of_weight < 0){ 3069 if(out_of_weight < 0){
3068 fw_price = parseFloat(item['money']); 3070 fw_price = parseFloat(item['money']);
3069 var out_of_weight = Math.abs(out_of_weight); 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 if (out_of_weight > item['first_weight']) { 3072 if (out_of_weight > item['first_weight']) {
3073 var fw = out_of_weight - item['first_weight']; 3073 var fw = out_of_weight - item['first_weight'];
3074 var n = Math.ceil(fw / item['second_weight']) 3074 var n = Math.ceil(fw / item['second_weight'])
@@ -3985,7 +3985,7 @@ Page({ @@ -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 var good = this.data.buy_now_gift_goods; 3989 var good = this.data.buy_now_gift_goods;
3990 var goods_weight = -1, goods_piece = -1; 3990 var goods_weight = -1, goods_piece = -1;
3991 var gift_shipping_price = 0; 3991 var gift_shipping_price = 0;
pages/cart/cart2_inte/cart2_inte.js
@@ -442,6 +442,9 @@ Page({ @@ -442,6 +442,9 @@ Page({
442 to.getwuliuprice(async function (rs) { 442 to.getwuliuprice(async function (rs) {
443 443
444 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 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 if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past!=1 ){ 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,7 +455,11 @@ Page({
452 case 2: 455 case 2:
453 if (goods_weight < 0) goods_weight = 0; 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 case 3: 463 case 3:
457 if (goods_piece < 0) goods_piece = 0; 464 if (goods_piece < 0) goods_piece = 0;
458 //累积商品数量 465 //累积商品数量
@@ -461,8 +468,7 @@ Page({ @@ -461,8 +468,7 @@ Page({
461 468
462 var code =""; 469 var code ="";
463 if(th.data.wu_arr && th.data.wu_arr[th.data.index]) code=th.data.wu_arr[th.data.index].code; 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 th.data.is_no_by[th.data.bn_pick]=0; 472 th.data.is_no_by[th.data.bn_pick]=0;
467 473
468 var no_by_data=null; 474 var no_by_data=null;
@@ -924,7 +930,7 @@ Page({ @@ -924,7 +930,7 @@ Page({
924 var price =0,th=this; 930 var price =0,th=this;
925 price +=parseFloat(o_shipping_price); 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 if (user_addr==null) { return 0; } 934 if (user_addr==null) { return 0; }
929 //计算物流的config item; 935 //计算物流的config item;
930 var item=null; 936 var item=null;
@@ -938,7 +944,7 @@ Page({ @@ -938,7 +944,7 @@ Page({
938 item=item.config; 944 item=item.config;
939 if (item == null) return o_shipping_price; 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 fw_price =parseFloat(item['money']); 948 fw_price =parseFloat(item['money']);
943 if (goods_weight > item['first_weight']){ 949 if (goods_weight > item['first_weight']){
944 var fw = goods_weight - item['first_weight']; 950 var fw = goods_weight - item['first_weight'];
@@ -946,6 +952,16 @@ Page({ @@ -946,6 +952,16 @@ Page({
946 fw_price = fw_price + n * parseFloat(item['add_money']); 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 if (goods_piece > 0 && item['piecemoney']) { 966 if (goods_piece > 0 && item['piecemoney']) {
951 fp_price = parseFloat(item['piecemoney']); 967 fp_price = parseFloat(item['piecemoney']);
pages/cart/cart2_pt/cart2_pt.js
@@ -395,7 +395,6 @@ Page({ @@ -395,7 +395,6 @@ Page({
395 }, 395 },
396 //---------计算立即购买---------- 396 //---------计算立即购买----------
397 calculatePrice2: function () { 397 calculatePrice2: function () {
398 - console.log('calculatePrice2');  
399 var th = this, good = this.data.bn_goods; 398 var th = this, good = this.data.bn_goods;
400 //-----------计算商品总价-------------- 399 //-----------计算商品总价--------------
401 var allpice = good.shop_price * good.buynum; 400 var allpice = good.shop_price * good.buynum;
@@ -408,7 +407,10 @@ Page({ @@ -408,7 +407,10 @@ Page({
408 to.getwuliuprice(function (rs) { 407 to.getwuliuprice(function (rs) {
409 console.log('calculatePrice2222'); 408 console.log('calculatePrice2222');
410 console.log(rs); 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 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) ){ 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 switch (good['exp_sum_type']) { 416 switch (good['exp_sum_type']) {
@@ -418,7 +420,12 @@ Page({ @@ -418,7 +420,12 @@ Page({
418 case 2: 420 case 2:
419 if (goods_weight < 0) goods_weight = 0; 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 case 3: 429 case 3:
423 if (goods_piece < 0) goods_piece = 0; 430 if (goods_piece < 0) goods_piece = 0;
424 //累积商品数量 431 //累积商品数量
@@ -430,7 +437,7 @@ Page({ @@ -430,7 +437,7 @@ Page({
430 var code = th.data.wu_arr[th.data.index].code; 437 var code = th.data.wu_arr[th.data.index].code;
431 var freight_free = ee.freight_free; //全场满多少包邮 438 var freight_free = ee.freight_free; //全场满多少包邮
432 var shipping_price= 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 goods_piece, th.data.user_addr, freight_free, allpice, rs); 441 goods_piece, th.data.user_addr, freight_free, allpice, rs);
435 442
436 shipping_price = parseFloat(shipping_price).toFixed(2); 443 shipping_price = parseFloat(shipping_price).toFixed(2);
@@ -779,7 +786,7 @@ Page({ @@ -779,7 +786,7 @@ Page({
779 var price =0,th=this; 786 var price =0,th=this;
780 price +=parseFloat(o_shipping_price); 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 if (user_addr==null) { return 0; } 790 if (user_addr==null) { return 0; }
784 //计算物流的config item; 791 //计算物流的config item;
785 var item=null; 792 var item=null;
@@ -793,7 +800,7 @@ Page({ @@ -793,7 +800,7 @@ Page({
793 item=item.config; 800 item=item.config;
794 if (item == null) return o_shipping_price; 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 fw_price =parseFloat(item['money']); 804 fw_price =parseFloat(item['money']);
798 if (goods_weight > item['first_weight']){ 805 if (goods_weight > item['first_weight']){
799 var fw = goods_weight - item['first_weight']; 806 var fw = goods_weight - item['first_weight'];
@@ -801,6 +808,16 @@ Page({ @@ -801,6 +808,16 @@ Page({
801 fw_price = fw_price + n * parseFloat(item['add_money']); 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 if (goods_piece > 0) { 822 if (goods_piece > 0) {
806 fp_price = parseFloat(item['piecemoney']); 823 fp_price = parseFloat(item['piecemoney']);
pages/cart/cart_wk/cart_wk.js
@@ -420,10 +420,10 @@ Page({ @@ -420,10 +420,10 @@ Page({
420 var to = getApp(), th = this; 420 var to = getApp(), th = this;
421 to.getConfig2(function (ee) { 421 to.getConfig2(function (ee) {
422 to.getwuliuprice(function (rs) { 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 if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { 428 if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) {
429 switch (good['exp_sum_type']) { 429 switch (good['exp_sum_type']) {
@@ -435,6 +435,9 @@ Page({ @@ -435,6 +435,9 @@ Page({
435 if (goods_weight < 0) goods_weight = 0; 435 if (goods_weight < 0) goods_weight = 0;
436 //累积商品重量 每种商品的重量 * 数量 436 //累积商品重量 每种商品的重量 * 数量
437 goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; 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 break; 441 break;
439 case 3: 442 case 3:
440 if (goods_piece < 0) goods_piece = 0; 443 if (goods_piece < 0) goods_piece = 0;
@@ -443,7 +446,6 @@ Page({ @@ -443,7 +446,6 @@ Page({
443 break; 446 break;
444 } 447 }
445 var code = th.data.wu_arr[th.data.index].code; 448 var code = th.data.wu_arr[th.data.index].code;
446 - var freight_free = ee.freight_free; //全场满多少包邮  
447 //--全部金额-- 449 //--全部金额--
448 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; 450 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money;
449 var shipping_price = 451 var shipping_price =
@@ -470,7 +472,7 @@ Page({ @@ -470,7 +472,7 @@ Page({
470 var price = 0, th = this; 472 var price = 0, th = this;
471 price += parseFloat(o_shipping_price); 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 if (user_addr == null) { return 0; } 476 if (user_addr == null) { return 0; }
475 //计算物流的config item; 477 //计算物流的config item;
476 var item = null; 478 var item = null;
@@ -484,7 +486,7 @@ Page({ @@ -484,7 +486,7 @@ Page({
484 item = item.config; 486 item = item.config;
485 if (item == null) return o_shipping_price; 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 fw_price = parseFloat(item['money']); 490 fw_price = parseFloat(item['money']);
489 if (goods_weight > item['first_weight']) { 491 if (goods_weight > item['first_weight']) {
490 var fw = goods_weight - item['first_weight']; 492 var fw = goods_weight - item['first_weight'];
@@ -492,6 +494,16 @@ Page({ @@ -492,6 +494,16 @@ Page({
492 fw_price = fw_price + n * parseFloat(item['add_money']); 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 if (goods_piece > 0) { 508 if (goods_piece > 0) {
497 fp_price = parseFloat(item['piecemoney']); 509 fp_price = parseFloat(item['piecemoney']);