Commit b39365c7c39820c8e4d22ae063fb3e8e4637e207

Authored by abson
1 parent e597e10b

积分购 物流超重优化

packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
@@ -1374,13 +1374,11 @@ Page({ @@ -1374,13 +1374,11 @@ Page({
1374 o_price += item[j].goods_price * item[j].goods_num; 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,9 +1558,11 @@ Page({
1560 } 1558 }
1561 1559
1562 }else{ 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,7 +1866,9 @@ Page({
1866 if (goods_weight < 0) goods_weight = 0; 1866 if (goods_weight < 0) goods_weight = 0;
1867 //累积商品重量 每种商品的重量 * 数量 1867 //累积商品重量 每种商品的重量 * 数量
1868 goods_weight += good['weight'] * good['buynum']; 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 break; 1872 break;
1871 case 3: 1873 case 3:
1872 if (goods_piece < 0) goods_piece = 0; 1874 if (goods_piece < 0) goods_piece = 0;
@@ -2863,7 +2865,7 @@ Page({ @@ -2863,7 +2865,7 @@ Page({
2863 var price = 0, th = this; 2865 var price = 0, th = this;
2864 price += parseFloat(o_shipping_price); 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 return 0; 2869 return 0;
2868 } 2870 }
2869 if (user_addr == null) { 2871 if (user_addr == null) {
@@ -2881,7 +2883,7 @@ Page({ @@ -2881,7 +2883,7 @@ Page({
2881 item = item.config; 2883 item = item.config;
2882 if (item == null) return o_shipping_price; 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 fw_price = parseFloat(item['money']); 2887 fw_price = parseFloat(item['money']);
2886 if (goods_weight > item['first_weight']) { 2888 if (goods_weight > item['first_weight']) {
2887 var fw = goods_weight - item['first_weight']; 2889 var fw = goods_weight - item['first_weight'];
@@ -2890,11 +2892,14 @@ Page({ @@ -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 fw_price = parseFloat(item['money']); 2896 fw_price = parseFloat(item['money']);
2895 var out_of_weight = Math.abs(out_of_weight); 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 if (goods_piece > 0 && item['piecemoney']) { 2905 if (goods_piece > 0 && item['piecemoney']) {
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
@@ -513,6 +513,10 @@ Page({ @@ -513,6 +513,10 @@ Page({
513 var o_shipping_price = 0, 513 var o_shipping_price = 0,
514 goods_weight = -1, 514 goods_weight = -1,
515 goods_piece = -1; 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 if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 521 if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type !=
518 3 || th.data.bn_goods.is_normal == 1)) { 522 3 || th.data.bn_goods.is_normal == 1)) {
@@ -525,6 +529,9 @@ Page({ @@ -525,6 +529,9 @@ Page({
525 if (goods_weight < 0) goods_weight = 0; 529 if (goods_weight < 0) goods_weight = 0;
526 //累积商品重量 每种商品的重量 * 数量 530 //累积商品重量 每种商品的重量 * 数量
527 goods_weight += good['weight'] * good['buynum']; 531 goods_weight += good['weight'] * good['buynum'];
  532 + if(weight_free > 0){
  533 + out_of_weight = (weight_free * 1000 ) - goods_weight;
  534 + }
528 break; 535 break;
529 case 3: 536 case 3:
530 if (goods_piece < 0) goods_piece = 0; 537 if (goods_piece < 0) goods_piece = 0;
@@ -1042,7 +1049,7 @@ Page({ @@ -1042,7 +1049,7 @@ Page({
1042 th = this; 1049 th = this;
1043 price += parseFloat(o_shipping_price); 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 return 0; 1053 return 0;
1047 } 1054 }
1048 if (user_addr == null) { 1055 if (user_addr == null) {
@@ -1061,7 +1068,7 @@ Page({ @@ -1061,7 +1068,7 @@ Page({
1061 item = item.config; 1068 item = item.config;
1062 if (item == null) return o_shipping_price; 1069 if (item == null) return o_shipping_price;
1063 //------按重量---------- 1070 //------按重量----------
1064 - if (goods_weight > 0) { 1071 + if (goods_weight > 0 && item['money']) {
1065 fw_price = parseFloat(item['money']); 1072 fw_price = parseFloat(item['money']);
1066 if (goods_weight > item['first_weight']) { 1073 if (goods_weight > item['first_weight']) {
1067 var fw = goods_weight - item['first_weight']; 1074 var fw = goods_weight - item['first_weight'];
@@ -1069,6 +1076,16 @@ Page({ @@ -1069,6 +1076,16 @@ Page({
1069 fw_price = fw_price + n * parseFloat(item['add_money']); 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 if (goods_piece > 0) { 1090 if (goods_piece > 0) {
1074 fp_price = parseFloat(item['piecemoney']); 1091 fp_price = parseFloat(item['piecemoney']);
packageC/pages/presell/cart/cart.js
@@ -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'] && out_of_weight >= 0) { 878 + if (goods_weight >= 0 && item['money']) {
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'];
@@ -884,7 +884,7 @@ Page({ @@ -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 fw_price = parseFloat(item['money']); 888 fw_price = parseFloat(item['money']);
889 var out_of_weight = Math.abs(out_of_weight); 889 var out_of_weight = Math.abs(out_of_weight);
890 if (out_of_weight > item['first_weight']) { 890 if (out_of_weight > item['first_weight']) {
packageC/pages/presell/cart/cart2.js
@@ -1693,7 +1693,7 @@ Page({ @@ -1693,7 +1693,7 @@ Page({
1693 item = item.config; 1693 item = item.config;
1694 if (item == null) return o_shipping_price; 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 fw_price = parseFloat(item['money']); 1697 fw_price = parseFloat(item['money']);
1698 if (goods_weight > item['first_weight']) { 1698 if (goods_weight > item['first_weight']) {
1699 var fw = goods_weight - item['first_weight']; 1699 var fw = goods_weight - item['first_weight'];
@@ -1703,7 +1703,7 @@ Page({ @@ -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 fw_price = parseFloat(item['money']); 1707 fw_price = parseFloat(item['money']);
1708 var out_of_weight = Math.abs(out_of_weight); 1708 var out_of_weight = Math.abs(out_of_weight);
1709 var n = Math.ceil(out_of_weight / item['second_weight']) 1709 var n = Math.ceil(out_of_weight / item['second_weight'])
packageC/pages/presell/cart/cart2_pre.js
@@ -727,7 +727,7 @@ Page({ @@ -727,7 +727,7 @@ Page({
727 item=item.config; 727 item=item.config;
728 if (item == null) return o_shipping_price; 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 fw_price =parseFloat(item['money']); 731 fw_price =parseFloat(item['money']);
732 if (goods_weight > item['first_weight']){ 732 if (goods_weight > item['first_weight']){
733 var fw = goods_weight - item['first_weight']; 733 var fw = goods_weight - item['first_weight'];
@@ -736,7 +736,7 @@ Page({ @@ -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 fw_price = parseFloat(item['money']); 740 fw_price = parseFloat(item['money']);
741 var out_of_weight = Math.abs(out_of_weight); 741 var out_of_weight = Math.abs(out_of_weight);
742 if (out_of_weight > item['first_weight']) { 742 if (out_of_weight > item['first_weight']) {
pages/cart/cart2/cart2.js
@@ -3057,7 +3057,7 @@ Page({ @@ -3057,7 +3057,7 @@ Page({
3057 item = item.config; 3057 item = item.config;
3058 if (item == null) return o_shipping_price; 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 fw_price = parseFloat(item['money']); 3061 fw_price = parseFloat(item['money']);
3062 if (goods_weight > item['first_weight']) { 3062 if (goods_weight > item['first_weight']) {
3063 var fw = goods_weight - item['first_weight']; 3063 var fw = goods_weight - item['first_weight'];
@@ -3066,7 +3066,7 @@ Page({ @@ -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 fw_price = parseFloat(item['money']); 3070 fw_price = parseFloat(item['money']);
3071 var out_of_weight = Math.abs(out_of_weight); 3071 var out_of_weight = Math.abs(out_of_weight);
3072 if (out_of_weight > item['first_weight']) { 3072 if (out_of_weight > item['first_weight']) {
pages/cart/cart2/zh_calculate.js
@@ -153,7 +153,6 @@ module.exports = { @@ -153,7 +153,6 @@ module.exports = {
153 if (zhqty_bz.length > 1) { 153 if (zhqty_bz.length > 1) {
154 let zhqty_bz_arr = []; 154 let zhqty_bz_arr = [];
155 let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr); 155 let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr);
156 -  
157 if (zhqty_bz_flag) { 156 if (zhqty_bz_flag) {
158 for (let i = 0; i < zhqty_bz.length; i++) { 157 for (let i = 0; i < zhqty_bz.length; i++) {
159 var vv = zhqty_bz[i]; 158 var vv = zhqty_bz[i];
pages/cart/cart2_inte/cart2_inte.js
@@ -502,7 +502,7 @@ Page({ @@ -502,7 +502,7 @@ Page({
502 th.data.is_by[th.data.bn_pick]=0; 502 th.data.is_by[th.data.bn_pick]=0;
503 //--------------开始计算物流------------------ 503 //--------------开始计算物流------------------
504 var shipping_price= 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 goods_piece, th.data.user_addr, freight_free, allpice-cut_price, rs); 506 goods_piece, th.data.user_addr, freight_free, allpice-cut_price, rs);
507 if(shipping_price<=0){ 507 if(shipping_price<=0){
508 th.data.is_by[th.data.bn_pick]=1; //已经是包邮了,就不要选择包邮券 508 th.data.is_by[th.data.bn_pick]=1; //已经是包邮了,就不要选择包邮券
@@ -925,7 +925,7 @@ Page({ @@ -925,7 +925,7 @@ Page({
925 th.calculatePrice(); 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 goods_piece,user_addr, freight_free, o_price, rs){ 929 goods_piece,user_addr, freight_free, o_price, rs){
930 var price =0,th=this; 930 var price =0,th=this;
931 price +=parseFloat(o_shipping_price); 931 price +=parseFloat(o_shipping_price);
@@ -944,7 +944,7 @@ Page({ @@ -944,7 +944,7 @@ Page({
944 item=item.config; 944 item=item.config;
945 if (item == null) return o_shipping_price; 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 fw_price =parseFloat(item['money']); 948 fw_price =parseFloat(item['money']);
949 if (goods_weight > item['first_weight']){ 949 if (goods_weight > item['first_weight']){
950 var fw = goods_weight - item['first_weight']; 950 var fw = goods_weight - item['first_weight'];
@@ -953,7 +953,7 @@ Page({ @@ -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 fw_price = parseFloat(item['money']); 957 fw_price = parseFloat(item['money']);
958 var out_of_weight = Math.abs(out_of_weight); 958 var out_of_weight = Math.abs(out_of_weight);
959 if (out_of_weight > item['first_weight']) { 959 if (out_of_weight > item['first_weight']) {
pages/cart/cart2_pt/cart2_pt.js
@@ -800,7 +800,7 @@ Page({ @@ -800,7 +800,7 @@ Page({
800 item=item.config; 800 item=item.config;
801 if (item == null) return o_shipping_price; 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 fw_price =parseFloat(item['money']); 804 fw_price =parseFloat(item['money']);
805 if (goods_weight > item['first_weight']){ 805 if (goods_weight > item['first_weight']){
806 var fw = goods_weight - item['first_weight']; 806 var fw = goods_weight - item['first_weight'];
@@ -809,7 +809,7 @@ Page({ @@ -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 fw_price = parseFloat(item['money']); 813 fw_price = parseFloat(item['money']);
814 var out_of_weight = Math.abs(out_of_weight); 814 var out_of_weight = Math.abs(out_of_weight);
815 if (out_of_weight > item['first_weight']) { 815 if (out_of_weight > item['first_weight']) {
@@ -819,7 +819,7 @@ Page({ @@ -819,7 +819,7 @@ Page({
819 } 819 }
820 } 820 }
821 //------按件数---------- 821 //------按件数----------
822 - if (goods_piece > 0) { 822 + if (goods_piece > 0 ) {
823 fp_price = parseFloat(item['piecemoney']); 823 fp_price = parseFloat(item['piecemoney']);
824 if (goods_piece > item['first_piece']) { 824 if (goods_piece > item['first_piece']) {
825 var fp = goods_piece - item['first_piece']; 825 var fp = goods_piece - item['first_piece'];
pages/cart/cart_wk/cart_wk.js
@@ -420,7 +420,7 @@ Page({ @@ -420,7 +420,7 @@ 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,goods_weight = -1,goods_piece = -1; 423 + var o_shipping_price = 0,goods_weight = -1,goods_piece = -1,good=th.data.goods;
424 var out_of_weight=null; //超出多少重量 424 var out_of_weight=null; //超出多少重量
425 var freight_free = ee.freight_free; //全场满多少包邮 425 var freight_free = ee.freight_free; //全场满多少包邮
426 var weight_free = ee.weight_free; //多少kg内包邮 426 var weight_free = ee.weight_free; //多少kg内包邮
@@ -486,7 +486,7 @@ Page({ @@ -486,7 +486,7 @@ Page({
486 item = item.config; 486 item = item.config;
487 if (item == null) return o_shipping_price; 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 fw_price = parseFloat(item['money']); 490 fw_price = parseFloat(item['money']);
491 if (goods_weight > item['first_weight']) { 491 if (goods_weight > item['first_weight']) {
492 var fw = goods_weight - item['first_weight']; 492 var fw = goods_weight - item['first_weight'];
@@ -495,7 +495,7 @@ Page({ @@ -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 fw_price = parseFloat(item['money']); 499 fw_price = parseFloat(item['money']);
500 var out_of_weight = Math.abs(out_of_weight); 500 var out_of_weight = Math.abs(out_of_weight);
501 if (out_of_weight > item['first_weight']) { 501 if (out_of_weight > item['first_weight']) {