diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 2d87157..a3088b6 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -699,7 +699,7 @@ Page({ //有活动,且优惠活动并没有限制使用优惠券,且有减价 //--看有没有减价-- - if(item_map.prom_price && item_map.price-item_map.prom_price){ + if(item_map.prom_price>=0 && item_map.price-item_map.prom_price){ if(cart_item.prom_pt_json){ cart_item.prom_pt_json.push({"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}) }else{ @@ -743,7 +743,7 @@ Page({ var m_item = item_map.goods[i]; var m_all_amount = m_item.goods_price * m_item.goods_num - m_item.goods_price * m_item.goods_num * per; var account = Math.floor(100 * m_all_amount /m_item.goods_num) / 100; - if (account) { + if (account>=0) { item_map.goods[i].account = account; account_all += account * m_item.goods_num; //累加总实收 } @@ -1540,6 +1540,7 @@ Page({ //比例太小不平摊 if(per<0.001){ goods.account_yu=th.data.formData.cut_price; + item.is_discount_amount=1; }else{ per=Math.floor(per*1000)/1000; var all_amount=goods.goods_price*goods.goods_num-goods.goods_price*goods.goods_num*per; //商品总实收 @@ -1547,6 +1548,7 @@ Page({ var account_yu=account*goods.goods_num-(goods.goods_price*goods.goods_num-th.data.formData.cut_price); //算出余数 goods.account=account; goods.account_yu=parseFloat(account_yu.toFixed(2)); + item.is_discount_amount=1; } } item.order_goods.push(goods); @@ -1672,9 +1674,10 @@ Page({ }; //把优惠的平摊结果写进去 - if(g_item.account){ - goods.account=g_item.account; - goods.account_yu=g_item.account_yu; + if(g_item.account>=0 || g_item.account_yu>0){ + if(g_item.account>=0) goods.account=g_item.account; + if(g_item.account_yu>=0) goods.account_yu=g_item.account_yu; + item.is_discount_amount=1; } //--把券的钱,写入从表--- @@ -1756,7 +1759,7 @@ Page({ if (pdata.length==0) return; var str = JSON.stringify(pdata); - + wx.showLoading({title: "加载中"}); wx.request({ url: oo.url + '/api/weshop/order/createWxdOrder',