Commit 180a315717f89d629bc0c47fe53c09e2d4cb4fb8
1 parent
10b1249e
秒杀和商品的切换的bug优化
Showing
2 changed files
with
71 additions
and
34 deletions
pages/goods/goodsInfo/goodsInfo.js
@@ -151,6 +151,7 @@ Page({ | @@ -151,6 +151,7 @@ Page({ | ||
151 | prom_type: 0, | 151 | prom_type: 0, |
152 | prom_time_text: "", | 152 | prom_time_text: "", |
153 | prom_price: null, | 153 | prom_price: null, |
154 | + f_prom_price: null, //秒杀使用 | ||
154 | prom_buy_limit: 0, | 155 | prom_buy_limit: 0, |
155 | djs: null, | 156 | djs: null, |
156 | prom_st: 0, | 157 | prom_st: 0, |
@@ -4846,6 +4847,7 @@ Page({ | @@ -4846,6 +4847,7 @@ Page({ | ||
4846 | 4847 | ||
4847 | ee.setData({ | 4848 | ee.setData({ |
4848 | prom_price: t.data.data.user_price, | 4849 | prom_price: t.data.data.user_price, |
4850 | + f_prom_price: t.data.data.user_price, | ||
4849 | prom_type: 1, | 4851 | prom_type: 1, |
4850 | prom_id: prom_id, | 4852 | prom_id: prom_id, |
4851 | prom_buy_limit: t.data.data.buy_limit, | 4853 | prom_buy_limit: t.data.data.buy_limit, |
@@ -8287,11 +8289,23 @@ Page({ | @@ -8287,11 +8289,23 @@ Page({ | ||
8287 | th.data.collocationGoods = r_data.collocationPromList; | 8289 | th.data.collocationGoods = r_data.collocationPromList; |
8288 | th.data.prom_goods = r_data.promGoodsLists; | 8290 | th.data.prom_goods = r_data.promGoodsLists; |
8289 | } else { | 8291 | } else { |
8290 | - th.setData({ | ||
8291 | - order_prom: r_data.promOrder, | ||
8292 | - collocationGoods: r_data.collocationPromList, | ||
8293 | - prom_goods: r_data.promGoodsLists, | ||
8294 | - }) | 8292 | + |
8293 | + if(gid==th.data.front_g){ | ||
8294 | + th.setData({ | ||
8295 | + order_prom: r_data.promOrder, | ||
8296 | + f_order_prom: r_data.promOrder, | ||
8297 | + collocationGoods: r_data.collocationPromList, | ||
8298 | + prom_goods: r_data.promGoodsLists, | ||
8299 | + }) | ||
8300 | + }else{ | ||
8301 | + th.setData({ | ||
8302 | + order_prom: r_data.promOrder, | ||
8303 | + collocationGoods: r_data.collocationPromList, | ||
8304 | + prom_goods: r_data.promGoodsLists, | ||
8305 | + }) | ||
8306 | + } | ||
8307 | + | ||
8308 | + | ||
8295 | } | 8309 | } |
8296 | 8310 | ||
8297 | 8311 | ||
@@ -8397,9 +8411,21 @@ Page({ | @@ -8397,9 +8411,21 @@ Page({ | ||
8397 | //使用sort排序 | 8411 | //使用sort排序 |
8398 | ppdata.sort(comp); | 8412 | ppdata.sort(comp); |
8399 | 8413 | ||
8400 | - th.setData({ | ||
8401 | - cx_prom_group: ppdata | ||
8402 | - }) | 8414 | + |
8415 | + //-- 如果是前端商品的时候 -- | ||
8416 | + if(th.data.sele_g.goods_id==th.data.front_g.goods_id){ | ||
8417 | + th.setData({ | ||
8418 | + cx_prom_group: ppdata, | ||
8419 | + f_cx_prom_group: ppdata, | ||
8420 | + }) | ||
8421 | + | ||
8422 | + }else{ | ||
8423 | + th.setData({ | ||
8424 | + cx_prom_group: ppdata | ||
8425 | + }) | ||
8426 | + } | ||
8427 | + | ||
8428 | + | ||
8403 | 8429 | ||
8404 | }) | 8430 | }) |
8405 | }, | 8431 | }, |
@@ -8854,9 +8880,20 @@ Page({ | @@ -8854,9 +8880,20 @@ Page({ | ||
8854 | // th.data.prom_type = new_arr[0].prom_type; | 8880 | // th.data.prom_type = new_arr[0].prom_type; |
8855 | // } | 8881 | // } |
8856 | 8882 | ||
8857 | - th.setData({ | ||
8858 | - more_flash: new_arr | ||
8859 | - }); | 8883 | + //-- 如果是前端商品的时候 -- |
8884 | + if(gid==th.data.front_g.goods_id){ | ||
8885 | + th.setData({ | ||
8886 | + more_flash: new_arr, | ||
8887 | + f_more_flash: new_arr, | ||
8888 | + }); | ||
8889 | + | ||
8890 | + }else{ | ||
8891 | + th.setData({ | ||
8892 | + more_flash: new_arr | ||
8893 | + }); | ||
8894 | + } | ||
8895 | + | ||
8896 | + | ||
8860 | } | 8897 | } |
8861 | }) | 8898 | }) |
8862 | }, | 8899 | }, |
pages/goods/goodsInfo/goodsInfo.wxml
@@ -83,34 +83,35 @@ | @@ -83,34 +83,35 @@ | ||
83 | </view> | 83 | </view> |
84 | </view> | 84 | </view> |
85 | 85 | ||
86 | - <!-- --显示秒杀价 --> | 86 | + <!-- --显示秒杀的定时器 --> |
87 | <view class="prom_show rel" wx:if="{{prom_type==1}}"> | 87 | <view class="prom_show rel" wx:if="{{prom_type==1}}"> |
88 | - <image class="secondkill-img" src='{{prom_st==1? iurl+"/miniapp/images/red_jx.png":iurl+"/miniapp/images/blue_ks.png"}}'></image> | 88 | + <image class="secondkill-img" src='{{f_prom_st==1? iurl+"/miniapp/images/red_jx.png":iurl+"/miniapp/images/blue_ks.png"}}'></image> |
89 | <image class="abs spike-img" src="{{iurl}}/miniapp/images/xsmiaosha.png"></image> | 89 | <image class="abs spike-img" src="{{iurl}}/miniapp/images/xsmiaosha.png"></image> |
90 | - <view class="stop fs26 abs" wx:if="{{prom_st==1}}">距活动结束还有</view> | ||
91 | - <view class="start fs26 abs" wx:if="{{prom_st==2}}">距活动开始还有</view> | 90 | + <view class="stop fs26 abs" wx:if="{{f_prom_st==1}}">距活动结束还有</view> |
91 | + <view class="start fs26 abs" wx:if="{{f_prom_st==2}}">距活动开始还有</view> | ||
92 | <view class="secview flex abs fs24 xc-miaosha-time"> | 92 | <view class="secview flex abs fs24 xc-miaosha-time"> |
93 | <block wx:if="djs.day"> | 93 | <block wx:if="djs.day"> |
94 | - <view class='day-val' style="color:{{prom_st==1?'#d40022':'#0097e0'}}"> | 94 | + <view class='day-val' style="color:{{f_prom_st==1?'#d40022':'#0097e0'}}"> |
95 | {{djs.day}} | 95 | {{djs.day}} |
96 | </view> | 96 | </view> |
97 | - <view class="day white" style="color: {{prom_st==1?'#d40022':'#0097e0'}}">天</view> | 97 | + <view class="day white" style="color: {{f_prom_st==1?'#d40022':'#0097e0'}}">天</view> |
98 | </block> | 98 | </block> |
99 | - <view class='time-val white t-c' style=" background:{{prom_st==1?'#d40022':'#0097e0'}}"> | 99 | + <view class='time-val white t-c' style=" background:{{f_prom_st==1?'#d40022':'#0097e0'}}"> |
100 | {{djs.hou}} | 100 | {{djs.hou}} |
101 | </view> | 101 | </view> |
102 | - <view class="time" style="color: {{prom_st==1?'#d40022':'#0097e0'}}">时</view> | ||
103 | - <view class='time-val white t-c' style=" background:{{prom_st==1?'#d40022':'#0097e0'}}"> | 102 | + <view class="time" style="color: {{f_prom_st==1?'#d40022':'#0097e0'}}">时</view> |
103 | + <view class='time-val white t-c' style=" background:{{f_prom_st==1?'#d40022':'#0097e0'}}"> | ||
104 | {{djs.min}} | 104 | {{djs.min}} |
105 | </view> | 105 | </view> |
106 | - <view class="time" style="color: {{prom_st==1?'#d40022':'#0097e0'}}">分</view> | ||
107 | - <view class='time-val white t-c' style="background:{{prom_st==1?'#d40022':'#0097e0'}}"> | 106 | + <view class="time" style="color: {{f_prom_st==1?'#d40022':'#0097e0'}}">分</view> |
107 | + <view class='time-val white t-c' style="background:{{f_prom_st==1?'#d40022':'#0097e0'}}"> | ||
108 | {{djs.sec}} | 108 | {{djs.sec}} |
109 | </view> | 109 | </view> |
110 | - <view class="time" style="color: {{prom_st==1?'#d40022':'#0097e0'}}">秒</view> | 110 | + <view class="time" style="color: {{f_prom_st==1?'#d40022':'#0097e0'}}">秒</view> |
111 | </view> | 111 | </view> |
112 | </view> | 112 | </view> |
113 | - <!-- --显示团购价 --> | 113 | + |
114 | + <!-- --显示团购价和剩余时间 --> | ||
114 | <view class="prom_show rel" wx:if="{{prom_type==2}}"> | 115 | <view class="prom_show rel" wx:if="{{prom_type==2}}"> |
115 | 116 | ||
116 | <view class="abs flex fs36" style="align-items:flex-end;color: #fff; margin-top: 34rpx; margin-left: 10rpx; height: 60rpx">¥{{prom_price}} | 117 | <view class="abs flex fs36" style="align-items:flex-end;color: #fff; margin-top: 34rpx; margin-left: 10rpx; height: 60rpx">¥{{prom_price}} |
@@ -437,7 +438,7 @@ | @@ -437,7 +438,7 @@ | ||
437 | <view class="flex" style="align-items: baseline;"> | 438 | <view class="flex" style="align-items: baseline;"> |
438 | <view class="flex xc-price-frame"> | 439 | <view class="flex xc-price-frame"> |
439 | <text class="fs30">¥</text> | 440 | <text class="fs30">¥</text> |
440 | - {{prom_price}} | 441 | + {{f_prom_price}} |
441 | </view> | 442 | </view> |
442 | <view wx:if="{{is_retail_price}}" class="word-line fs24 no_line_x">零售价:¥{{filters.toFix(front_g.market_price,2)}}</view> | 443 | <view wx:if="{{is_retail_price}}" class="word-line fs24 no_line_x">零售价:¥{{filters.toFix(front_g.market_price,2)}}</view> |
443 | <view wx:else class="word-line no_line_x fs24">¥{{filters.toFix(front_g.shop_price,2)}}</view> | 444 | <view wx:else class="word-line no_line_x fs24">¥{{filters.toFix(front_g.shop_price,2)}}</view> |
@@ -574,18 +575,17 @@ | @@ -574,18 +575,17 @@ | ||
574 | <!-- </view>--> | 575 | <!-- </view>--> |
575 | <!-- </view>--> | 576 | <!-- </view>--> |
576 | <!-- </block>--> | 577 | <!-- </block>--> |
577 | - | ||
578 | - | ||
579 | - <block wx:if="{{order_prom}}"> | 578 | + |
579 | + <block wx:if="{{f_order_prom}}"> | ||
580 | <view class="cx-frame flex" style="position: relative; height: auto"> | 580 | <view class="cx-frame flex" style="position: relative; height: auto"> |
581 | <view class="cx-sizs fs30 pdr20">订单优惠</view> | 581 | <view class="cx-sizs fs30 pdr20">订单优惠</view> |
582 | <!-- 中间显示层 --> | 582 | <!-- 中间显示层 --> |
583 | <view class="flex ai-center"> | 583 | <view class="flex ai-center"> |
584 | <image class="hui_img" src="{{iurl}}/miniapp//images/hui.png"></image> | 584 | <image class="hui_img" src="{{iurl}}/miniapp//images/hui.png"></image> |
585 | <view class="order_hui"> | 585 | <view class="order_hui"> |
586 | - <view class="fs28 ellipsis-1">{{order_prom.name}}</view> | 586 | + <view class="fs28 ellipsis-1">{{f_order_prom.name}}</view> |
587 | <view class="fs26"> | 587 | <view class="fs26"> |
588 | - (活动时间:{{tool.format_tt(order_prom.start_time)}} - {{tool.format_tt(order_prom.end_time)}}) | 588 | + (活动时间:{{tool.format_tt(f_order_prom.start_time)}} - {{tool.format_tt(f_order_prom.end_time)}}) |
589 | </view> | 589 | </view> |
590 | </view> | 590 | </view> |
591 | </view> | 591 | </view> |
@@ -616,9 +616,9 @@ | @@ -616,9 +616,9 @@ | ||
616 | 616 | ||
617 | <!-- 判断是不是有秒杀 --> | 617 | <!-- 判断是不是有秒杀 --> |
618 | <!-- 判断是不是有秒杀 --> | 618 | <!-- 判断是不是有秒杀 --> |
619 | - <block wx:if="{{more_flash}}"> | 619 | + <block wx:if="{{f_more_flash}}"> |
620 | 620 | ||
621 | - <block wx:for="{{more_flash}}"> | 621 | + <block wx:for="{{f_more_flash}}"> |
622 | <!-- <view class="cx-frame flex" style="position: relative; height: auto" wx:if="{{item.prom_type==1}}">--> | 622 | <!-- <view class="cx-frame flex" style="position: relative; height: auto" wx:if="{{item.prom_type==1}}">--> |
623 | <view class="cx-frame flex" style="position: relative; height: auto" > | 623 | <view class="cx-frame flex" style="position: relative; height: auto" > |
624 | <view wx:if="{{item.prom_type==1}}" class="cx-sizs wsize" style="width: 144rpx">秒杀</view> | 624 | <view wx:if="{{item.prom_type==1}}" class="cx-sizs wsize" style="width: 144rpx">秒杀</view> |
@@ -657,11 +657,11 @@ | @@ -657,11 +657,11 @@ | ||
657 | </block> | 657 | </block> |
658 | 658 | ||
659 | <!-- 新增促销多活动的排版 --> | 659 | <!-- 新增促销多活动的排版 --> |
660 | - <view class="bdt16" wx:if="{{ prom_type!=1 && prom_type!=2 && prom_type!=4 && prom_type!=6 && cx_prom_group.length>0}}"> | 660 | + <view class="bdt16" wx:if="{{ prom_type!=1 && prom_type!=2 && prom_type!=4 && prom_type!=6 && f_cx_prom_group.length>0}}"> |
661 | <view data-coupon="1" bindtap="switch_cx_group" class="cx-frame flex" style="position: relative"> | 661 | <view data-coupon="1" bindtap="switch_cx_group" class="cx-frame flex" style="position: relative"> |
662 | <view class="cx-sizs fs30">促销</view> | 662 | <view class="cx-sizs fs30">促销</view> |
663 | <view class="flex ai_c f1 pdh20"> | 663 | <view class="flex ai_c f1 pdh20"> |
664 | - <view class="xc-coupon-fram" wx:for="{{cx_prom_group}}" > | 664 | + <view class="xc-coupon-fram" wx:for="{{f_cx_prom_group}}" > |
665 | <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word">优惠促销</view> | 665 | <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word">优惠促销</view> |
666 | <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word">搭配促销</view> | 666 | <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word">搭配促销</view> |
667 | <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word">组合购</view> | 667 | <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word">组合购</view> |