Commit b39365c7c39820c8e4d22ae063fb3e8e4637e207

Authored by abson
1 parent e597e10b

积分购 物流超重优化

packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
... ... @@ -1374,13 +1374,11 @@ Page({
1374 1374 o_price += item[j].goods_price * item[j].goods_num;
1375 1375  
1376 1376 //判断是否有设置限制重量包邮
1377   - if(weight_free){
1378   - if( item[j]['exp_sum_type']==2 ){
1379   - if (goods_weight < 0) goods_weight = 0;
1380   - //累积商品重量 每种商品的重量 * 数量
1381   - goods_weight += item[j]['weight'] * item[j]['goods_num'];
1382   - out_of_weight = (weight_free*1000) - goods_weight;
1383   - }
  1377 + if(item[j]['is_past']!==1 && item[j]['exp_sum_type']==2 && weight_free>0){
  1378 + if (goods_weight < 0) goods_weight = 0;
  1379 + //累积商品重量 每种商品的重量 * 数量
  1380 + goods_weight += item[j]['weight'] * item[j]['goods_num'];
  1381 + out_of_weight = (weight_free*1000) - goods_weight;
1384 1382 }
1385 1383 }
1386 1384 //判断是不是有组合购的金额
... ... @@ -1560,9 +1558,11 @@ Page({
1560 1558 }
1561 1559  
1562 1560 }else{
1563   - if(goods_weight && out_of_weight !== 0){
1564   - goods_weight=-1;
1565   - out_of_weight=0;
  1561 + if(item[j]['exp_sum_type']==2){
  1562 + if(out_of_weight !==0){
  1563 + goods_weight=-1;
  1564 + out_of_weight=0;
  1565 + }
1566 1566 }
1567 1567 }
1568 1568 }
... ... @@ -1866,7 +1866,9 @@ Page({
1866 1866 if (goods_weight < 0) goods_weight = 0;
1867 1867 //累积商品重量 每种商品的重量 * 数量
1868 1868 goods_weight += good['weight'] * good['buynum'];
1869   - out_of_weight = (weight_free * 1000 ) - goods_weight;
  1869 + if(weight_free > 0){
  1870 + out_of_weight = (weight_free * 1000 ) - goods_weight;
  1871 + }
1870 1872 break;
1871 1873 case 3:
1872 1874 if (goods_piece < 0) goods_piece = 0;
... ... @@ -2863,7 +2865,7 @@ Page({
2863 2865 var price = 0, th = this;
2864 2866 price += parseFloat(o_shipping_price);
2865 2867 //如果是包邮
2866   - if (freight_free > 0 && o_price >= freight_free && out_of_weight > 0) {
  2868 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) {
2867 2869 return 0;
2868 2870 }
2869 2871 if (user_addr == null) {
... ... @@ -2881,7 +2883,7 @@ Page({
2881 2883 item = item.config;
2882 2884 if (item == null) return o_shipping_price;
2883 2885 //------按重量----------
2884   - if (goods_weight >= 0 && item['money'] && out_of_weight > 0) {
  2886 + if (goods_weight >= 0 && item['money']) {
2885 2887 fw_price = parseFloat(item['money']);
2886 2888 if (goods_weight > item['first_weight']) {
2887 2889 var fw = goods_weight - item['first_weight'];
... ... @@ -2890,11 +2892,14 @@ Page({
2890 2892 }
2891 2893 }
2892 2894 //------超出重量----------
2893   - if(out_of_weight < 0){
  2895 + if(out_of_weight < 0 && o_price >= freight_free){
2894 2896 fw_price = parseFloat(item['money']);
2895 2897 var out_of_weight = Math.abs(out_of_weight);
2896   - var n = Math.ceil(out_of_weight / item['second_weight'])
2897   - fw_price = fw_price + n * parseFloat(item['add_money']);
  2898 + if (out_of_weight > item['first_weight']) {
  2899 + var fw = out_of_weight - item['first_weight'];
  2900 + var n = Math.ceil(fw / item['second_weight'])
  2901 + fw_price = fw_price + n * parseFloat(item['add_money']);
  2902 + }
2898 2903 }
2899 2904 //------按件数----------
2900 2905 if (goods_piece > 0 && item['piecemoney']) {
... ...
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
... ... @@ -513,6 +513,10 @@ Page({
513 513 var o_shipping_price = 0,
514 514 goods_weight = -1,
515 515 goods_piece = -1;
  516 + var out_of_weight=null; //超出多少重量
  517 + var freight_free = ee.freight_free; //全场满多少包邮
  518 + var weight_free = ee.weight_free; //多少kg内包邮
  519 + var no_ex_id = ee.no_ex_id;
516 520 //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
517 521 if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type !=
518 522 3 || th.data.bn_goods.is_normal == 1)) {
... ... @@ -525,6 +529,9 @@ Page({
525 529 if (goods_weight < 0) goods_weight = 0;
526 530 //累积商品重量 每种商品的重量 * 数量
527 531 goods_weight += good['weight'] * good['buynum'];
  532 + if(weight_free > 0){
  533 + out_of_weight = (weight_free * 1000 ) - goods_weight;
  534 + }
528 535 break;
529 536 case 3:
530 537 if (goods_piece < 0) goods_piece = 0;
... ... @@ -1042,7 +1049,7 @@ Page({
1042 1049 th = this;
1043 1050 price += parseFloat(o_shipping_price);
1044 1051 //如果是包邮
1045   - if (freight_free > 0 && o_price >= freight_free) {
  1052 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) {
1046 1053 return 0;
1047 1054 }
1048 1055 if (user_addr == null) {
... ... @@ -1061,7 +1068,7 @@ Page({
1061 1068 item = item.config;
1062 1069 if (item == null) return o_shipping_price;
1063 1070 //------按重量----------
1064   - if (goods_weight > 0) {
  1071 + if (goods_weight > 0 && item['money']) {
1065 1072 fw_price = parseFloat(item['money']);
1066 1073 if (goods_weight > item['first_weight']) {
1067 1074 var fw = goods_weight - item['first_weight'];
... ... @@ -1069,6 +1076,16 @@ Page({
1069 1076 fw_price = fw_price + n * parseFloat(item['add_money']);
1070 1077 }
1071 1078 }
  1079 + //------超出重量----------
  1080 + if(out_of_weight < 0 && o_price >= freight_free){
  1081 + fw_price = parseFloat(item['money']);
  1082 + var out_of_weight = Math.abs(out_of_weight);
  1083 + if (out_of_weight > item['first_weight']) {
  1084 + var fw = out_of_weight - item['first_weight'];
  1085 + var n = Math.ceil(fw / item['second_weight'])
  1086 + fw_price = fw_price + n * parseFloat(item['add_money']);
  1087 + }
  1088 + }
1072 1089 //------按件数----------
1073 1090 if (goods_piece > 0) {
1074 1091 fp_price = parseFloat(item['piecemoney']);
... ...
packageC/pages/presell/cart/cart.js
... ... @@ -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'] && out_of_weight >= 0) {
  878 + if (goods_weight >= 0 && item['money']) {
879 879 fw_price = parseFloat(item['money']);
880 880 if (goods_weight > item['first_weight']) {
881 881 var fw = goods_weight - item['first_weight'];
... ... @@ -884,7 +884,7 @@ Page({
884 884 }
885 885 }
886 886 //------超出重量----------
887   - if(out_of_weight < 0){
  887 + if(out_of_weight < 0 && o_price >= freight_free){
888 888 fw_price = parseFloat(item['money']);
889 889 var out_of_weight = Math.abs(out_of_weight);
890 890 if (out_of_weight > item['first_weight']) {
... ...
packageC/pages/presell/cart/cart2.js
... ... @@ -1693,7 +1693,7 @@ Page({
1693 1693 item = item.config;
1694 1694 if (item == null) return o_shipping_price;
1695 1695 //------按重量----------
1696   - if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) {
  1696 + if (goods_weight >= 0 && item['money']) {
1697 1697 fw_price = parseFloat(item['money']);
1698 1698 if (goods_weight > item['first_weight']) {
1699 1699 var fw = goods_weight - item['first_weight'];
... ... @@ -1703,7 +1703,7 @@ Page({
1703 1703 }
1704 1704  
1705 1705 //------超出重量----------
1706   - if(out_of_weight < 0){
  1706 + if(out_of_weight < 0 && o_price >= freight_free){
1707 1707 fw_price = parseFloat(item['money']);
1708 1708 var out_of_weight = Math.abs(out_of_weight);
1709 1709 var n = Math.ceil(out_of_weight / item['second_weight'])
... ...
packageC/pages/presell/cart/cart2_pre.js
... ... @@ -727,7 +727,7 @@ Page({
727 727 item=item.config;
728 728 if (item == null) return o_shipping_price;
729 729 //------按重量----------
730   - if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) {
  730 + if (goods_weight >= 0 && item['money']) {
731 731 fw_price =parseFloat(item['money']);
732 732 if (goods_weight > item['first_weight']){
733 733 var fw = goods_weight - item['first_weight'];
... ... @@ -736,7 +736,7 @@ Page({
736 736 }
737 737 }
738 738 //------超出重量----------
739   - if(out_of_weight < 0){
  739 + if(out_of_weight < 0 && o_price >= freight_free){
740 740 fw_price = parseFloat(item['money']);
741 741 var out_of_weight = Math.abs(out_of_weight);
742 742 if (out_of_weight > item['first_weight']) {
... ...
pages/cart/cart2/cart2.js
... ... @@ -3057,7 +3057,7 @@ Page({
3057 3057 item = item.config;
3058 3058 if (item == null) return o_shipping_price;
3059 3059 //------按重量----------
3060   - if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) {
  3060 + if (goods_weight >= 0 && item['money']) {
3061 3061 fw_price = parseFloat(item['money']);
3062 3062 if (goods_weight > item['first_weight']) {
3063 3063 var fw = goods_weight - item['first_weight'];
... ... @@ -3066,7 +3066,7 @@ Page({
3066 3066 }
3067 3067 }
3068 3068 //------超出重量----------
3069   - if(out_of_weight < 0){
  3069 + if(out_of_weight < 0 && o_price >= freight_free){
3070 3070 fw_price = parseFloat(item['money']);
3071 3071 var out_of_weight = Math.abs(out_of_weight);
3072 3072 if (out_of_weight > item['first_weight']) {
... ...
pages/cart/cart2/zh_calculate.js
... ... @@ -153,7 +153,6 @@ module.exports = {
153 153 if (zhqty_bz.length > 1) {
154 154 let zhqty_bz_arr = [];
155 155 let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr);
156   -
157 156 if (zhqty_bz_flag) {
158 157 for (let i = 0; i < zhqty_bz.length; i++) {
159 158 var vv = zhqty_bz[i];
... ...
pages/cart/cart2_inte/cart2_inte.js
... ... @@ -502,7 +502,7 @@ Page({
502 502 th.data.is_by[th.data.bn_pick]=0;
503 503 //--------------开始计算物流------------------
504 504 var shipping_price=
505   - th.calculatewuliu(code, o_shipping_price, goods_weight,
  505 + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,
506 506 goods_piece, th.data.user_addr, freight_free, allpice-cut_price, rs);
507 507 if(shipping_price<=0){
508 508 th.data.is_by[th.data.bn_pick]=1; //已经是包邮了,就不要选择包邮券
... ... @@ -925,7 +925,7 @@ Page({
925 925 th.calculatePrice();
926 926 },
927 927 //-------------------计算物流---------------
928   - calculatewuliu:function(code, o_shipping_price, goods_weight,
  928 + calculatewuliu:function(code, o_shipping_price, goods_weight,out_of_weight,
929 929 goods_piece,user_addr, freight_free, o_price, rs){
930 930 var price =0,th=this;
931 931 price +=parseFloat(o_shipping_price);
... ... @@ -944,7 +944,7 @@ Page({
944 944 item=item.config;
945 945 if (item == null) return o_shipping_price;
946 946 //------按重量----------
947   - if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) {
  947 + if (goods_weight >= 0 && item['money']) {
948 948 fw_price =parseFloat(item['money']);
949 949 if (goods_weight > item['first_weight']){
950 950 var fw = goods_weight - item['first_weight'];
... ... @@ -953,7 +953,7 @@ Page({
953 953 }
954 954 }
955 955 //------超出重量----------
956   - if(out_of_weight < 0){
  956 + if(out_of_weight < 0 && o_price >= freight_free){
957 957 fw_price = parseFloat(item['money']);
958 958 var out_of_weight = Math.abs(out_of_weight);
959 959 if (out_of_weight > item['first_weight']) {
... ...
pages/cart/cart2_pt/cart2_pt.js
... ... @@ -800,7 +800,7 @@ Page({
800 800 item=item.config;
801 801 if (item == null) return o_shipping_price;
802 802 //------按重量----------
803   - if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) {
  803 + if (goods_weight >= 0 && item['money']) {
804 804 fw_price =parseFloat(item['money']);
805 805 if (goods_weight > item['first_weight']){
806 806 var fw = goods_weight - item['first_weight'];
... ... @@ -809,7 +809,7 @@ Page({
809 809 }
810 810 }
811 811 //------超出重量----------
812   - if(out_of_weight < 0){
  812 + if(out_of_weight < 0 && o_price >= freight_free){
813 813 fw_price = parseFloat(item['money']);
814 814 var out_of_weight = Math.abs(out_of_weight);
815 815 if (out_of_weight > item['first_weight']) {
... ... @@ -819,7 +819,7 @@ Page({
819 819 }
820 820 }
821 821 //------按件数----------
822   - if (goods_piece > 0) {
  822 + if (goods_piece > 0 ) {
823 823 fp_price = parseFloat(item['piecemoney']);
824 824 if (goods_piece > item['first_piece']) {
825 825 var fp = goods_piece - item['first_piece'];
... ...
pages/cart/cart_wk/cart_wk.js
... ... @@ -420,7 +420,7 @@ 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,goods_weight = -1,goods_piece = -1;
  423 + var o_shipping_price = 0,goods_weight = -1,goods_piece = -1,good=th.data.goods;
424 424 var out_of_weight=null; //超出多少重量
425 425 var freight_free = ee.freight_free; //全场满多少包邮
426 426 var weight_free = ee.weight_free; //多少kg内包邮
... ... @@ -486,7 +486,7 @@ Page({
486 486 item = item.config;
487 487 if (item == null) return o_shipping_price;
488 488 //------按重量----------
489   - if (goods_weight >= 0 && item['money'] && out_of_weight >= 0) {
  489 + if (goods_weight >= 0 && item['money']) {
490 490 fw_price = parseFloat(item['money']);
491 491 if (goods_weight > item['first_weight']) {
492 492 var fw = goods_weight - item['first_weight'];
... ... @@ -495,7 +495,7 @@ Page({
495 495 }
496 496 }
497 497 //------超出重量----------
498   - if(out_of_weight < 0){
  498 + if(out_of_weight < 0 && o_price >= freight_free){
499 499 fw_price = parseFloat(item['money']);
500 500 var out_of_weight = Math.abs(out_of_weight);
501 501 if (out_of_weight > item['first_weight']) {
... ...