Commit 2837777288d642400a4272220da80ff47e14cbc5
1 parent
49d6c6d5
oa单秒杀虚拟销量
Showing
4 changed files
with
27 additions
and
6 deletions
components/diy_seckill/diy_seckill.js
@@ -217,7 +217,28 @@ Component({ | @@ -217,7 +217,28 @@ Component({ | ||
217 | all_array[i].price_n = price | 217 | all_array[i].price_n = price |
218 | } | 218 | } |
219 | 219 | ||
220 | - all_array[i].residue=all_array[i].goods_num*1 - all_array[i].buy_num*1 | 220 | + let virtual = all_array[i].virtual ? all_array[i].virtual : 0 |
221 | + if (all_array[i].status) { | ||
222 | + if (all_array[i].is_virtual_count ) { | ||
223 | + // all_array[i].goods_num -= all_array[i].virtual | ||
224 | + all_array[i].buy_num += virtual*1 | ||
225 | + all_array[i].residue = all_array[i].goods_num*1 - all_array[i].buy_num*1 | ||
226 | + }else{ | ||
227 | + all_array[i].buy_num += virtual*1 | ||
228 | + all_array[i].residue=all_array[i].goods_num*1 + virtual*1 - all_array[i].buy_num*1 | ||
229 | + } | ||
230 | + }else{ | ||
231 | + if (all_array[i].is_virtual_count ) { | ||
232 | + // all_array[i].goods_num -= all_array[i].virtual | ||
233 | + all_array[i].buy_num = 0 | ||
234 | + all_array[i].residue = all_array[i].goods_num*1 - all_array[i].buy_num*1 | ||
235 | + }else{ | ||
236 | + all_array[i].buy_num = 0 | ||
237 | + all_array[i].residue=all_array[i].goods_num*1 + virtual*1 - all_array[i].buy_num*1 | ||
238 | + } | ||
239 | + } | ||
240 | + | ||
241 | + // all_array[i].residue=all_array[i].goods_num*1 - all_array[i].buy_num*1 | ||
221 | if (all_array[i].residue && all_array[i].residue > 0 && all_array[i].status !=2) { | 242 | if (all_array[i].residue && all_array[i].residue > 0 && all_array[i].status !=2) { |
222 | empty.push(all_array[i]) | 243 | empty.push(all_array[i]) |
223 | } | 244 | } |
packageA/pages/goodsInfo/goodsInfo.wxml
@@ -114,7 +114,7 @@ | @@ -114,7 +114,7 @@ | ||
114 | <block wx:if="{{prom_type==1}}"> | 114 | <block wx:if="{{prom_type==1}}"> |
115 | <view class="goods-num"> | 115 | <view class="goods-num"> |
116 | <block> | 116 | <block> |
117 | - <view class="stock">总数量:{{prom_act.goods_num+prom_act.virtual}}件</view> | 117 | + <view class="stock">总数量:{{prom_act.is_virtual_count ? prom_act.goods_num : (prom_act.goods_num+prom_act.virtual)}}件</view> |
118 | 118 | ||
119 | <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view> | 119 | <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view> |
120 | <view class="stock" wx:else>限购:不限</view> | 120 | <view class="stock" wx:else>限购:不限</view> |
pages/activity/seckill_list/seckill_list.wxml
@@ -46,9 +46,9 @@ | @@ -46,9 +46,9 @@ | ||
46 | <view class="xc-strip-blank rel"> | 46 | <view class="xc-strip-blank rel"> |
47 | 47 | ||
48 | <view class="flex-vertical rel total"> | 48 | <view class="flex-vertical rel total"> |
49 | - <view class="t-c abs xc-fill"style="width:{{type==1?(100-(item.buy_num+item.virtual) /(item.goods_num+item.virtual)*100)>3?(100-(item.buy_num+item.virtual) /(item.goods_num+item.virtual)*100):'3':'100'}}%;background:{{type==1?'#f23030':'#059de5'}};"> | 49 | + <view class="t-c abs xc-fill"style="width:{{type==1?(100-(item.buy_num+item.virtual) /((item.is_virtual_count ? item.goods_num : item.goods_num+item.virtual))*100)>3?(100-(item.buy_num+item.virtual) /((item.is_virtual_count ? item.goods_num : item.goods_num+item.virtual))*100):'3':'100'}}%;background:{{type==1?'#f23030':'#059de5'}};"> |
50 | </view> | 50 | </view> |
51 | - <text class="fs20 white abs xc-fill-text" style="">剩余{{type==1?filters.toFix(100-(item.buy_num+item.virtual)/(item.goods_num+item.virtual)*100,0):'100'}}%</text> | 51 | + <text class="fs20 white abs xc-fill-text" style="">剩余{{type==1?filters.toFix(100-(item.buy_num+item.virtual)/((item.is_virtual_count ? item.goods_num : item.goods_num+item.virtual))*100,0):'100'}}%</text> |
52 | </view> | 52 | </view> |
53 | 53 | ||
54 | </view> | 54 | </view> |
pages/goods/goodsInfo/goodsInfo.wxml
@@ -456,7 +456,7 @@ | @@ -456,7 +456,7 @@ | ||
456 | <view wx:if="{{prom_type==1}}"> | 456 | <view wx:if="{{prom_type==1}}"> |
457 | <view class="goods-num"> | 457 | <view class="goods-num"> |
458 | <block wx:if="prom_st>0"> | 458 | <block wx:if="prom_st>0"> |
459 | - <view class="stock">总数量:{{prom_act.goods_num+prom_act.virtual}}件</view> | 459 | + <view class="stock">总数量:{{prom_act.is_virtual_count ? prom_act.goods_num : (prom_act.goods_num+prom_act.virtual)}}件</view> |
460 | <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view> | 460 | <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view> |
461 | <view class="stock" wx:else>限购:不限</view> | 461 | <view class="stock" wx:else>限购:不限</view> |
462 | 462 | ||
@@ -1295,7 +1295,7 @@ | @@ -1295,7 +1295,7 @@ | ||
1295 | 已售:{{prom_act.buy_num+prom_act.virtual}} | 1295 | 已售:{{prom_act.buy_num+prom_act.virtual}} |
1296 | </view> | 1296 | </view> |
1297 | <view class="spec-goods-stock" wx:else>已售:{{prom_act.buy_num}}</view> | 1297 | <view class="spec-goods-stock" wx:else>已售:{{prom_act.buy_num}}</view> |
1298 | - <view class="spec-goods-stock">可售:{{prom_act.goods_num-prom_act.buy_num}}</view> | 1298 | + <view class="spec-goods-stock">可售:{{(prom_act.is_virtual_count && prom_act.virtual) ? (prom_act.goods_num - prom_act.buy_num - prom_act.virtual) : (prom_act.goods_num-prom_act.buy_num)}}</view> |
1299 | </view> | 1299 | </view> |
1300 | </block> | 1300 | </block> |
1301 | <block wx:if="{{prom_type==2}}"> | 1301 | <block wx:if="{{prom_type==2}}"> |