Commit 8e36b8ee2c0517b0e3c5b1d206031e0b45d39496

Authored by yvan.ni
1 parent 85367453

购物车结算运费的计算的优化

Showing 1 changed file with 15 additions and 9 deletions
pages/cart/cart2/cart2.js
@@ -1609,11 +1609,15 @@ Page({ @@ -1609,11 +1609,15 @@ Page({
1609 //累积商品重量 每种商品的重量 * 数量 1609 //累积商品重量 每种商品的重量 * 数量
1610 goods_weight += item[jo]['weight'] * item[jo]['goods_num']; 1610 goods_weight += item[jo]['weight'] * item[jo]['goods_num'];
1611 by_g_weight+=item[jo]['weight'] * item[jo]['goods_num']; 1611 by_g_weight+=item[jo]['weight'] * item[jo]['goods_num'];
1612 - if (weight_free > 0) {  
1613 - out_of_weight = (weight_free * 1000) - by_g_weight;  
1614 - }else{  
1615 - out_of_weight= -by_g_weight; 1612 +
  1613 + if(free1>0){
  1614 + if (weight_free > 0) {
  1615 + out_of_weight = (weight_free * 1000) - by_g_weight;
  1616 + }else{
  1617 + out_of_weight= -by_g_weight;
  1618 + }
1616 } 1619 }
  1620 +
1617 } 1621 }
1618 } 1622 }
1619 //这个是在不包邮列表礼包 1623 //这个是在不包邮列表礼包
@@ -1629,11 +1633,13 @@ Page({ @@ -1629,11 +1633,13 @@ Page({
1629 } 1633 }
1630 } 1634 }
1631 1635
1632 - //当商品没有超出的时候  
1633 - if(out_of_weight>=0){  
1634 - out_of_weight= -by_g_weight;  
1635 - }else{  
1636 - out_of_weight= -weight_free * 1000; 1636 + if(free1>0) {
  1637 + //当商品没有超出的时候
  1638 + if (out_of_weight >= 0) {
  1639 + out_of_weight = -by_g_weight;
  1640 + } else {
  1641 + if (weight_free > 0) out_of_weight = -weight_free * 1000;
  1642 + }
1637 } 1643 }
1638 1644
1639 //所有的商品都不在不包邮商品列表,freight_free为0的时候,以及不是区域包邮 1645 //所有的商品都不在不包邮商品列表,freight_free为0的时候,以及不是区域包邮