diff --git a/packageB/pages/zuhegou/index/index.js b/packageB/pages/zuhegou/index/index.js index ee2ceb0..03f88c1 100644 --- a/packageB/pages/zuhegou/index/index.js +++ b/packageB/pages/zuhegou/index/index.js @@ -1599,12 +1599,12 @@ Page({ } if (item.num > item.zhqty) { for (var i = 0; i < item.num - item.zhqty; i++) { - no_in_arr.push({price: item.current_price}) + no_in_arr.push({price: item.current_price,goods_id:item.goods_id}); } } } else { for (var j = 0; j < item.num; j++) { - no_in_arr.push({price: item.current_price}) + no_in_arr.push({price: item.current_price,goods_id:item.goods_id}); } } } else { @@ -1615,7 +1615,7 @@ Page({ //当满足组合的要求:总数要满足,起购数要满足 if (all_num >= this.data.act.zhbuyqty && !need_to_buy) { function sortData(a, b) { - return a.price - b.price + return b.price - a.price } no_in_arr.sort(sortData); diff --git a/pages/cart/cart/zh_calculate.js b/pages/cart/cart/zh_calculate.js index b55ff21..5f5e35e 100644 --- a/pages/cart/cart/zh_calculate.js +++ b/pages/cart/cart/zh_calculate.js @@ -87,8 +87,8 @@ module.exports = { var goods = zh_prom_goods[act.id]; //寻找一下 function get_num(ite) { - for (let v1 in car_item.goods) { - var vh = car_item.goods[v1]; + for (let v1 in bitem.goods) { + var vh = bitem.goods[v1]; if (vh.goods_id == ite.goods_id) { return vh; } @@ -96,6 +96,17 @@ module.exports = { return 0; } + //寻找一下 + function get_num2(ite) { + for (let v2 in car_item.goods) { + var vh = car_item.goods[v2]; + if (vh.goods_id == ite.goods_id) { + return vh; + } + } + return 0; + } + for (var i in goods) { var item = goods[i]; item.num = get_num(item).goods_num; @@ -114,14 +125,14 @@ module.exports = { if (item.num > item.zhqty) { for (var i = 0; i < item.num - item.zhqty; i++) { no_in_arr.push({ - price: item.goods_price,offline_price:item.offline_price + price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id }) } } } else { for (var j = 0; j < item.num; j++) { no_in_arr.push({ - price: item.goods_price,offline_price:item.offline_price + price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id }) } } @@ -136,7 +147,7 @@ module.exports = { //当满足组合的要求:总数要满足,起购数要满足 if (all_num >= act.zhbuyqty && !need_to_buy) { function sortData(a, b) { - return a.price - b.price + return b.price - a.price } no_in_arr.sort(sortData); @@ -159,7 +170,7 @@ module.exports = { if (no_in_arr.length) { for (var ii in no_in_arr) { var item = no_in_arr[ii]; - var gitem=get_num(item); + var gitem=get_num2(item); if(gitem) { if (!gitem.need_downlow_num) { gitem.need_downlow_num = 1; @@ -190,9 +201,7 @@ module.exports = { } else { for (var ii in goods) { var item = goods[ii]; - - - var gitem=get_num(item); + var gitem=get_num2(item); if(gitem) { gitem.need_downlow_num = item.num; diff --git a/pages/cart/cart2/zh_calculate.js b/pages/cart/cart2/zh_calculate.js index 4824f9a..6c983b6 100644 --- a/pages/cart/cart2/zh_calculate.js +++ b/pages/cart/cart2/zh_calculate.js @@ -65,7 +65,7 @@ module.exports = { //当满足组合的要求:总数要满足,起购数要满足 if (all_num >= act.zhbuyqty && !need_to_buy) { function sortData(a, b) { - return a.price - b.price + return b.price - a.price } no_in_arr.sort(sortData); aprice = act.zhprice; diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js index a857563..56341a8 100644 --- a/pages/cart/cart2_pt/cart2_pt.js +++ b/pages/cart/cart2_pt/cart2_pt.js @@ -153,6 +153,7 @@ Page({ if (su.data.code == 0) { var yuer = parseFloat(th.data.userinfo.user_money - (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2); + if(yuer<0) yuer=0; th.setData({ txmon: su.data.data.summoney, yuer: yuer }); } } @@ -451,13 +452,13 @@ Page({ var txt = "formData.user_money"; var txt2 = "formData.order_amount"; //--------------如果使用余额--------------------- - if (th.data.bn_use_money == 1) { + if (th.data.bn_use_money == 1 && th.data.yuer>0) { if ( parseFloat(th.data.yuer) > total_m) { th.setData({ [txt]: total_m, [txt2]:0 }) }else{ order_m = parseFloat(order_m) - parseFloat(th.data.yuer); order_m = order_m.toFixed(2); - th.setData({ [txt]: th.data.userinfo.yuer, [txt2]: order_m }) + th.setData({ [txt]: th.data.yuer, [txt2]: order_m }) } }else{ th.setData({ [txt]: 0, [txt2]: order_m }) diff --git a/pages/cart/cart2_pt/cart2_pt.wxml b/pages/cart/cart2_pt/cart2_pt.wxml index 7935b30..bfb15a0 100644 --- a/pages/cart/cart2_pt/cart2_pt.wxml +++ b/pages/cart/cart2_pt/cart2_pt.wxml @@ -125,7 +125,7 @@ - + 使用余额 :¥{{yuer}} diff --git a/pages/goods/categoryList/categoryList.wxml b/pages/goods/categoryList/categoryList.wxml index 5980801..c043a2a 100644 --- a/pages/goods/categoryList/categoryList.wxml +++ b/pages/goods/categoryList/categoryList.wxml @@ -196,7 +196,7 @@ - + {{user.name}} @@ -381,7 +381,7 @@ - + {{user.name}}