Commit b8b0fc6a9b85fe53f6bb70d10d188507c2cddcc7

Authored by yvan.ni
1 parent 147fdcc7

购买商品运费阶梯计算的优化

packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
@@ -537,11 +537,12 @@ Page({ @@ -537,11 +537,12 @@ Page({
537 var cut_good_weight = 0; 537 var cut_good_weight = 0;
538 for (let i in gd_arr_list) { 538 for (let i in gd_arr_list) {
539 let item = gd_arr_list[i]; 539 let item = gd_arr_list[i];
540 - if (back_data && back_data['is_by_all'] && !back_data.no_free_goods) {  
541 - continue;  
542 - }  
543 - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) {  
544 - if (item['exp_sum_type'] == 2) { 540 +
  541 + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
  542 +
  543 +
  544 + if (item['exp_sum_type'] == 2) {
  545 + goods_weight += item['weight'] * item['buynum'];
545 cut_good_weight += item['weight'] * item['buynum']; 546 cut_good_weight += item['weight'] * item['buynum'];
546 } 547 }
547 if (back_data.weight_free > 0) { 548 if (back_data.weight_free > 0) {
packageC/pages/presell/cart/cart.js
@@ -1821,12 +1821,11 @@ Page({ @@ -1821,12 +1821,11 @@ Page({
1821 var cut_good_weight = 0; 1821 var cut_good_weight = 0;
1822 for (let i in gd_arr_list) { 1822 for (let i in gd_arr_list) {
1823 let item = gd_arr_list[i]; 1823 let item = gd_arr_list[i];
1824 - if (back_data && back_data['is_by_all'] && !back_data.no_free_goods) {  
1825 - continue;  
1826 - }  
1827 - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { 1824 +
  1825 + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
1828 if (item['exp_sum_type'] == 2) { 1826 if (item['exp_sum_type'] == 2) {
1829 - cut_good_weight += item['weight'] * item['buynum']; 1827 + goods_weight += item['weight'] * item['buynum'];
  1828 + cut_good_weight += item['weight'] * item['buynum'];
1830 } 1829 }
1831 if (back_data.weight_free > 0) { 1830 if (back_data.weight_free > 0) {
1832 out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; 1831 out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
packageC/pages/presell/cart/cart2.js
@@ -697,10 +697,8 @@ Page({ @@ -697,10 +697,8 @@ Page({
697 var cut_good_weight = 0; 697 var cut_good_weight = 0;
698 for (let i in gd_arr_list) { 698 for (let i in gd_arr_list) {
699 let item = gd_arr_list[i]; 699 let item = gd_arr_list[i];
700 - if (back_data && back_data['is_by_all'] && !back_data.no_free_goods) {  
701 - continue;  
702 - }  
703 - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { 700 +
  701 + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
704 if (item['exp_sum_type'] == 2) { 702 if (item['exp_sum_type'] == 2) {
705 cut_good_weight += item['weight'] * item['buynum']; 703 cut_good_weight += item['weight'] * item['buynum'];
706 } 704 }
packageC/pages/presell/cart/cart2_pre.js
@@ -366,17 +366,17 @@ Page({ @@ -366,17 +366,17 @@ Page({
366 var cut_good_weight = 0; 366 var cut_good_weight = 0;
367 for (let i in gd_arr_list) { 367 for (let i in gd_arr_list) {
368 let item = data[i]; 368 let item = data[i];
369 - if (back_data && back_data['is_by_all'] && !back_data.no_free_goods) {  
370 - continue;  
371 - }  
372 - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { 369 +
  370 + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
373 if (item['exp_sum_type'] == 2) { 371 if (item['exp_sum_type'] == 2) {
374 - cut_good_weight += item['weight'] * item['buynum'];  
375 - }  
376 - if (back_data.weight_free > 0) {  
377 - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; 372 + goods_weight += item['weight'] * item['buynum'];
  373 + cut_good_weight += item['weight'] * item['buynum'];
378 } 374 }
379 - continue; 375 + if (back_data.weight_free > 0) {
  376 + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  377 + }
  378 + continue;
  379 +
380 } 380 }
381 381
382 switch (item['exp_sum_type']) { 382 switch (item['exp_sum_type']) {
pages/cart/cart2/cart2.js
@@ -1737,17 +1737,18 @@ Page({ @@ -1737,17 +1737,18 @@ Page({
1737 if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1 && th.data.is_quan_by[pickid]) { 1737 if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1 && th.data.is_quan_by[pickid]) {
1738 continue; 1738 continue;
1739 } 1739 }
1740 - if (back_data && back_data['is_by_all'] && !back_data.no_free_goods) {  
1741 - continue;  
1742 - }  
1743 - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item[j].goods_id) == -1) {  
1744 - if (item[j]['exp_sum_type'] == 2) { 1740 +
  1741 + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) {
  1742 +
  1743 + if (item[j]['exp_sum_type'] == 2) {
1745 cut_good_weight += item[j]['weight'] * item[j]['goods_num']; 1744 cut_good_weight += item[j]['weight'] * item[j]['goods_num'];
  1745 + goods_weight += item[j]['weight'] * item[j]['goods_num'];
1746 } 1746 }
1747 - if (back_data.weight_free > 0) {  
1748 - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;  
1749 - }  
1750 - continue; 1747 + if (back_data.weight_free > 0) {
  1748 + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  1749 + }
  1750 + continue;
  1751 +
1751 } 1752 }
1752 1753
1753 switch (item[j]['exp_sum_type']) { 1754 switch (item[j]['exp_sum_type']) {
@@ -2128,17 +2129,17 @@ Page({ @@ -2128,17 +2129,17 @@ Page({
2128 var cut_good_weight = 0; 2129 var cut_good_weight = 0;
2129 for (let i in gd_arr_list) { 2130 for (let i in gd_arr_list) {
2130 let item = gd_arr_list[i]; 2131 let item = gd_arr_list[i];
2131 - if (back_data && back_data['is_by_all']) {  
2132 - if(!back_data.no_free_goods || !back_data.no_free_goods.length) continue;  
2133 - }  
2134 - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { 2132 +
  2133 + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
2135 if (item['exp_sum_type'] == 2) { 2134 if (item['exp_sum_type'] == 2) {
2136 - cut_good_weight += item['weight'] * item['buynum'];  
2137 - }  
2138 - if (back_data.weight_free > 0) {  
2139 - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; 2135 + goods_weight += item['weight'] * item['buynum'];
  2136 + cut_good_weight += item['weight'] * item['buynum'];
2140 } 2137 }
2141 - continue; 2138 + if (back_data.weight_free > 0) {
  2139 + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  2140 + }
  2141 + continue;
  2142 +
2142 } 2143 }
2143 2144
2144 switch (item['exp_sum_type']) { 2145 switch (item['exp_sum_type']) {
pages/cart/cart2_inte/cart2_inte.js
@@ -451,12 +451,10 @@ Page({ @@ -451,12 +451,10 @@ Page({
451 var cut_good_weight = 0; 451 var cut_good_weight = 0;
452 for (let i in gd_arr_list) { 452 for (let i in gd_arr_list) {
453 let item = gd_arr_list[i]; 453 let item = gd_arr_list[i];
454 - if (back_data && back_data['is_by_all']) {  
455 - if(!back_data.no_free_goods || !back_data.no_free_goods.length) continue;  
456 - }  
457 -  
458 - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { 454 +
  455 + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1) ) {
459 if (item['exp_sum_type'] == 2) { 456 if (item['exp_sum_type'] == 2) {
  457 + goods_weight += item['weight'] * item['buynum'];
460 cut_good_weight += item['weight'] * item['buynum']; 458 cut_good_weight += item['weight'] * item['buynum'];
461 } 459 }
462 if (back_data.weight_free > 0) { 460 if (back_data.weight_free > 0) {
pages/cart/cart2_pt/cart2_pt.js
@@ -428,10 +428,8 @@ Page({ @@ -428,10 +428,8 @@ Page({
428 var cut_good_weight = 0; 428 var cut_good_weight = 0;
429 for (let i in gd_arr_list) { 429 for (let i in gd_arr_list) {
430 let item = gd_arr_list[i]; 430 let item = gd_arr_list[i];
431 - if (back_data && back_data['is_by_all'] && !back_data.no_free_goods) {  
432 - continue;  
433 - }  
434 - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { 431 +
  432 + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
435 if (item['exp_sum_type'] == 2) { 433 if (item['exp_sum_type'] == 2) {
436 cut_good_weight += item['weight'] * item['buynum']; 434 cut_good_weight += item['weight'] * item['buynum'];
437 } 435 }
pages/cart/cart_wk/cart_wk.js
@@ -491,12 +491,11 @@ Page({ @@ -491,12 +491,11 @@ Page({
491 var cut_good_weight = 0; 491 var cut_good_weight = 0;
492 for (let i in gd_arr_list) { 492 for (let i in gd_arr_list) {
493 let item = gd_arr_list[i]; 493 let item = gd_arr_list[i];
494 - if (back_data && back_data['is_by_all']) {  
495 - if(!back_data.no_free_goods || !back_data.no_free_goods.length) continue;  
496 - }  
497 - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { 494 +
  495 + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
498 if (item['exp_sum_type'] == 2) { 496 if (item['exp_sum_type'] == 2) {
499 - cut_good_weight += item['weight'] * item['buynum']; 497 + goods_weight += item['weight'] * item['buynum'];
  498 + cut_good_weight += item['weight'] * item['buynum'];
500 } 499 }
501 if (back_data.weight_free > 0) { 500 if (back_data.weight_free > 0) {
502 out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; 501 out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;