Commit 3d7ee4c2e5e0ef78b0ad34bce3004bbd6d91030a
Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev
Showing
17 changed files
with
640 additions
and
276 deletions
packageA/pages/distribution/myteam/myteam.js
... | ... | @@ -83,6 +83,7 @@ Page({ |
83 | 83 | store_id: app.globalData.setting.stoid, |
84 | 84 | user_id: app.globalData.user_id, |
85 | 85 | level: 1, |
86 | + isall: 1, | |
86 | 87 | }); |
87 | 88 | |
88 | 89 | }; |
... | ... | @@ -149,6 +150,7 @@ Page({ |
149 | 150 | store_id: app.globalData.setting.stoid, |
150 | 151 | user_id: app.globalData.user_id, |
151 | 152 | level: th.data.currentTabIndex + 1, |
153 | + isall: 1 | |
152 | 154 | }); |
153 | 155 | }, |
154 | 156 | |
... | ... | @@ -176,6 +178,7 @@ Page({ |
176 | 178 | store_id: app.globalData.setting.stoid, |
177 | 179 | user_id: app.globalData.user_id, |
178 | 180 | level: currentIndex + 1, |
181 | + isall: 1 | |
179 | 182 | }); |
180 | 183 | }, |
181 | 184 | ... | ... |
packageA/pages/distribution/myteam/myteam.wxml
... | ... | @@ -9,7 +9,11 @@ |
9 | 9 | <view class="flex ai-center"> |
10 | 10 | <view class="pdr20"><image class="avatar" src="{{item.head_pic}}"/></view> |
11 | 11 | <view> |
12 | - <view>{{item.nickname}}</view> | |
12 | + <view> | |
13 | + {{item.nickname}} | |
14 | + <view style="color: #FF6768;display:inline;" wx:if="{{item.is_distribut == 1}}">分销会员</view> | |
15 | + <view style="color: #FF6768;display:inline;" wx:else>普通会员</view> | |
16 | + </view> | |
13 | 17 | <view class="fs24 c-a">{{filter.format_time(item.reg_time)}}</view> |
14 | 18 | </view> |
15 | 19 | </view> | ... | ... |
packageA/pages/jfbuy/jfbuy.wxml
packageA/pages/prom_list/prom_list.js
... | ... | @@ -40,7 +40,8 @@ Page({ |
40 | 40 | g_buy_num: null, |
41 | 41 | sele_collocation:null, |
42 | 42 | |
43 | - room_id:0, //房间号 | |
43 | + room_id:0, //房间号 | |
44 | + is_coupon: 1, //搭配促销禁用 | |
44 | 45 | }, |
45 | 46 | |
46 | 47 | //------初始化加载---------- |
... | ... | @@ -164,163 +165,189 @@ Page({ |
164 | 165 | var ee=this,th=ee,that=ee; |
165 | 166 | var gid = this.data.gid,i = getApp().request; |
166 | 167 | ee.data.g_buy_num = new Map(); |
167 | - this.wait_for_store_config(); | |
168 | - setTimeout(function(){ | |
169 | - i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, { | |
170 | - failRollback: !0, | |
171 | - success: function(t) { | |
172 | - if (t.data.code == 0) { | |
173 | - if (t.data.data.is_on_sale != 1) { | |
174 | - wx.showModal({ | |
175 | - title: '商品已经下架', | |
176 | - showCancel: !1, | |
177 | - complete: function() { | |
178 | - wx.navigateBack(); | |
179 | - } | |
180 | - }); | |
181 | - } | |
182 | - | |
183 | - var timestamp = Date.parse(new Date()); | |
184 | - timestamp = timestamp / 1000; | |
185 | - if (t.data.data.on_time > timestamp) { | |
186 | - wx.showModal({ | |
187 | - title: '商品还未上架', | |
188 | - showCancel: !1, | |
189 | - complete: function() { | |
190 | - wx.navigateBack(); | |
191 | - } | |
192 | - }); | |
193 | - } | |
194 | - | |
195 | - if (t.data.data.down_time > 0) { | |
196 | - if (t.data.data.down_time < timestamp) { | |
197 | - wx.showModal({ | |
198 | - title: '商品已经到期下架', | |
199 | - showCancel: !1, | |
200 | - complete: function() { | |
201 | - wx.navigateBack(); | |
202 | - } | |
203 | - }); | |
204 | - } | |
205 | - } | |
206 | - | |
207 | - t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); | |
208 | - var txt = (t.data.data.shop_price / t.data.data.market_price * 10).toFixed(2); | |
209 | - t.data.data['disc'] = txt; | |
210 | - | |
211 | - if (t.data.data.original_img.indexOf(o.imghost) == -1) | |
212 | - t.data.data.original_img = o.imghost + t.data.data.original_img; | |
213 | - if (t.data.data.goods_content == null) t.data.data.goods_content = ""; | |
214 | - | |
215 | - //计算商品的规格 | |
216 | - var gg = ""; | |
217 | - if(t.data.data.goods_spec=="null" || t.data.data.goods_spec==null) t.data.data.goods_spec=""; | |
218 | - if(t.data.data.goods_color=="null" || t.data.data.goods_color==null) t.data.data.goods_color=""; | |
219 | - | |
220 | - if (t.data.data.goods_spec != "" && t.data.data.goods_color != "") { | |
221 | - gg = t.data.data.goods_spec + "/" + t.data.data.goods_color; | |
222 | - } else if (t.data.data.goods_spec != "" || t.data.data.goods_color != "") { | |
223 | - gg = t.data.data.goods_spec + t.data.data.goods_color; | |
224 | - } else { | |
225 | - gg = "规格1"; | |
226 | - } | |
227 | - t.data.data.gg = gg; | |
228 | - | |
229 | - | |
230 | - //--看一下有没有开启等级卡--- | |
231 | - if(ee.data.rank_switch){ | |
232 | - //---回调卡的列表--- | |
233 | - th.getPlusCardType(function(ob){ | |
234 | - var user = getApp().globalData.userInfo; | |
235 | - if(user){ | |
236 | - if(user.card_field && user['card_expiredate']){ | |
237 | - var str = user['card_expiredate'].replace(/-/g, '/'); | |
238 | - var end = new Date(str); | |
239 | - end = Date.parse(end) / 1000; | |
240 | - var now = ut.gettimestamp(); | |
241 | - //--- 判断是等级会员,且在有效期范围内 --- | |
242 | - if(user.card_field && now<end){ | |
243 | - var card_name=ob.name_map.get(user.card_field); | |
244 | - if(card_name && card_name.length>5) card_name=card_name.substring(0,5); | |
245 | - th.setData({card_field:user.card_field,card_name:card_name}); | |
246 | - if(t.data.data[user.card_field]>0) t.data.data.shop_price=t.data.data[user.card_field]; | |
247 | - } | |
248 | - } | |
249 | - } | |
250 | - ee.setData({ data: t.data.data, }); | |
251 | - }) | |
252 | - }else{ | |
253 | - ee.setData({ data: t.data.data, }); | |
254 | - } | |
255 | - | |
256 | - if(!ee.data.collocationList){ | |
257 | - /*---获取活动的重表---*/ | |
258 | - //调用接口判断订单优惠, | |
259 | - getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+ee.data.gid+"/2", {}).then(res => { | |
260 | - if(res.data.code==0){ | |
261 | - var r_data=res.data.data; | |
262 | - th.loop_promise(0,r_data.collocationList,function(){ | |
263 | - ee.setData({ | |
264 | - collocationGoods:r_data.collocationPromList, | |
265 | - collocationList:r_data.collocationList, | |
266 | - }) | |
267 | - }) | |
268 | - } | |
269 | - }) | |
270 | - } | |
271 | - | |
272 | - //获取统一条形码,普通商品和优惠促销的商品 | |
273 | - if ( t.data.data.prom_type == 5){ | |
274 | - //默认门店要拿下门店库存 | |
275 | - if(that.data.sales_rules==2 && that.data.is_newsales_rules){ | |
276 | - //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存 | |
277 | - getApp().waitfor2(that,"wait_for_user_store","fir_def_store",function(){ | |
278 | - if(th.data.fir_def_store && th.data.fir_def_store.pickup_id ){ | |
279 | - var lock=0,plist=null; | |
280 | - //先读取门店的lock,采用链式写法,少用await | |
281 | - getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ | |
282 | - data:{store_id:os.stoid,wareId:ee.data.data.goods_id,storageId:that.data.fir_def_store.pickup_id,pageSize:1000} | |
283 | - }).then(res=>{ | |
284 | - if(res.data.code==0 && res.data.data.total>0){ | |
285 | - for(var i in res.data.data.pageData) | |
286 | - lock+=res.data.data.pageData[i].outQty | |
287 | - } | |
288 | - //---通过接口获取门店的线下库存信息-- | |
289 | - return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ | |
290 | - data:{storageNos:that.data.fir_def_store.pickup_no,wareIds:encodeURIComponent(th.data.data.erpwareid),storeId:os.stoid,pageSize:2000} | |
291 | - }) | |
292 | - }).then(res=>{ | |
293 | - if(res.data.code==0 && res.data.data.total>0){ | |
294 | - plist=res.data.data.pageData[0]; | |
295 | - } | |
296 | - if(plist && plist.CanOutQty-lock>0){ | |
297 | - that.data.fir_def_store.CanOutQty=plist.CanOutQty-lock; | |
298 | - }else{ | |
299 | - that.data.fir_def_store.CanOutQty=0; | |
300 | - } | |
301 | - //--给门店赋值线下库存-- | |
302 | - th.setData({def_pick_store:that.data.fir_def_store}); | |
303 | - //获取门店 | |
304 | - ee.get_sto(); | |
305 | - }) | |
306 | - }else{ | |
307 | - //--获取门店-- | |
308 | - ee.get_sto(); | |
309 | - } | |
310 | - }) | |
311 | - }else{ | |
312 | - //获取门店 | |
313 | - ee.get_sto(); | |
314 | - } | |
315 | - | |
316 | - } | |
317 | - else { | |
318 | - return getApp().my_warnning("商品没有搭配购的活动",0,th) | |
319 | - } | |
320 | - } | |
321 | - } | |
322 | - }); | |
323 | - },1000) | |
168 | + this.wait_for_store_config(); | |
169 | + clearTimeout(ot); | |
170 | + var ot = setTimeout(function () { | |
171 | + i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, { | |
172 | + failRollback: !0, | |
173 | + success: function (t) { | |
174 | + if (t.data.code == 0) { | |
175 | + if (t.data.data.is_on_sale != 1) { | |
176 | + wx.showModal({ | |
177 | + title: '商品已经下架', | |
178 | + showCancel: !1, | |
179 | + complete: function () { | |
180 | + wx.navigateBack(); | |
181 | + } | |
182 | + }); | |
183 | + } | |
184 | + | |
185 | + var timestamp = Date.parse(new Date()); | |
186 | + timestamp = timestamp / 1000; | |
187 | + if (t.data.data.on_time > timestamp) { | |
188 | + wx.showModal({ | |
189 | + title: '商品还未上架', | |
190 | + showCancel: !1, | |
191 | + complete: function () { | |
192 | + wx.navigateBack(); | |
193 | + } | |
194 | + }); | |
195 | + } | |
196 | + | |
197 | + if (t.data.data.down_time > 0) { | |
198 | + if (t.data.data.down_time < timestamp) { | |
199 | + wx.showModal({ | |
200 | + title: '商品已经到期下架', | |
201 | + showCancel: !1, | |
202 | + complete: function () { | |
203 | + wx.navigateBack(); | |
204 | + } | |
205 | + }); | |
206 | + } | |
207 | + } | |
208 | + | |
209 | + t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); | |
210 | + var txt = (t.data.data.shop_price / t.data.data.market_price * 10).toFixed(2); | |
211 | + t.data.data['disc'] = txt; | |
212 | + | |
213 | + if (t.data.data.original_img.indexOf(o.imghost) == -1) | |
214 | + t.data.data.original_img = o.imghost + t.data.data.original_img; | |
215 | + if (t.data.data.goods_content == null) t.data.data.goods_content = ""; | |
216 | + | |
217 | + //计算商品的规格 | |
218 | + var gg = ""; | |
219 | + if (t.data.data.goods_spec == "null" || t.data.data.goods_spec == null) t.data.data.goods_spec = ""; | |
220 | + if (t.data.data.goods_color == "null" || t.data.data.goods_color == null) t.data.data.goods_color = ""; | |
221 | + | |
222 | + if (t.data.data.goods_spec != "" && t.data.data.goods_color != "") { | |
223 | + gg = t.data.data.goods_spec + "/" + t.data.data.goods_color; | |
224 | + } else if (t.data.data.goods_spec != "" || t.data.data.goods_color != "") { | |
225 | + gg = t.data.data.goods_spec + t.data.data.goods_color; | |
226 | + } else { | |
227 | + gg = "规格1"; | |
228 | + } | |
229 | + t.data.data.gg = gg; | |
230 | + | |
231 | + | |
232 | + //--看一下有没有开启等级卡--- | |
233 | + if (ee.data.rank_switch) { | |
234 | + //---回调卡的列表--- | |
235 | + th.getPlusCardType(function (ob) { | |
236 | + var user = getApp().globalData.userInfo; | |
237 | + if (user) { | |
238 | + if (user.card_field && user['card_expiredate']) { | |
239 | + var str = user['card_expiredate'].replace(/-/g, '/'); | |
240 | + var end = new Date(str); | |
241 | + end = Date.parse(end) / 1000; | |
242 | + var now = ut.gettimestamp(); | |
243 | + //--- 判断是等级会员,且在有效期范围内 --- | |
244 | + if (user.card_field && now < end) { | |
245 | + var card_name = ob.name_map.get(user.card_field); | |
246 | + if (card_name && card_name.length > 5) card_name = card_name.substring(0, 5); | |
247 | + th.setData({ | |
248 | + card_field: user.card_field, | |
249 | + card_name: card_name | |
250 | + }); | |
251 | + if (t.data.data[user.card_field] > 0) t.data.data.shop_price = t.data.data[user.card_field]; | |
252 | + } | |
253 | + } | |
254 | + } | |
255 | + ee.setData({ | |
256 | + data: t.data.data, | |
257 | + }); | |
258 | + }) | |
259 | + } else { | |
260 | + ee.setData({ | |
261 | + data: t.data.data, | |
262 | + }); | |
263 | + } | |
264 | + | |
265 | + if (!ee.data.collocationList) { | |
266 | + /*---获取活动的重表---*/ | |
267 | + //调用接口判断订单优惠, | |
268 | + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + ee.data.gid + "/2", {}).then(res => { | |
269 | + if (res.data.code == 0) { | |
270 | + var r_data = res.data.data; | |
271 | + | |
272 | + th.data.is_coupon = r_data.collocationPromList.is_coupon; | |
273 | + | |
274 | + | |
275 | + th.loop_promise(0, r_data.collocationList, function () { | |
276 | + // 设置搭配购是否使用优惠卷 | |
277 | + ee.setData({ | |
278 | + collocationGoods: r_data.collocationPromList, | |
279 | + collocationList: r_data.collocationList, | |
280 | + }) | |
281 | + }) | |
282 | + } | |
283 | + }) | |
284 | + } | |
285 | + | |
286 | + //获取统一条形码,普通商品和优惠促销的商品 | |
287 | + if (t.data.data.prom_type == 5) { | |
288 | + //默认门店要拿下门店库存 | |
289 | + if (that.data.sales_rules == 2 && that.data.is_newsales_rules) { | |
290 | + //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存 | |
291 | + getApp().waitfor2(that, "wait_for_user_store", "fir_def_store", function () { | |
292 | + if (th.data.fir_def_store && th.data.fir_def_store.pickup_id) { | |
293 | + var lock = 0, | |
294 | + plist = null; | |
295 | + //先读取门店的lock,采用链式写法,少用await | |
296 | + getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | |
297 | + data: { | |
298 | + store_id: os.stoid, | |
299 | + wareId: ee.data.data.goods_id, | |
300 | + storageId: that.data.fir_def_store.pickup_id, | |
301 | + pageSize: 1000 | |
302 | + } | |
303 | + }).then(res => { | |
304 | + if (res.data.code == 0 && res.data.data.total > 0) { | |
305 | + for (var i in res.data.data.pageData) | |
306 | + lock += res.data.data.pageData[i].outQty | |
307 | + } | |
308 | + //---通过接口获取门店的线下库存信息-- | |
309 | + return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | |
310 | + data: { | |
311 | + storageNos: that.data.fir_def_store.pickup_no, | |
312 | + wareIds: encodeURIComponent(th.data.data.erpwareid), | |
313 | + storeId: os.stoid, | |
314 | + pageSize: 2000 | |
315 | + } | |
316 | + }) | |
317 | + }).then(res => { | |
318 | + if (res.data.code == 0 && res.data.data.total > 0) { | |
319 | + plist = res.data.data.pageData[0]; | |
320 | + } | |
321 | + if (plist && plist.CanOutQty - lock > 0) { | |
322 | + that.data.fir_def_store.CanOutQty = plist.CanOutQty - lock; | |
323 | + } else { | |
324 | + that.data.fir_def_store.CanOutQty = 0; | |
325 | + } | |
326 | + //--给门店赋值线下库存-- | |
327 | + th.setData({ | |
328 | + def_pick_store: that.data.fir_def_store | |
329 | + }); | |
330 | + //获取门店 | |
331 | + ee.get_sto(); | |
332 | + }) | |
333 | + } else { | |
334 | + //--获取门店-- | |
335 | + ee.get_sto(); | |
336 | + } | |
337 | + }) | |
338 | + } else { | |
339 | + //获取门店 | |
340 | + ee.get_sto(); | |
341 | + } | |
342 | + | |
343 | + } else { | |
344 | + return getApp().my_warnning("商品没有搭配购的活动", 0, th) | |
345 | + } | |
346 | + } | |
347 | + } | |
348 | + }); | |
349 | + clearTimeout(ot); | |
350 | + }, 1000) | |
324 | 351 | }, |
325 | 352 | |
326 | 353 | onUnload: function() {}, |
... | ... | @@ -507,6 +534,8 @@ Page({ |
507 | 534 | newd['pick_dis'] = th.data.sto_sele_distr; |
508 | 535 | newd["collocation_goods"]=th.data.sele_collocation; |
509 | 536 | |
537 | + newd["is_coupon"] = th.data.is_coupon; | |
538 | + | |
510 | 539 | th.buyNow(newd); |
511 | 540 | |
512 | 541 | }, | ... | ... |
packageB/pages/zuhegou/list/g_filter.wxs
... | ... | @@ -20,10 +20,19 @@ var g_filters = { |
20 | 20 | var tnow=getDate(); |
21 | 21 | if(t1>=tnow) return 1; |
22 | 22 | return 0; |
23 | - } | |
23 | + }, | |
24 | + goToUrl: function(type, id, name) { | |
25 | + if (type == 1) { | |
26 | + return "/packageB/pages/zuhegou/index/index?id="+id+"&title="+name | |
27 | + } else { | |
28 | + return "/packageB/pages/zuhegou/preIndex/index?id="+id+"&title="+name | |
29 | + } | |
30 | + }, | |
31 | + | |
24 | 32 | } |
25 | 33 | module.exports = { |
26 | 34 | has_char: g_filters.has_char, |
27 | 35 | beg_time: g_filters.beg_time, |
28 | 36 | end_time: g_filters.end_time, |
37 | + goToUrl: g_filters.goToUrl, | |
29 | 38 | } |
30 | 39 | \ No newline at end of file | ... | ... |
packageB/pages/zuhegou/list/list.js
... | ... | @@ -90,16 +90,17 @@ Page({ |
90 | 90 | |
91 | 91 | //----倒计时函数----- |
92 | 92 | countDown() { |
93 | + | |
93 | 94 | if(!this.data.is_timer) return false; |
94 | 95 | var th=this; |
95 | 96 | // 获取当前时间,同时得到活动结束时间数组 |
96 | - let newTime =ut.gettimestamp(); | |
97 | - var endTimeList = this.data.goodlist; | |
98 | - if(endTimeList==null) return null | |
97 | + let newTime = ut.gettimestamp(); | |
98 | + var endTimeList = th.data.goodlist; | |
99 | + if(endTimeList == null) return null; | |
99 | 100 | // 对结束时间进行处理渲染到页面 |
100 | 101 | for (var i = 0; i < endTimeList.length;i++){ |
101 | 102 | var o = endTimeList[i]; |
102 | - var endTime = o.end_time; | |
103 | + var endTime = o.start_time; | |
103 | 104 | if(th.data.type==0) endTime = o.start_time; |
104 | 105 | let obj = null; |
105 | 106 | // 如果活动未结束,对时间进行处理 |
... | ... | @@ -122,23 +123,36 @@ Page({ |
122 | 123 | } |
123 | 124 | }, |
124 | 125 | |
126 | + // 请求活动列表 | |
125 | 127 | async requestSalelist() { |
126 | 128 | //--没有更多就不调用-- |
127 | 129 | if(!this.data.ismore) return false; |
128 | - | |
129 | - var e = this,th=e, i = "/api/weshop/prom/zhbuy/page?is_end=0&timetype=1&page=" + e.data.currentPage; | |
130 | + var e = this, | |
131 | + th = e, | |
132 | + i = "/api/weshop/prom/zhbuy/page?is_end=0&timetype=" + this.data.type + "&page=" + e.data.currentPage; | |
130 | 133 | // var plist=null,alllist=th.data.goodlist; |
131 | 134 | // if(!alllist) alllist=[]; |
132 | - let {goodlist}=this.data; | |
135 | + let {goodlist} = this.data; | |
133 | 136 | const {data:res}=await getApp().request.promiseGet(i,{ |
134 | 137 | isShowLoading:1, |
135 | - data:{store_id:os.stoid,user_id:getApp().globalData.user_id} | |
138 | + data:{ | |
139 | + store_id: os.stoid, | |
140 | + user_id: getApp().globalData.user_id | |
141 | + } | |
136 | 142 | }) |
137 | 143 | if(res.code==0 && res.data.pageData.length>0){ |
138 | 144 | if(res.data.page>1){ |
139 | - goodlist=goodlist.concat(res.data.pageData) | |
145 | + th.data.goodlist = goodlist.concat(res.data.pageData) | |
140 | 146 | }else{ |
141 | - goodlist=res.data.pageData; | |
147 | + th.data.goodlist = res.data.pageData; | |
148 | + } | |
149 | + | |
150 | + if (th.data.type == 0) { | |
151 | + clearInterval(ot); | |
152 | + var ot = setInterval(function () { | |
153 | + th.countDown(); | |
154 | + }, 1000); | |
155 | + | |
142 | 156 | } |
143 | 157 | |
144 | 158 | }else{ |
... | ... | @@ -146,14 +160,21 @@ Page({ |
146 | 160 | th.data.ismore=0; |
147 | 161 | } |
148 | 162 | e.data.currentPage++; |
149 | - th.setData({goodlist,isshow:1}); | |
163 | + th.setData({ | |
164 | + goodlist: th.data.goodlist, | |
165 | + isshow: 1 | |
166 | + }); | |
150 | 167 | |
151 | 168 | }, |
169 | + | |
152 | 170 | onPullDownRefresh: function() { |
153 | 171 | this.reloadGoodList(); |
154 | 172 | }, |
173 | + | |
155 | 174 | reloadGoodList: function() { |
156 | - this.data.goodlist = null, this.data.currentPage = 1, this.requestSalelist(); | |
175 | + this.data.goodlist = null; | |
176 | + this.data.currentPage = 1; | |
177 | + this.requestSalelist(); | |
157 | 178 | }, |
158 | 179 | |
159 | 180 | onReachBottom: function() { |
... | ... | @@ -162,9 +183,16 @@ Page({ |
162 | 183 | |
163 | 184 | //点击tab事件 |
164 | 185 | tip:function(e) { |
165 | - var a=e.currentTarget.dataset.ty,th=this;th.data.ismore=1; | |
166 | - this.setData({type:a,goodlist:null}); | |
186 | + var a = e.currentTarget.dataset.ty, | |
187 | + th = this; | |
188 | + th.data.type = a; | |
189 | + th.data.ismore = 1; | |
190 | + this.setData({ | |
191 | + type:a, | |
192 | + goodlist: null | |
193 | + }); | |
167 | 194 | this.reloadGoodList(); |
195 | + | |
168 | 196 | }, |
169 | 197 | |
170 | 198 | ... | ... |
packageB/pages/zuhegou/list/list.wxml
... | ... | @@ -31,18 +31,26 @@ |
31 | 31 | |
32 | 32 | <view class="kill-list"> |
33 | 33 | <view class="kill-item" wx:for="{{goodlist}}"> |
34 | - <navigator class="kill-pic rel" url="/packageB/pages/zuhegou/index/index?id={{item.id}}&title={{item.name}}" hover-class="none"> | |
34 | + <navigator class="kill-pic rel" url="{{g_filter.goToUrl(type, item.id, item.name)}}" hover-class="none"> | |
35 | + <!-- <image class="abs xc-miaosha" src="{{url}}/miniapp/images/zms.png"></image> --> | |
35 | 36 | <image class="wh100" src="{{url+item.img_url}}" data-val="{{item.img_url}}" |
36 | 37 | data-errorimg="goodlist[{{index}}].img_url" binderror="bind_bnerr2" lazy-load="true"></image> |
37 | 38 | </navigator> |
38 | 39 | <view class="kill-cont"> |
39 | - <navigator class="goods-name ellipsis-2" url="/packageB/pages/zuhegou/index/index?id={{item.id}}&title={{item.name}}" hover-class="none"> | |
40 | + <navigator class="goods-name ellipsis-2" url="{{g_filter.goToUrl(type, item.id, item.name)}}" hover-class="none"> | |
40 | 41 | {{item.name}} |
41 | 42 | |
42 | 43 | <view class="goods-num"> |
43 | 44 | <view> |
44 | 45 | <view>组合数量: {{item.zhbuyqty}}</view> |
45 | 46 | <view>活动时间: {{filters.format_time(item.start_time) + '至' + filters.format_time(item.end_time)}}</view> |
47 | + <view class="blue_c" wx:if="{{type == 0}}"> | |
48 | + <text>剩余:</text> | |
49 | + <text class='tui-conutdown-box'> {{item.djs.day}}</text>天 | |
50 | + <text class='tui-conutdown-box'>{{item.djs.hou}}</text>时 | |
51 | + <text class='tui-conutdown-box'>{{item.djs.min}}</text>分 | |
52 | + <text class='tui-conutdown-box tui-countdown-bg'>{{item.djs.sec}}</text>秒 | |
53 | + </view> | |
46 | 54 | <view class="fs40 flex xc-buttom-money {{type==1?'xc-wc':'blue_c'}}" > |
47 | 55 | <view class="fs28" style="line-height: 16px;">¥</view> |
48 | 56 | <text>{{item.zhprice}}</text> |
... | ... | @@ -53,7 +61,24 @@ |
53 | 61 | </view> |
54 | 62 | </view> |
55 | 63 | </view> |
56 | - <view class="no-more" wx:if="{{goodlist.length==0}}">没有相关内容</view> | |
64 | + | |
65 | +<view class="no-more" wx:if="{{goodlist.length==0}}">没有相关内容</view> | |
66 | + | |
67 | +<view class="kill-time xc-seckill-bottom"> | |
68 | + <view class="theader" > | |
69 | + <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> | |
70 | + <image class="xc-bottom" | |
71 | + src="{{url}}{{type==1?'/miniapp/images/fire-red.png':'/miniapp/images/fire-black.png'}}"></image> | |
72 | + 火热进行中</view> | |
73 | + <view bindtap='tip' data-ty="0" class=" flex-center timeac right {{type==0?'active':''}}"> | |
74 | + <image class="xc-bottom" | |
75 | + src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image> | |
76 | + 即将开始</view> | |
77 | + </view> | |
78 | +</view> | |
79 | + | |
80 | + | |
81 | + | |
57 | 82 | </view> |
58 | 83 | |
59 | 84 | <share_box id="share"></share_box> | ... | ... |
packageC/pages/group_list/group_list.js
... | ... | @@ -9,7 +9,8 @@ Page({ |
9 | 9 | * 页面的初始数据 |
10 | 10 | */ |
11 | 11 | data: { |
12 | - // type:1, | |
12 | + url: a.imghost, | |
13 | + type:1, | |
13 | 14 | // goodlist: null, |
14 | 15 | |
15 | 16 | isLogin: false, |
... | ... | @@ -51,13 +52,13 @@ Page({ |
51 | 52 | isLogin: true, |
52 | 53 | }); |
53 | 54 | |
54 | - | |
55 | + let typeVal = this.data.type; | |
55 | 56 | let url = '/api/weshop/goods/groupBuy/page'; |
56 | 57 | let data = { |
57 | 58 | store_id: app.globalData.setting.stoid, |
58 | 59 | is_show: 1, |
59 | 60 | is_end: 0, |
60 | - timetype:1 | |
61 | + timetype: typeVal | |
61 | 62 | }; |
62 | 63 | |
63 | 64 | this.setData({ |
... | ... | @@ -72,21 +73,48 @@ Page({ |
72 | 73 | }); |
73 | 74 | }); |
74 | 75 | |
75 | - this.data.is_timer=1; | |
76 | + this.data.is_timer = 1; | |
76 | 77 | |
77 | 78 | }; |
78 | 79 | |
79 | - | |
80 | 80 | //设置全局定时器 |
81 | + clearInterval(this.data.timer); | |
81 | 82 | this.data.timer = setInterval(function () { |
82 | - self.countDown(); | |
83 | - },1000); | |
84 | - | |
83 | + self.countDown(); | |
84 | + }, 1000); | |
85 | 85 | |
86 | 86 | }; |
87 | 87 | |
88 | 88 | }, |
89 | 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 | + | |
90 | 118 | /** |
91 | 119 | * 生命周期函数--监听页面隐藏 |
92 | 120 | */ |
... | ... | @@ -210,7 +238,7 @@ Page({ |
210 | 238 | // 对结束时间进行处理渲染到页面 |
211 | 239 | for(var i = 0; i < endTimeList.length; i++) { |
212 | 240 | var o = endTimeList[i]; |
213 | - var endTime = o.end_time; | |
241 | + var endTime = this.data.type == 1?o.end_time:o.start_time; | |
214 | 242 | // if(th.data.type==0) endTime = o.start_time; |
215 | 243 | let obj = null; |
216 | 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,15 +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> |
43 | + | |
44 | + | |
45 | + | |
46 | +<view class="kill-time xc-seckill-bottom"> | |
47 | + <view class="theader" > | |
48 | + <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> | |
49 | + <image class="xc-bottom" src="{{url}}{{type==1?'/miniapp/images/fire-red.png':'/miniapp/images/fire-black.png'}}"></image> | |
50 | + 火热进行中</view> | |
51 | + <view bindtap='tip' data-ty="0" class=" flex-center timeac right {{type==0?'active':''}}"> | |
52 | + <image class="xc-bottom" src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image> | |
53 | + 即将开始</view> | |
54 | + </view> | |
55 | +</view> | |
34 | 56 | \ No newline at end of file | ... | ... |
packageC/pages/group_list/group_list.wxss
... | ... | @@ -55,4 +55,83 @@ page { |
55 | 55 | text-align: center; |
56 | 56 | /* margin-top: 10rpx; */ |
57 | 57 | color: #ccc; |
58 | +} | |
59 | + | |
60 | +.xc-seckill-bottom{ | |
61 | + position: fixed; | |
62 | +bottom: 0rpx; | |
63 | +width: 100%; | |
64 | + | |
65 | +} | |
66 | + | |
67 | +.xc-bottom{ | |
68 | + width: 45rpx; | |
69 | + height: 45rpx; | |
70 | + margin-right: 13rpx; | |
71 | +} | |
72 | +.xc-border-right{ | |
73 | + border-right: 4rpx solid #eee; | |
74 | + | |
75 | +} | |
76 | + | |
77 | +.kill-time .theader .timeac { | |
78 | + font-size: 32rpx; height:100%; width: 50%; | |
79 | + color: #333; background-color: #fff; | |
80 | + | |
81 | +} | |
82 | + | |
83 | +.kill-time .theader{ | |
84 | + display: flex; margin: 0 auto; align-items: center; | |
85 | + height: 100rpx; | |
86 | + | |
87 | +} | |
88 | + | |
89 | +.kill-time { | |
90 | + text-align: center; | |
91 | + justify-content: space-around; | |
92 | + align-items: center; | |
93 | + height: 101rpx; | |
94 | + border-bottom: 1px solid #ddd; | |
95 | + border-top: 1px solid #ddd; | |
96 | + background-color: #f6f6f6; | |
97 | +} | |
98 | +.kill-time .theader{ | |
99 | + display: flex; margin: 0 auto; align-items: center; | |
100 | + height: 100rpx; | |
101 | + | |
102 | +} | |
103 | +.kill-time .theader .timeac { | |
104 | + font-size: 32rpx; height:100%; width: 50%; | |
105 | + color: #333; background-color: #fff; | |
106 | + | |
107 | +} | |
108 | +/* .kill-time .theader .timeac.left{border-top-left-radius: 86rpx; border-bottom-left-radius: 86rpx;} | |
109 | +.kill-time .theader .timeac.right{border-top-right-radius: 86rpx; border-bottom-right-radius: 86rpx;} */ | |
110 | +.kill-time .theader .timeac.active{color: #c4182e} | |
111 | + | |
112 | +.kill-item { | |
113 | + display: flex; | |
114 | + justify-content: space-between; | |
115 | + background-color: #fff; | |
116 | + padding: 20rpx; | |
117 | + margin-bottom: 20rpx; | |
118 | + border-radius: 10rpx; | |
119 | + /* height: 249rpx; */ | |
120 | + align-items: center; | |
121 | +} | |
122 | + | |
123 | +.kill-pic { | |
124 | + width: 215rpx; | |
125 | + height: 215rpx; | |
126 | +} | |
127 | + | |
128 | +.kill-cont { | |
129 | + width: 465rpx; | |
130 | + margin-left:20rpx; | |
131 | + margin-right: 5rpx; | |
132 | +} | |
133 | + | |
134 | +.blue_c { | |
135 | + color: #059de5; | |
136 | + | |
58 | 137 | } |
59 | 138 | \ No newline at end of file | ... | ... |
packageC/pages/presell/cart/cart.js
... | ... | @@ -684,17 +684,19 @@ Page({ |
684 | 684 | var o_condition1=0; |
685 | 685 | if (th.data.order_prom[bn_pick]) { |
686 | 686 | var ord_prom = th.data.order_prom[bn_pick]; |
687 | - order_prom_id = ord_prom['id']; | |
688 | - switch (ord_prom['type']) { | |
689 | - case 0: | |
690 | - var all_1=o_condition; | |
691 | - o_condition1 = Math.round(ord_price * ord_prom['expression']) / 100;//满额打折 | |
692 | - order_prom_amount = (all_1 - o_condition1).toFixed(2); | |
693 | - break; | |
694 | - case 1: | |
695 | - o_condition1 = ord_price - ord_prom['expression'];//满额优惠金额 | |
696 | - order_prom_amount = ord_prom['expression']; | |
697 | - break; | |
687 | + if(!ord_prom.is_xz_yh || quan_price<=0) { | |
688 | + order_prom_id = ord_prom['id']; | |
689 | + switch (ord_prom['type']) { | |
690 | + case 0: | |
691 | + var all_1 = o_condition; | |
692 | + o_condition1 = Math.round(ord_price * ord_prom['expression']) / 100;//满额打折 | |
693 | + order_prom_amount = (all_1 - o_condition1).toFixed(2); | |
694 | + break; | |
695 | + case 1: | |
696 | + o_condition1 = ord_price - ord_prom['expression'];//满额优惠金额 | |
697 | + order_prom_amount = ord_prom['expression']; | |
698 | + break; | |
699 | + } | |
698 | 700 | } |
699 | 701 | } |
700 | 702 | //--订单优惠的显示-- |
... | ... | @@ -2247,7 +2249,7 @@ Page({ |
2247 | 2249 | await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{ |
2248 | 2250 | data:{store_id:os.stoid,goods_id:gg.goods_id} |
2249 | 2251 | }).then(res=>{ |
2250 | - if(res.data.code==0 && res.data.data && res.data.data.pageData){ | |
2252 | + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ | |
2251 | 2253 | prom=res.data.data.pageData[0]; |
2252 | 2254 | } |
2253 | 2255 | }) |
... | ... | @@ -2342,7 +2344,7 @@ Page({ |
2342 | 2344 | await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{ |
2343 | 2345 | data:{store_id:os.stoid,goods_id:goodsinfo.goods_id} |
2344 | 2346 | }).then(res=>{ |
2345 | - if(res.data.code==0 && res.data.data && res.data.data.pageData){ | |
2347 | + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ | |
2346 | 2348 | prom=res.data.data.pageData[0]; |
2347 | 2349 | } |
2348 | 2350 | }) | ... | ... |
packageC/pages/presell/cart/cart2.js
... | ... | @@ -774,16 +774,18 @@ Page({ |
774 | 774 | var order_prom_id = 0; |
775 | 775 | if (th.data.order_prom[th.data.bn_pick]) { |
776 | 776 | var ord_prom = th.data.order_prom[th.data.bn_pick]; |
777 | - order_prom_id = ord_prom['id']; | |
778 | - switch (ord_prom['type']) { | |
779 | - case 0: | |
780 | - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
781 | - order_prom_amount = (o_condition - order_m).toFixed(2); | |
782 | - break; | |
783 | - case 1: | |
784 | - order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
785 | - order_prom_amount = ord_prom['expression']; | |
786 | - break; | |
777 | + if(!ord_prom.is_xz_yh || quan_price<=0) { | |
778 | + order_prom_id = ord_prom['id']; | |
779 | + switch (ord_prom['type']) { | |
780 | + case 0: | |
781 | + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
782 | + order_prom_amount = (o_condition - order_m).toFixed(2); | |
783 | + break; | |
784 | + case 1: | |
785 | + order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
786 | + order_prom_amount = ord_prom['expression']; | |
787 | + break; | |
788 | + } | |
787 | 789 | } |
788 | 790 | } |
789 | 791 | //--订单优惠的显示-- | ... | ... |
packageC/pages/presell/list/list.js
... | ... | @@ -11,6 +11,7 @@ Page({ |
11 | 11 | isshow: 0, |
12 | 12 | ad_data: null, |
13 | 13 | max_sw_height: 200, |
14 | + type: 1, | |
14 | 15 | }, |
15 | 16 | |
16 | 17 | //------初始化加载---------- |
... | ... | @@ -117,7 +118,7 @@ Page({ |
117 | 118 | store_id: os.stoid, |
118 | 119 | page: this.data.page, |
119 | 120 | pageSize: 10, |
120 | - timetype: 1, | |
121 | + timetype: self.data.type, | |
121 | 122 | isuse:1 |
122 | 123 | } |
123 | 124 | if(getApp().globalData.userInfo){ |
... | ... | @@ -131,7 +132,6 @@ Page({ |
131 | 132 | getApp().request.get("/api/weshop/marketing/marketingPresellList/page", { |
132 | 133 | data: req, |
133 | 134 | success: function (res) { |
134 | - console.log(res); | |
135 | 135 | self.data.loading = 0; |
136 | 136 | if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { |
137 | 137 | var list = self.data.goodlist ? self.data.goodlist : []; |
... | ... | @@ -145,17 +145,92 @@ Page({ |
145 | 145 | if (arr.length < 10) { |
146 | 146 | self.setData({no_more: 1}) |
147 | 147 | } |
148 | + | |
149 | + // 预热活动设置倒计时 | |
150 | + if (self.data.type == 0) { | |
151 | + clearInterval(self.data.timer); | |
152 | + self.data.timer = setInterval(function () { | |
153 | + self.countDown(); | |
154 | + }, 1000); | |
155 | + | |
156 | + } | |
148 | 157 | } else { |
149 | 158 | self.setData({no_more: 1}) |
150 | 159 | } |
151 | 160 | self.setData({is_get: 1}) |
152 | - | |
161 | + | |
153 | 162 | } |
154 | 163 | }) |
155 | 164 | }, |
165 | + | |
166 | + | |
156 | 167 | go_index:function () { |
157 | 168 | getApp().goto("/pages/index/index/index"); |
158 | - } | |
169 | + }, | |
170 | + | |
171 | + | |
172 | + tip: function(e){ | |
173 | + // 获取模板Data数据 1进行中 0预热中 | |
174 | + var typeValue = e.currentTarget.dataset.ty; | |
175 | + // 初始化数据 | |
176 | + this.data.type = typeValue; | |
177 | + this.data.loading = 0; | |
178 | + this.data.no_more = 0; | |
179 | + this.data.page = 1; | |
180 | + this.data.goodlist = []; | |
181 | + var goodslist = this.data.goodlist; | |
182 | + // 设置模板Data数据 | |
183 | + this.setData({ | |
184 | + type: typeValue, | |
185 | + goodlist: goodslist, | |
186 | + }); | |
187 | + // 请求接口数据 | |
188 | + this.get_list(); | |
189 | + }, | |
190 | + | |
191 | + //----倒计时函数----- | |
192 | + countDown() { | |
193 | + var th=this; | |
194 | + // 获取当前时间,同时得到活动结束时间数组 | |
195 | + let newTime = ut.gettimestamp(); | |
196 | + var endTimeList = this.data.goodlist; | |
197 | + if(endTimeList==null) return null | |
198 | + // 对结束时间进行处理渲染到页面 | |
199 | + for (var i = 0; i < endTimeList.length; i++){ | |
200 | + var o = endTimeList[i]; | |
201 | + var endTime = o.start_time; | |
202 | + let obj = null; | |
203 | + // 如果活动未结束,对时间进行处理 | |
204 | + if (endTime - newTime > 0){ | |
205 | + let time = (endTime - newTime); | |
206 | + // 获取天、时、分、秒 | |
207 | + let day = parseInt(time / (60 * 60 * 24)); | |
208 | + let hou = parseInt(time % (60 * 60 * 24) / 3600); | |
209 | + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
210 | + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
211 | + obj = { | |
212 | + day: this.timeFormat(day), | |
213 | + hou: this.timeFormat(hou), | |
214 | + min: this.timeFormat(min), | |
215 | + sec: this.timeFormat(sec), | |
216 | + hide: 1 | |
217 | + } | |
218 | + }else{ | |
219 | + //活动已结束,全部设置为'00' | |
220 | + obj = { | |
221 | + day: '00', | |
222 | + hou: '00', | |
223 | + min: '00', | |
224 | + sec: '00' | |
225 | + } | |
226 | + } | |
227 | + var txt ="goodlist["+i+"].djs"; | |
228 | + th.setData({ [txt]: obj}); | |
229 | + } | |
230 | + }, | |
231 | + | |
232 | + | |
159 | 233 | |
234 | + | |
160 | 235 | |
161 | 236 | }); | ... | ... |
packageC/pages/presell/list/list.wxml
... | ... | @@ -37,7 +37,7 @@ |
37 | 37 | <view class="flex-vertical xc-strip-frame"> |
38 | 38 | <view class="xc-strip-blank rel"> |
39 | 39 | |
40 | - <view class="flex-vertical rel total"> | |
40 | + <view class="flex-vertical rel total" style="background-color: {{type == 0 ? '#059de5' : ''}};"> | |
41 | 41 | <view class="t-c abs xc-fill" style="width:{{215*(item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)}}rpx;background:#e4374d;"></view> |
42 | 42 | <text class="fs20 white abs xc-fill-text">已预售{{filters.toFix((item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)}}%</text> |
43 | 43 | </view> |
... | ... | @@ -45,32 +45,56 @@ |
45 | 45 | </view> |
46 | 46 | <view class=" ml10 fs20">库存还剩{{item.presell_sumqty-item.buy_goodnum}}件</view> |
47 | 47 | </view> |
48 | - | |
49 | - | |
48 | + | |
50 | 49 | <view class="goods-num"> |
51 | 50 | <view> |
52 | - <view class="{{type==1?'xc-wc':'blue_c'}}"></view> | |
51 | + <view class="blue_c" wx:if="{{type == 0}}"> | |
52 | + <text>剩余:</text> | |
53 | + <text class='tui-conutdown-box'> {{item.djs.day}}</text>天 | |
54 | + <text class='tui-conutdown-box'>{{item.djs.hou}}</text>时 | |
55 | + <text class='tui-conutdown-box'>{{item.djs.min}}</text>分 | |
56 | + <text class='tui-conutdown-box tui-countdown-bg'>{{item.djs.sec}}</text>秒 | |
57 | + </view> | |
58 | + | |
53 | 59 | <view class="fs40 flex xc-buttom-money {{type==1?'xc-wc':'blue_c'}}" > |
54 | 60 | <view class="fs28" style="line-height: 16px;">¥{{item.presell_price}}</view> |
55 | 61 | <text>{{item.price}}</text> |
56 | 62 | <span class="underline fs20">零售价¥{{item.market_price}}</span></view> |
57 | - | |
58 | 63 | </view> |
59 | 64 | <view class="kill-btn "> |
60 | - <navigator url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">去抢购</navigator> | |
65 | + <navigator wx:if="{{type==1}}" url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">去抢购</navigator> | |
66 | + <navigator wx:else url="/packageC/pages/presell/pregoodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}" style="background:#059de5;"><view style="color:#fff;">即将开始</view></navigator> | |
61 | 67 | </view> |
68 | + | |
62 | 69 | </view> |
63 | 70 | </view> |
64 | 71 | </view> |
65 | 72 | </view> |
66 | 73 | |
67 | - <block wx:if="{{goodlist.length==0 && is_get}}"> | |
68 | - <nodata nodataContainer="t-c"></nodata> | |
69 | - <view class="bc_btn" bindtap="go_index">去首页逛逛</view> | |
70 | - </block> | |
71 | - <view class="no-more" wx:elif="{{no_more}}">-- 没有更多 --</view> | |
74 | +<block wx:if="{{goodlist.length==0 && is_get}}"> | |
75 | +<nodata nodataContainer="t-c"></nodata> | |
76 | +</block> | |
72 | 77 | |
78 | + <view class="no-more" wx:elif="{{no_more}}">-- 没有更多 --</view> | |
73 | 79 | <view style="height:10rpx"></view> |
80 | + | |
81 | + <!-- 底部按钮 --> | |
82 | + <view class="kill-time xc-seckill-bottom"> | |
83 | + <view class="theader" > | |
84 | + <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> | |
85 | + <image class="xc-bottom" src="{{url}}{{type==1?'/miniapp/images/fire-red.png':'/miniapp/images/fire-black.png'}}"></image> | |
86 | + 火热进行中 | |
87 | + </view> | |
88 | + | |
89 | + <view bindtap='tip' data-ty="0" class=" flex-center timeac right {{type==0?'active':''}}"> | |
90 | + <image class="xc-bottom" src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image> | |
91 | + 即将开始 | |
92 | + </view> | |
93 | + | |
94 | + </view> | |
95 | +</view> | |
96 | + | |
97 | + | |
74 | 98 | </view> |
75 | 99 | |
76 | 100 | ... | ... |
pages/cart/cart2/cart2.js
... | ... | @@ -175,7 +175,10 @@ Page({ |
175 | 175 | //----------子页返回父页触发---------- |
176 | 176 | onShow: function () { |
177 | 177 | var th = this; |
178 | - th.setData({show_submit: 0}); //让提交先掩藏 | |
178 | + th.setData({ | |
179 | + show_submit: 0, | |
180 | + | |
181 | + }); //让提交先掩藏 | |
179 | 182 | th.data.g_cart_q_time = null; |
180 | 183 | |
181 | 184 | if (th.data.isclose == 0) { |
... | ... | @@ -328,6 +331,7 @@ Page({ |
328 | 331 | typeof func == "function" && func(); |
329 | 332 | }) |
330 | 333 | }, |
334 | + | |
331 | 335 | //------获取会员信息-----先获取用户信息,在进行下一步--- |
332 | 336 | get_info: function (func) { |
333 | 337 | var user_id = t.globalData.user_id; |
... | ... | @@ -525,7 +529,7 @@ Page({ |
525 | 529 | } |
526 | 530 | else |
527 | 531 | { |
528 | - item1.act = th.data.zhhe_act_map[item1.prom_id]; | |
532 | + item1.act = th.data.zhhe_act_map[item1.prom_id]; | |
529 | 533 | } |
530 | 534 | } |
531 | 535 | if(item1.prom_type==10){ |
... | ... | @@ -561,7 +565,7 @@ Page({ |
561 | 565 | } |
562 | 566 | }) |
563 | 567 | if (!isok){ |
564 | - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | |
568 | + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item1.id; | |
565 | 569 | getApp().request.delete(url, {}); |
566 | 570 | th.data.ladder_map[item1.prom_id]=-1; |
567 | 571 | continue; |
... | ... | @@ -625,7 +629,9 @@ Page({ |
625 | 629 | if (arr.length > 0) { |
626 | 630 | for (var j = 0; j < arr.length; j++) { |
627 | 631 | if (arr[j].pickup_id == pcid) { |
628 | - //if(item.is_gift!=1){ | |
632 | + | |
633 | + //赠品的配送方式要和优惠的主商品一样 | |
634 | + if(item.is_gift!=1){ | |
629 | 635 | //确定配送方式 |
630 | 636 | if (arr[j].distr_t == 0) { |
631 | 637 | arr[j].distr_t = car_item.distr_type; |
... | ... | @@ -646,7 +652,8 @@ Page({ |
646 | 652 | arr[j].exp_type = e_t; |
647 | 653 | if (e_t == 0) th.setData({is_all_zt: 0}); |
648 | 654 | else if(e_t==1) th.setData({is_all_zt: 1}); |
649 | - //} | |
655 | + } | |
656 | + | |
650 | 657 | |
651 | 658 | //-- 把等级卡会优惠多少钱装进去 -- |
652 | 659 | if (car_item.cut_price1) arr[j].card_cut_price += car_item.cut_price1; |
... | ... | @@ -689,6 +696,7 @@ Page({ |
689 | 696 | } |
690 | 697 | //如果是物流的话,全部自提的控制要弄成0 |
691 | 698 | if (e_t == 0) th.setData({is_all_zt: 0}); |
699 | + else if (e_t == 1) th.setData({is_all_zt: 1}); | |
692 | 700 | |
693 | 701 | var narr = new Array(); |
694 | 702 | narr.push(car_item); |
... | ... | @@ -827,6 +835,8 @@ Page({ |
827 | 835 | get_buy_goods: function (e) { |
828 | 836 | var th = this; |
829 | 837 | var gg = to.get_b_now(); |
838 | + | |
839 | + | |
830 | 840 | //--------如果goods_id一样,就是要立即购买----- |
831 | 841 | if (e == gg.goods_id) { |
832 | 842 | a.get("/api/weshop/goods/get/" + oo.stoid + "/" + e, { |
... | ... | @@ -974,6 +984,11 @@ Page({ |
974 | 984 | } else { |
975 | 985 | //--看是不是搭配促销-- |
976 | 986 | if (gg.prom_type == 5) { |
987 | + | |
988 | + th.setData({ | |
989 | + 'is_coupon': gg.is_coupon | |
990 | + }); | |
991 | + | |
977 | 992 | t.data.data.prom_id = gg.prom_id; |
978 | 993 | t.data.data.prom_type = 5; |
979 | 994 | if (gg.room_id) { |
... | ... | @@ -1725,16 +1740,19 @@ Page({ |
1725 | 1740 | }).then(res => { |
1726 | 1741 | if (res.data.code == 0) { |
1727 | 1742 | var ord_prom = res.data.data; |
1728 | - order_prom_id = ord_prom['id']; | |
1729 | - switch (ord_prom['type']) { | |
1730 | - case 0: | |
1731 | - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
1732 | - order_prom_amount = (o_condition - order_m).toFixed(2); | |
1733 | - break; | |
1734 | - case 1: | |
1735 | - //order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
1736 | - order_prom_amount = ord_prom['expression']; | |
1737 | - break; | |
1743 | + //如果订单没有勾选使用优惠券不参与此活动,或者没有用优惠券 | |
1744 | + if(!ord_prom.is_xz_yh || quan_price<=0) { | |
1745 | + order_prom_id = ord_prom['id']; | |
1746 | + switch (ord_prom['type']) { | |
1747 | + case 0: | |
1748 | + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
1749 | + order_prom_amount = (o_condition - order_m).toFixed(2); | |
1750 | + break; | |
1751 | + case 1: | |
1752 | + //order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
1753 | + order_prom_amount = ord_prom['expression']; | |
1754 | + break; | |
1755 | + } | |
1738 | 1756 | } |
1739 | 1757 | } |
1740 | 1758 | }) |
... | ... | @@ -2080,16 +2098,20 @@ Page({ |
2080 | 2098 | var order_prom_id = 0; |
2081 | 2099 | if (th.data.order_prom[th.data.bn_pick]) { |
2082 | 2100 | var ord_prom = th.data.order_prom[th.data.bn_pick]; |
2083 | - order_prom_id = ord_prom['id']; | |
2084 | - switch (ord_prom['type']) { | |
2085 | - case 0: | |
2086 | - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
2087 | - order_prom_amount = (o_condition - order_m).toFixed(2); | |
2088 | - break; | |
2089 | - case 1: | |
2090 | - order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
2091 | - order_prom_amount = ord_prom['expression']; | |
2092 | - break; | |
2101 | + //如果订单没有勾选使用优惠券不参与此活动 | |
2102 | + if(!ord_prom.is_xz_yh || quan_price<=0) { | |
2103 | + | |
2104 | + order_prom_id = ord_prom['id']; | |
2105 | + switch (ord_prom['type']) { | |
2106 | + case 0: | |
2107 | + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
2108 | + order_prom_amount = (o_condition - order_m).toFixed(2); | |
2109 | + break; | |
2110 | + case 1: | |
2111 | + order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
2112 | + order_prom_amount = ord_prom['expression']; | |
2113 | + break; | |
2114 | + } | |
2093 | 2115 | } |
2094 | 2116 | } |
2095 | 2117 | //--订单优惠的显示-- |
... | ... | @@ -2525,6 +2547,7 @@ Page({ |
2525 | 2547 | if (t_item.coupon_price) { |
2526 | 2548 | item.coupon_price = t_item.coupon_price; |
2527 | 2549 | item.coupon_no = th.data.using_quan[t_item.pickup_id].coupon_no; |
2550 | + t_item.quan_no=item.coupon_no; | |
2528 | 2551 | } else if (t_item.quan_no) { |
2529 | 2552 | item.coupon_no = t_item.quan_no; |
2530 | 2553 | item.coupon_price = 0; |
... | ... | @@ -2593,15 +2616,16 @@ Page({ |
2593 | 2616 | |
2594 | 2617 | //房间号的ids |
2595 | 2618 | var room_ids = ""; |
2619 | + //-- 把券的钱,写入从表 --- | |
2620 | + if (t_item.quan_youhui_list && t_item.coupon_price) { | |
2596 | 2621 | |
2597 | - //-- 把券的钱,写入从表 --- | |
2598 | - if (t_item.quan_youhui_list && t_item.coupon_price) { | |
2599 | 2622 | for (var kk in t_item.quan_youhui_list) { |
2600 | 2623 | var you_item = t_item.quan_youhui_list[kk]; |
2601 | 2624 | //-- 对券的价格进行平摊 -- |
2602 | 2625 | await th.split_set_goods_quanprice(you_item,t_item); |
2603 | 2626 | } |
2604 | 2627 | } |
2628 | + | |
2605 | 2629 | //-------------让商品添加到商品列表-------------------- |
2606 | 2630 | for (var k = 0; k < t_item.goods.length; k++) { |
2607 | 2631 | var g_item = t_item.goods[k]; |
... | ... | @@ -2624,6 +2648,7 @@ Page({ |
2624 | 2648 | goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); |
2625 | 2649 | goods.pricing_type = g_item.pricing_type; |
2626 | 2650 | } |
2651 | + | |
2627 | 2652 | if(g_item.quan_num){ |
2628 | 2653 | goods.quan_num=g_item.quan_num; |
2629 | 2654 | goods.quan_no=g_item.quan_no; |
... | ... | @@ -2717,6 +2742,7 @@ Page({ |
2717 | 2742 | if (pdata.length == 0) return; |
2718 | 2743 | var str = JSON.stringify(pdata); |
2719 | 2744 | |
2745 | + | |
2720 | 2746 | wx.showLoading({title: "加载中"}); |
2721 | 2747 | wx.request({ |
2722 | 2748 | url: oo.url + '/api/weshop/order/createWxdOrder', |
... | ... | @@ -3576,6 +3602,7 @@ Page({ |
3576 | 3602 | if (th.data.is_b_now == 1) { |
3577 | 3603 | th.setData({index: m_wind, is_express: m_wind}); |
3578 | 3604 | } else { |
3605 | + clearInterval(ui); | |
3579 | 3606 | var ui = setInterval(function () { |
3580 | 3607 | if (th.data.cartlist) { |
3581 | 3608 | var c_arr = th.data.cartlist; |
... | ... | @@ -3654,7 +3681,7 @@ Page({ |
3654 | 3681 | var item_price = gd.goods_price * gd.goods_num; |
3655 | 3682 | //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 -- |
3656 | 3683 | if (gd.account_fir != null && gd.account_fir != undefined) { |
3657 | - item_price = gd.account_fir * gd.goods_num; | |
3684 | + //item_price = gd.account_fir * gd.goods_num; | |
3658 | 3685 | } |
3659 | 3686 | ckeck_quan_price += item_price; |
3660 | 3687 | |
... | ... | @@ -3671,15 +3698,17 @@ Page({ |
3671 | 3698 | check_quan_ware_list = encodeURIComponent(gd['erpwareid']); |
3672 | 3699 | } |
3673 | 3700 | } |
3701 | + | |
3674 | 3702 | //优惠券优惠的金额要控制到优惠券的选择条件 |
3675 | 3703 | var cut_price = 0; |
3676 | 3704 | for (var i in th.data.prom_goods_map[pickup_id]) { |
3677 | 3705 | var obj = th.data.prom_goods_map[pickup_id][i]; |
3678 | - if (obj.coupon_sele) { | |
3706 | + if (obj.coupon_sele && obj.prom_price) { | |
3679 | 3707 | cut_price += obj.price - obj.prom_price; |
3680 | 3708 | } |
3681 | 3709 | } |
3682 | 3710 | |
3711 | + //阶梯优惠使用券 | |
3683 | 3712 | var prom_pt_json= ep.prom_pt_json; |
3684 | 3713 | if(prom_pt_json){ |
3685 | 3714 | for(let oj in prom_pt_json){ |
... | ... | @@ -3689,8 +3718,8 @@ Page({ |
3689 | 3718 | } |
3690 | 3719 | } |
3691 | 3720 | } |
3692 | - | |
3693 | - arr[ind].ckeck_quan_price = ckeck_quan_price - cut_price; | |
3721 | + | |
3722 | + arr[ind].ckeck_quan_price = ckeck_quan_price - (cut_price?cut_price:0); | |
3694 | 3723 | arr[ind].check_quan_ware_list = check_quan_ware_list; |
3695 | 3724 | arr[ind].check_quan_price_list = check_quan_price_list; |
3696 | 3725 | arr[ind].is_xz_yh = is_xz_yh; |
... | ... | @@ -3703,7 +3732,7 @@ Page({ |
3703 | 3732 | data: { |
3704 | 3733 | storeId: oo.stoid, |
3705 | 3734 | userId: app.globalData.user_id, |
3706 | - BuySum: arr[ind].ckeck_quan_price, | |
3735 | + BuySum: parseFloat(arr[ind].ckeck_quan_price?arr[ind].ckeck_quan_price:0).toFixed(2), | |
3707 | 3736 | WareIds: check_quan_ware_list, |
3708 | 3737 | pageSize: 100 |
3709 | 3738 | } |
... | ... | @@ -3752,7 +3781,7 @@ Page({ |
3752 | 3781 | data: { |
3753 | 3782 | storeId: oo.stoid, |
3754 | 3783 | userId: app.globalData.user_id, |
3755 | - BuySum: th.data.ckeck_quan_price, | |
3784 | + BuySum: parseFloat(th.data.ckeck_quan_price?th.data.ckeck_quan_price:0).toFixed(2), | |
3756 | 3785 | WareIds: encodeURIComponent(th.data.check_quan_ware_list), |
3757 | 3786 | pageSize: 100 |
3758 | 3787 | }, |
... | ... | @@ -4110,8 +4139,9 @@ Page({ |
4110 | 4139 | getApp().goto(url); |
4111 | 4140 | }, |
4112 | 4141 | |
4113 | - //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 | |
4114 | - split_set_goods_quanprice:async function (you_item,t_item) { | |
4142 | + //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 | |
4143 | + split_set_goods_quanprice:async function (you_item,t_item) { | |
4144 | + | |
4115 | 4145 | var coupon_price=you_item.WareCashSum; |
4116 | 4146 | var goods=t_item.goods; |
4117 | 4147 | var arr=[]; | ... | ... |
pages/cart/cart2/cart2.wxml
... | ... | @@ -343,11 +343,12 @@ |
343 | 343 | |
344 | 344 | |
345 | 345 | <view class="set-mes bdr_b-14"> |
346 | + | |
346 | 347 | <view wx:if="{{order.store_prom}}"> |
347 | 348 | <icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}} |
348 | 349 | </view> |
349 | 350 | |
350 | - <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" wx:if="{{(selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null}}"> | |
351 | + <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" wx:if="{{is_coupon > 0 && ((selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null)}}"> | |
351 | 352 | <view class="work-frame flex-space-between"> |
352 | 353 | <view class="work"> |
353 | 354 | 优惠券 <text class="quan_num_show">{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list?get_by_quan_list.length:0)}}张可用</text> | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -3105,8 +3105,8 @@ Page({ |
3105 | 3105 | |
3106 | 3106 | //--------检查是否活动,活动是否开始,或者是否结束------- |
3107 | 3107 | async check_prom(gid, prom_type, prom_id) { |
3108 | - console.log('check_prom'); | |
3109 | - var ee = this,th = ee; | |
3108 | + var ee = this, | |
3109 | + th = ee; | |
3110 | 3110 | var user_id=getApp().globalData.user_id; |
3111 | 3111 | if(!user_id) user_id=0; |
3112 | 3112 | |
... | ... | @@ -3118,6 +3118,7 @@ Page({ |
3118 | 3118 | } |
3119 | 3119 | |
3120 | 3120 | if(prom_type==2){ |
3121 | + | |
3121 | 3122 | //-------判断团购活动是否抢光--------- |
3122 | 3123 | await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { |
3123 | 3124 | 1: 1 |
... | ... | @@ -3129,11 +3130,12 @@ Page({ |
3129 | 3130 | }); |
3130 | 3131 | //拿取价格并且判断时间-- |
3131 | 3132 | getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" +os.stoid + "/" +gid+"/"+ prom_id, { |
3132 | - success: function (t) { | |
3133 | - if (t.data.code != 0) { | |
3134 | - ee.get_normal(gid); | |
3135 | - return false; | |
3136 | - } | |
3133 | + success: function (t) { | |
3134 | + if (t.data.code != 0) { | |
3135 | + ee.get_normal(gid); | |
3136 | + return false; | |
3137 | + } | |
3138 | + | |
3137 | 3139 | //----已经结束----- |
3138 | 3140 | if (t.data.data.is_end == 1) { |
3139 | 3141 | ee.get_normal(gid); |
... | ... | @@ -3141,17 +3143,18 @@ Page({ |
3141 | 3143 | } |
3142 | 3144 | //----已经过期----- |
3143 | 3145 | var now = ut.gettimestamp(); |
3144 | - if (t.data.data.end_time < now || t.data.data.start_time>now) { | |
3146 | + // if (t.data.data.end_time < now || t.data.data.start_time > now) { | |
3147 | + if (t.data.data.end_time < now) { | |
3145 | 3148 | ee.get_normal(gid); |
3146 | 3149 | return false; |
3147 | 3150 | } |
3148 | - | |
3151 | + | |
3149 | 3152 | /*-- 还没有开始预热的也不显示 --*/ |
3150 | 3153 | if (t.data.data.show_time > now) { |
3151 | 3154 | ee.get_normal(gid); |
3152 | 3155 | return false; |
3153 | 3156 | } |
3154 | - | |
3157 | + | |
3155 | 3158 | var t_gd = ee.data.data; |
3156 | 3159 | var prom_end_time = ut.formatTime(t.data.data.end_time, "yyyy-MM-dd hh:mm:ss"); |
3157 | 3160 | var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss"); | ... | ... |