Commit c740cde2380018f18dd8e6ec83348f1451ecbf75
1 parent
8d05f38b
团购预热模块
Showing
4 changed files
with
70 additions
and
27 deletions
packageC/pages/group_list/group_list.js
... | ... | @@ -52,13 +52,13 @@ Page({ |
52 | 52 | isLogin: true, |
53 | 53 | }); |
54 | 54 | |
55 | - | |
55 | + let typeVal = this.data.type; | |
56 | 56 | let url = '/api/weshop/goods/groupBuy/page'; |
57 | 57 | let data = { |
58 | 58 | store_id: app.globalData.setting.stoid, |
59 | 59 | is_show: 1, |
60 | 60 | is_end: 0, |
61 | - timetype:1 | |
61 | + timetype: typeVal | |
62 | 62 | }; |
63 | 63 | |
64 | 64 | this.setData({ |
... | ... | @@ -73,21 +73,48 @@ Page({ |
73 | 73 | }); |
74 | 74 | }); |
75 | 75 | |
76 | - this.data.is_timer=1; | |
76 | + this.data.is_timer = 1; | |
77 | 77 | |
78 | 78 | }; |
79 | 79 | |
80 | - | |
81 | 80 | //设置全局定时器 |
81 | + clearInterval(this.data.timer); | |
82 | 82 | this.data.timer = setInterval(function () { |
83 | - self.countDown(); | |
84 | - },1000); | |
85 | - | |
83 | + self.countDown(); | |
84 | + }, 1000); | |
86 | 85 | |
87 | 86 | }; |
88 | 87 | |
89 | 88 | }, |
90 | 89 | |
90 | + // 底部按钮切换 | |
91 | + tip: function(e) { | |
92 | + // 1进行中 0预热 | |
93 | + let typeValue = e.currentTarget.dataset.ty; | |
94 | + this.data.type = typeValue; | |
95 | + let url = '/api/weshop/goods/groupBuy/page'; | |
96 | + let data = { | |
97 | + store_id: app.globalData.setting.stoid, | |
98 | + is_show: 1, | |
99 | + is_end: 0, | |
100 | + timetype: typeValue | |
101 | + }; | |
102 | + | |
103 | + this.getData(true, url, data).then(function() { | |
104 | + self.setData({ | |
105 | + currentData: data, | |
106 | + }); | |
107 | + | |
108 | + }); | |
109 | + | |
110 | + | |
111 | + this.setData({ | |
112 | + list: null, | |
113 | + type: typeValue, | |
114 | + }); | |
115 | + | |
116 | + }, | |
117 | + | |
91 | 118 | /** |
92 | 119 | * 生命周期函数--监听页面隐藏 |
93 | 120 | */ |
... | ... | @@ -211,7 +238,7 @@ Page({ |
211 | 238 | // 对结束时间进行处理渲染到页面 |
212 | 239 | for(var i = 0; i < endTimeList.length; i++) { |
213 | 240 | var o = endTimeList[i]; |
214 | - var endTime = o.end_time; | |
241 | + var endTime = this.data.type == 1?o.end_time:o.start_time; | |
215 | 242 | // if(th.data.type==0) endTime = o.start_time; |
216 | 243 | let obj = null; |
217 | 244 | // 如果活动未结束,对时间进行处理 | ... | ... |
packageC/pages/group_list/group_list.wxml
... | ... | @@ -9,8 +9,13 @@ |
9 | 9 | <view> |
10 | 10 | <view class="fs30">{{item.title}}</view> |
11 | 11 | <view class="flex ai_c"> |
12 | - <view class="fs26 tag">{{item.rebate}}折</view> | |
13 | - <view class="rmb c-red fs30">{{item.price}}</view> | |
12 | + | |
13 | + <view class="fs26 tag" wx:if="{{type == 1}}">{{item.rebate}}折</view> | |
14 | + <view class="fs26 tag" style="color:#fff;background:#059de5;" wx:else>{{item.rebate}}折</view> | |
15 | + | |
16 | + <view class="rmb c-red fs30" wx:if="{{type == 1}}">{{item.price}}</view> | |
17 | + <view class="rmb c-red fs30" style="color:#059de5;" wx:else>{{item.price}}</view> | |
18 | + | |
14 | 19 | <view class="rmb del fs24 c-7b pdl10">{{item.market_price}}</view> |
15 | 20 | </view> |
16 | 21 | </view> |
... | ... | @@ -19,30 +24,32 @@ |
19 | 24 | <view>已售{{item.buy_num+item.virtual_num}}件</view> |
20 | 25 | <view class=""><text class="iconfont icon-shizhong fs24"></text>{{goodlist[index].djs.day}}天{{goodlist[index].djs.hou}}时{{goodlist[index].djs.min}}分{{goodlist[index].djs.sec}}秒</view> |
21 | 26 | </view> |
22 | - <view class="btn" >去团购</view> | |
27 | + | |
28 | + | |
29 | + <view class="btn" wx:if="{{type == 1}}">去团购</view> | |
30 | + <view class="btn" style="background: #059de5;color:#fff;" wx:else>即将开始</view> | |
31 | + | |
32 | + | |
23 | 33 | </view> |
24 | 34 | </view> |
25 | 35 | </view> |
26 | 36 | |
27 | 37 | </block> |
28 | - | |
29 | - | |
38 | + <view style="height:60rpx"></view> | |
30 | 39 | </view> |
31 | 40 | |
32 | 41 | <view class="no-more" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">—— 已经到底啦 ——</view> |
33 | 42 | <nodata nodataContainer="t-c" wx:if="{{list.pageData.length == 0}}"></nodata> |
34 | 43 | |
35 | -<view style="height:10rpx"></view> | |
44 | + | |
36 | 45 | |
37 | 46 | <view class="kill-time xc-seckill-bottom"> |
38 | 47 | <view class="theader" > |
39 | 48 | <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> |
40 | - <image class="xc-bottom" | |
41 | - src="{{url}}{{type==1?'/miniapp/images/fire-red.png':'/miniapp/images/fire-black.png'}}"></image> | |
49 | + <image class="xc-bottom" src="{{url}}{{type==1?'/miniapp/images/fire-red.png':'/miniapp/images/fire-black.png'}}"></image> | |
42 | 50 | 火热进行中</view> |
43 | 51 | <view bindtap='tip' data-ty="0" class=" flex-center timeac right {{type==0?'active':''}}"> |
44 | - <image class="xc-bottom" | |
45 | - src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image> | |
52 | + <image class="xc-bottom" src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image> | |
46 | 53 | 即将开始</view> |
47 | 54 | </view> |
48 | 55 | </view> |
49 | 56 | \ No newline at end of file | ... | ... |
packageC/pages/group_list/group_list.wxss
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -3098,7 +3098,8 @@ Page({ |
3098 | 3098 | |
3099 | 3099 | //--------检查是否活动,活动是否开始,或者是否结束------- |
3100 | 3100 | async check_prom(gid, prom_type, prom_id) { |
3101 | - var ee = this,th = ee; | |
3101 | + var ee = this, | |
3102 | + th = ee; | |
3102 | 3103 | var user_id=getApp().globalData.user_id; |
3103 | 3104 | if(!user_id) user_id=0; |
3104 | 3105 | |
... | ... | @@ -3110,6 +3111,7 @@ Page({ |
3110 | 3111 | } |
3111 | 3112 | |
3112 | 3113 | if(prom_type==2){ |
3114 | + | |
3113 | 3115 | //-------判断团购活动是否抢光--------- |
3114 | 3116 | await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { |
3115 | 3117 | 1: 1 |
... | ... | @@ -3121,11 +3123,12 @@ Page({ |
3121 | 3123 | }); |
3122 | 3124 | //拿取价格并且判断时间-- |
3123 | 3125 | getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" +os.stoid + "/" +gid+"/"+ prom_id, { |
3124 | - success: function (t) { | |
3125 | - if (t.data.code != 0) { | |
3126 | - ee.get_normal(gid); | |
3127 | - return false; | |
3128 | - } | |
3126 | + success: function (t) { | |
3127 | + if (t.data.code != 0) { | |
3128 | + ee.get_normal(gid); | |
3129 | + return false; | |
3130 | + } | |
3131 | + | |
3129 | 3132 | //----已经结束----- |
3130 | 3133 | if (t.data.data.is_end == 1) { |
3131 | 3134 | ee.get_normal(gid); |
... | ... | @@ -3133,17 +3136,18 @@ Page({ |
3133 | 3136 | } |
3134 | 3137 | //----已经过期----- |
3135 | 3138 | var now = ut.gettimestamp(); |
3136 | - if (t.data.data.end_time < now || t.data.data.start_time>now) { | |
3139 | + // if (t.data.data.end_time < now || t.data.data.start_time > now) { | |
3140 | + if (t.data.data.end_time < now) { | |
3137 | 3141 | ee.get_normal(gid); |
3138 | 3142 | return false; |
3139 | 3143 | } |
3140 | - | |
3144 | + | |
3141 | 3145 | /*-- 还没有开始预热的也不显示 --*/ |
3142 | 3146 | if (t.data.data.show_time > now) { |
3143 | 3147 | ee.get_normal(gid); |
3144 | 3148 | return false; |
3145 | 3149 | } |
3146 | - | |
3150 | + | |
3147 | 3151 | var t_gd = ee.data.data; |
3148 | 3152 | var prom_end_time = ut.formatTime(t.data.data.end_time, "yyyy-MM-dd hh:mm:ss"); |
3149 | 3153 | var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss"); | ... | ... |