Commit b2fcca429a8259ba764c195516237969ce3b811c
Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev
Showing
6 changed files
with
28 additions
and
18 deletions
packageB/pages/zuhegou/index/index.js
| @@ -1599,12 +1599,12 @@ Page({ | @@ -1599,12 +1599,12 @@ Page({ | ||
| 1599 | } | 1599 | } |
| 1600 | if (item.num > item.zhqty) { | 1600 | if (item.num > item.zhqty) { |
| 1601 | for (var i = 0; i < item.num - item.zhqty; i++) { | 1601 | for (var i = 0; i < item.num - item.zhqty; i++) { |
| 1602 | - no_in_arr.push({price: item.current_price}) | 1602 | + no_in_arr.push({price: item.current_price,goods_id:item.goods_id}); |
| 1603 | } | 1603 | } |
| 1604 | } | 1604 | } |
| 1605 | } else { | 1605 | } else { |
| 1606 | for (var j = 0; j < item.num; j++) { | 1606 | for (var j = 0; j < item.num; j++) { |
| 1607 | - no_in_arr.push({price: item.current_price}) | 1607 | + no_in_arr.push({price: item.current_price,goods_id:item.goods_id}); |
| 1608 | } | 1608 | } |
| 1609 | } | 1609 | } |
| 1610 | } else { | 1610 | } else { |
| @@ -1615,7 +1615,7 @@ Page({ | @@ -1615,7 +1615,7 @@ Page({ | ||
| 1615 | //当满足组合的要求:总数要满足,起购数要满足 | 1615 | //当满足组合的要求:总数要满足,起购数要满足 |
| 1616 | if (all_num >= this.data.act.zhbuyqty && !need_to_buy) { | 1616 | if (all_num >= this.data.act.zhbuyqty && !need_to_buy) { |
| 1617 | function sortData(a, b) { | 1617 | function sortData(a, b) { |
| 1618 | - return a.price - b.price | 1618 | + return b.price - a.price |
| 1619 | } | 1619 | } |
| 1620 | 1620 | ||
| 1621 | no_in_arr.sort(sortData); | 1621 | no_in_arr.sort(sortData); |
pages/cart/cart/zh_calculate.js
| @@ -87,8 +87,8 @@ module.exports = { | @@ -87,8 +87,8 @@ module.exports = { | ||
| 87 | var goods = zh_prom_goods[act.id]; | 87 | var goods = zh_prom_goods[act.id]; |
| 88 | //寻找一下 | 88 | //寻找一下 |
| 89 | function get_num(ite) { | 89 | function get_num(ite) { |
| 90 | - for (let v1 in car_item.goods) { | ||
| 91 | - var vh = car_item.goods[v1]; | 90 | + for (let v1 in bitem.goods) { |
| 91 | + var vh = bitem.goods[v1]; | ||
| 92 | if (vh.goods_id == ite.goods_id) { | 92 | if (vh.goods_id == ite.goods_id) { |
| 93 | return vh; | 93 | return vh; |
| 94 | } | 94 | } |
| @@ -96,6 +96,17 @@ module.exports = { | @@ -96,6 +96,17 @@ module.exports = { | ||
| 96 | return 0; | 96 | return 0; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | + //寻找一下 | ||
| 100 | + function get_num2(ite) { | ||
| 101 | + for (let v2 in car_item.goods) { | ||
| 102 | + var vh = car_item.goods[v2]; | ||
| 103 | + if (vh.goods_id == ite.goods_id) { | ||
| 104 | + return vh; | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + return 0; | ||
| 108 | + } | ||
| 109 | + | ||
| 99 | for (var i in goods) { | 110 | for (var i in goods) { |
| 100 | var item = goods[i]; | 111 | var item = goods[i]; |
| 101 | item.num = get_num(item).goods_num; | 112 | item.num = get_num(item).goods_num; |
| @@ -114,14 +125,14 @@ module.exports = { | @@ -114,14 +125,14 @@ module.exports = { | ||
| 114 | if (item.num > item.zhqty) { | 125 | if (item.num > item.zhqty) { |
| 115 | for (var i = 0; i < item.num - item.zhqty; i++) { | 126 | for (var i = 0; i < item.num - item.zhqty; i++) { |
| 116 | no_in_arr.push({ | 127 | no_in_arr.push({ |
| 117 | - price: item.goods_price,offline_price:item.offline_price | 128 | + price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id |
| 118 | }) | 129 | }) |
| 119 | } | 130 | } |
| 120 | } | 131 | } |
| 121 | } else { | 132 | } else { |
| 122 | for (var j = 0; j < item.num; j++) { | 133 | for (var j = 0; j < item.num; j++) { |
| 123 | no_in_arr.push({ | 134 | no_in_arr.push({ |
| 124 | - price: item.goods_price,offline_price:item.offline_price | 135 | + price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id |
| 125 | }) | 136 | }) |
| 126 | } | 137 | } |
| 127 | } | 138 | } |
| @@ -136,7 +147,7 @@ module.exports = { | @@ -136,7 +147,7 @@ module.exports = { | ||
| 136 | //当满足组合的要求:总数要满足,起购数要满足 | 147 | //当满足组合的要求:总数要满足,起购数要满足 |
| 137 | if (all_num >= act.zhbuyqty && !need_to_buy) { | 148 | if (all_num >= act.zhbuyqty && !need_to_buy) { |
| 138 | function sortData(a, b) { | 149 | function sortData(a, b) { |
| 139 | - return a.price - b.price | 150 | + return b.price - a.price |
| 140 | } | 151 | } |
| 141 | 152 | ||
| 142 | no_in_arr.sort(sortData); | 153 | no_in_arr.sort(sortData); |
| @@ -159,7 +170,7 @@ module.exports = { | @@ -159,7 +170,7 @@ module.exports = { | ||
| 159 | if (no_in_arr.length) { | 170 | if (no_in_arr.length) { |
| 160 | for (var ii in no_in_arr) { | 171 | for (var ii in no_in_arr) { |
| 161 | var item = no_in_arr[ii]; | 172 | var item = no_in_arr[ii]; |
| 162 | - var gitem=get_num(item); | 173 | + var gitem=get_num2(item); |
| 163 | if(gitem) { | 174 | if(gitem) { |
| 164 | if (!gitem.need_downlow_num) { | 175 | if (!gitem.need_downlow_num) { |
| 165 | gitem.need_downlow_num = 1; | 176 | gitem.need_downlow_num = 1; |
| @@ -190,9 +201,7 @@ module.exports = { | @@ -190,9 +201,7 @@ module.exports = { | ||
| 190 | } else { | 201 | } else { |
| 191 | for (var ii in goods) { | 202 | for (var ii in goods) { |
| 192 | var item = goods[ii]; | 203 | var item = goods[ii]; |
| 193 | - | ||
| 194 | - | ||
| 195 | - var gitem=get_num(item); | 204 | + var gitem=get_num2(item); |
| 196 | if(gitem) { | 205 | if(gitem) { |
| 197 | gitem.need_downlow_num = item.num; | 206 | gitem.need_downlow_num = item.num; |
| 198 | 207 |
pages/cart/cart2/zh_calculate.js
| @@ -65,7 +65,7 @@ module.exports = { | @@ -65,7 +65,7 @@ module.exports = { | ||
| 65 | //当满足组合的要求:总数要满足,起购数要满足 | 65 | //当满足组合的要求:总数要满足,起购数要满足 |
| 66 | if (all_num >= act.zhbuyqty && !need_to_buy) { | 66 | if (all_num >= act.zhbuyqty && !need_to_buy) { |
| 67 | function sortData(a, b) { | 67 | function sortData(a, b) { |
| 68 | - return a.price - b.price | 68 | + return b.price - a.price |
| 69 | } | 69 | } |
| 70 | no_in_arr.sort(sortData); | 70 | no_in_arr.sort(sortData); |
| 71 | aprice = act.zhprice; | 71 | aprice = act.zhprice; |
pages/cart/cart2_pt/cart2_pt.js
| @@ -153,6 +153,7 @@ Page({ | @@ -153,6 +153,7 @@ Page({ | ||
| 153 | if (su.data.code == 0) { | 153 | if (su.data.code == 0) { |
| 154 | var yuer = parseFloat(th.data.userinfo.user_money - | 154 | var yuer = parseFloat(th.data.userinfo.user_money - |
| 155 | (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2); | 155 | (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2); |
| 156 | + if(yuer<0) yuer=0; | ||
| 156 | th.setData({ txmon: su.data.data.summoney, yuer: yuer }); | 157 | th.setData({ txmon: su.data.data.summoney, yuer: yuer }); |
| 157 | } | 158 | } |
| 158 | } | 159 | } |
| @@ -451,13 +452,13 @@ Page({ | @@ -451,13 +452,13 @@ Page({ | ||
| 451 | var txt = "formData.user_money"; | 452 | var txt = "formData.user_money"; |
| 452 | var txt2 = "formData.order_amount"; | 453 | var txt2 = "formData.order_amount"; |
| 453 | //--------------如果使用余额--------------------- | 454 | //--------------如果使用余额--------------------- |
| 454 | - if (th.data.bn_use_money == 1) { | 455 | + if (th.data.bn_use_money == 1 && th.data.yuer>0) { |
| 455 | if ( parseFloat(th.data.yuer) > total_m) { | 456 | if ( parseFloat(th.data.yuer) > total_m) { |
| 456 | th.setData({ [txt]: total_m, [txt2]:0 }) | 457 | th.setData({ [txt]: total_m, [txt2]:0 }) |
| 457 | }else{ | 458 | }else{ |
| 458 | order_m = parseFloat(order_m) - parseFloat(th.data.yuer); | 459 | order_m = parseFloat(order_m) - parseFloat(th.data.yuer); |
| 459 | order_m = order_m.toFixed(2); | 460 | order_m = order_m.toFixed(2); |
| 460 | - th.setData({ [txt]: th.data.userinfo.yuer, [txt2]: order_m }) | 461 | + th.setData({ [txt]: th.data.yuer, [txt2]: order_m }) |
| 461 | } | 462 | } |
| 462 | }else{ | 463 | }else{ |
| 463 | th.setData({ [txt]: 0, [txt2]: order_m }) | 464 | th.setData({ [txt]: 0, [txt2]: order_m }) |
pages/cart/cart2_pt/cart2_pt.wxml
| @@ -125,7 +125,7 @@ | @@ -125,7 +125,7 @@ | ||
| 125 | 125 | ||
| 126 | <view class="information bdr14"> | 126 | <view class="information bdr14"> |
| 127 | <!-----使用余额------> | 127 | <!-----使用余额------> |
| 128 | - <view class="set-mes" wx:if="{{userinfo.user_money>0}}"> | 128 | + <view class="set-mes" wx:if="{{userinfo.user_money>0 && yuer>0}}"> |
| 129 | <view class="use-item" bindtap='set_bn_useyuer' style="padding-left:0;padding-right:0;"> | 129 | <view class="use-item" bindtap='set_bn_useyuer' style="padding-left:0;padding-right:0;"> |
| 130 | <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon> | 130 | <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon> |
| 131 | <view class="yu_er">使用余额 :¥{{yuer}} </view> | 131 | <view class="yu_er">使用余额 :¥{{yuer}} </view> |
pages/goods/categoryList/categoryList.wxml
| @@ -196,7 +196,7 @@ | @@ -196,7 +196,7 @@ | ||
| 196 | <block wx:for="{{groups}}" wx:for-item="brand_list" wx:for-index="pidx"> | 196 | <block wx:for="{{groups}}" wx:for-item="brand_list" wx:for-index="pidx"> |
| 197 | <view class="brand_img_frame" wx:for="{{brand_list.array}}" wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}" > | 197 | <view class="brand_img_frame" wx:for="{{brand_list.array}}" wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}" > |
| 198 | 198 | ||
| 199 | - <view class="brand_img t-c"> | 199 | + <view class="t-c"> |
| 200 | <image class="brand_img" src="{{user.logo}}" data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr_pp"></image> | 200 | <image class="brand_img" src="{{user.logo}}" data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr_pp"></image> |
| 201 | <view class="brand_img_name ellipsis-1 fs24">{{user.name}}</view> | 201 | <view class="brand_img_name ellipsis-1 fs24">{{user.name}}</view> |
| 202 | </view> | 202 | </view> |
| @@ -381,7 +381,7 @@ | @@ -381,7 +381,7 @@ | ||
| 381 | <block wx:for="{{groups}}" wx:for-item="brand_list" wx:for-index="pidx"> | 381 | <block wx:for="{{groups}}" wx:for-item="brand_list" wx:for-index="pidx"> |
| 382 | <view class="brand_img_frame "wx:for="{{brand_list.array}}" wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}" > | 382 | <view class="brand_img_frame "wx:for="{{brand_list.array}}" wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}" > |
| 383 | 383 | ||
| 384 | - <view class="brand_img t-c"> | 384 | + <view class="t-c"> |
| 385 | <image class=" brand_img" src="{{user.logo}}" data-pix="{{pidx}}" data-idx="{{idx}}" data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr_pp"></image> | 385 | <image class=" brand_img" src="{{user.logo}}" data-pix="{{pidx}}" data-idx="{{idx}}" data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr_pp"></image> |
| 386 | <view class="brand_img_name ellipsis-1 fs24">{{user.name}}</view> | 386 | <view class="brand_img_name ellipsis-1 fs24">{{user.name}}</view> |
| 387 | </view> | 387 | </view> |