Commit c6ba77c80b7331db65d19602f6bf9207cc4a3ad4
1 parent
51b6750c
更新预售,新增预热时间
Showing
7 changed files
with
190 additions
and
94 deletions
packageC/pages/presell/goodsInfo/goodsInfo.js
... | ... | @@ -21,6 +21,9 @@ let self = null; |
21 | 21 | |
22 | 22 | Page({ |
23 | 23 | data: { |
24 | + type: 0, | |
25 | + a_btn_type: true, //测试底部按钮显示 | |
26 | + | |
24 | 27 | start_stop: 2, //秒杀开始 结束 的控制(1正在进行,2即将开始) |
25 | 28 | color_type: 0, //线条控制 |
26 | 29 | color_type_one: 0, |
... | ... | @@ -2379,13 +2382,30 @@ Page({ |
2379 | 2382 | countDown(time, prom_st) { |
2380 | 2383 | if (!this.data.is_timer) return false; |
2381 | 2384 | var th = this; |
2385 | + var {presellForm:{start_time,show_time,end_time},presellForm} = this.data; | |
2382 | 2386 | // 获取当前时间,同时得到活动结束时间数组 |
2383 | 2387 | var endTime = time; |
2384 | 2388 | var newTime = ut.gettimestamp(); |
2385 | 2389 | // 对结束时间进行处理渲染到页面 |
2386 | 2390 | var obj = null; |
2387 | - // 如果活动未结束,对时间进行处理 | |
2388 | - if (endTime - newTime > 0) { | |
2391 | + var type = 0; | |
2392 | + | |
2393 | + if ( show_time && newTime>=show_time && newTime<start_time ) { | |
2394 | + // 如果开启预热且在预热时间内 | |
2395 | + var time = (start_time - newTime); | |
2396 | + // 获取天、时、分、秒 | |
2397 | + var day = parseInt(time / (60 * 60 * 24)); | |
2398 | + var hou = parseInt(time % (60 * 60 * 24) / 3600); | |
2399 | + var min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
2400 | + var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
2401 | + obj = { | |
2402 | + day: this.timeFormat(day), | |
2403 | + hou: this.timeFormat(hou), | |
2404 | + min: this.timeFormat(min), | |
2405 | + sec: this.timeFormat(sec) | |
2406 | + } | |
2407 | + } else if (endTime - newTime > 0) { | |
2408 | + // 如果活动未结束,对时间进行处理 | |
2389 | 2409 | var time = (endTime - newTime); |
2390 | 2410 | // 获取天、时、分、秒 |
2391 | 2411 | var day = parseInt(time / (60 * 60 * 24)); |
... | ... | @@ -2398,8 +2418,8 @@ Page({ |
2398 | 2418 | min: this.timeFormat(min), |
2399 | 2419 | sec: this.timeFormat(sec) |
2400 | 2420 | } |
2421 | + type = 1 | |
2401 | 2422 | } else { |
2402 | - | |
2403 | 2423 | //活动已结束,全部设置为'00' |
2404 | 2424 | obj = { |
2405 | 2425 | day: '00', |
... | ... | @@ -2407,19 +2427,20 @@ Page({ |
2407 | 2427 | min: '00', |
2408 | 2428 | sec: '00' |
2409 | 2429 | } |
2430 | + | |
2410 | 2431 | th.setData({ |
2411 | 2432 | prom_time_text: '活动已经结束:', |
2412 | - prom_st: 3 | |
2433 | + prom_st: 3, | |
2434 | + djs: obj, | |
2435 | + type: 2 | |
2413 | 2436 | }) |
2414 | - th.setData({ | |
2415 | - djs: obj | |
2416 | - }); | |
2417 | - return false; | |
2418 | 2437 | |
2438 | + return false; | |
2419 | 2439 | } |
2420 | 2440 | |
2421 | 2441 | th.setData({ |
2422 | - djs: obj | |
2442 | + djs: obj, | |
2443 | + type: type | |
2423 | 2444 | }); |
2424 | 2445 | setTimeout(function () { |
2425 | 2446 | th.countDown(endTime) |
... | ... | @@ -4716,6 +4737,7 @@ Page({ |
4716 | 4737 | presell_id: presell_id, |
4717 | 4738 | goods_id: th.data.gid |
4718 | 4739 | } |
4740 | + console.log('获取预售从表') | |
4719 | 4741 | //------获取预售从表---------- |
4720 | 4742 | await getApp().request.promiseGet(url, { |
4721 | 4743 | data: rd |
... | ... | @@ -4730,6 +4752,7 @@ Page({ |
4730 | 4752 | }) |
4731 | 4753 | |
4732 | 4754 | } else { |
4755 | + console.log('获取预售从表', 'pre_id', th.data.pre_id) | |
4733 | 4756 | //------获取预售从表---------- |
4734 | 4757 | await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => { |
4735 | 4758 | if (res.data.code == 0 && res.data.data) { |
... | ... | @@ -4798,12 +4821,13 @@ Page({ |
4798 | 4821 | } |
4799 | 4822 | |
4800 | 4823 | if (act_data.start_time > ut.gettimestamp()) { |
4801 | - wx.showToast({ title: "活动还未开始", icon: 'none', duration: 3000 }); | |
4802 | - setTimeout(function () { | |
4803 | - ut.wx_back(); | |
4804 | - }, 2000) | |
4805 | - gnext = 0; | |
4806 | - return false; | |
4824 | + // wx.showToast({ title: "活动还未开始", icon: 'none', duration: 3000 }); | |
4825 | + // setTimeout(function () { | |
4826 | + // ut.wx_back(); | |
4827 | + // }, 2000) | |
4828 | + // gnext = 0; | |
4829 | + th.setData({ show: true }); | |
4830 | + // return false; | |
4807 | 4831 | } |
4808 | 4832 | |
4809 | 4833 | th.setData({ |
... | ... | @@ -4838,11 +4862,12 @@ Page({ |
4838 | 4862 | } |
4839 | 4863 | }) |
4840 | 4864 | if (!pre_arr) { |
4841 | - wx.showToast({ title: "当前会员身份不符或者时间已过期,无法参与", icon: 'none', duration: 3000 }); | |
4842 | - setTimeout(function () { | |
4843 | - ut.wx_back(); | |
4844 | - }, 2000) | |
4845 | - return false; | |
4865 | + // wx.showToast({ title: "当前会员身份不符或者时间已过期,无法参与", icon: 'none', duration: 3000 }); | |
4866 | + // setTimeout(function () { | |
4867 | + // ut.wx_back(); | |
4868 | + // }, 2000) | |
4869 | + th.setData({ show: true }); | |
4870 | + // return false; | |
4846 | 4871 | } |
4847 | 4872 | if (func) { |
4848 | 4873 | func(); | ... | ... |
packageC/pages/presell/goodsInfo/goodsInfo.wxml
... | ... | @@ -74,7 +74,8 @@ |
74 | 74 | <view class="goo"> |
75 | 75 | <view class="pt_view rel"> |
76 | 76 | <!-- 许程 7. 24 --> |
77 | - <image class="secondkill-img" src="{{iurl+'/miniapp/images/red_jx.png'}}"></image> | |
77 | + <image wx:if="{{type == 0}}" class="secondkill-img" src="{{iurl?iurl+'miniapp/images/blue_ks.png':''}}" /> | |
78 | + <image wx:else class="secondkill-img" src="{{iurl?iurl+'miniapp/images/red_jx.png':''}}" /> | |
78 | 79 | <!-- <view class=""> --> |
79 | 80 | <!-- <view class="flex" style='height:40rpx; margin-top:5rpx;'> --> |
80 | 81 | <view class="abs xc-qt-price fs28 xc-qtsign">预售价</view> |
... | ... | @@ -88,28 +89,28 @@ |
88 | 89 | |
89 | 90 | <block> |
90 | 91 | <!-- </view> --> |
91 | - <view class="hy-stop word-color fs26 abs">距活动结束还有</view> | |
92 | + <view class="hy-stop word-color fs26 abs cl_r {{type==0?'pre_cl':''}}">距活动{{type==0?'开始':'结束'}}还有</view> | |
92 | 93 | <view class="secview flex abs fs24 " style="color: black;right: 3px; top:46rpx;"> |
93 | 94 | <block wx:if="djs.day"> |
94 | - <view class='day-val' style="color:#d40022;margin-top:-34rpx;"> | |
95 | + <view class="day-val cl_r {{type==0?'pre_cl':''}}" style="margin-top:-34rpx;"> | |
95 | 96 | {{djs.day}} |
96 | 97 | </view> |
97 | - <view class="day white" style="margin-top:-34rpx;margin-right:10rpx;color:#d40022"> | |
98 | + <view class="day cl_r {{type==0?'pre_cl':''}}" style="margin-top:-34rpx;margin-right:10rpx;"> | |
98 | 99 | 天 |
99 | 100 | </view> |
100 | 101 | </block> |
101 | - <view class='xc-time-val white t-c' style="background:#d40022"> | |
102 | + <view class="xc-time-val white t-c {{type==0?'pre_ba':''}}" > | |
102 | 103 | {{djs.hou}} |
103 | 104 | </view> |
104 | - <view class="xc-time" style="color:#d40022">时</view> | |
105 | - <view class='xc-time-val white t-c' style="background:#d40022"> | |
105 | + <view class="xc-time {{type==0?'pre_cl':''}}">时</view> | |
106 | + <view class="xc-time-val white t-c {{type==0?'pre_ba':''}}" > | |
106 | 107 | {{djs.min}} |
107 | 108 | </view> |
108 | - <view class="xc-time" style="color:#d40022">分</view> | |
109 | - <view class='xc-time-val white t-c' style=";background:#d40022"> | |
109 | + <view class="xc-time {{type==0?'pre_cl':''}}">分</view> | |
110 | + <view class="xc-time-val white t-c {{type==0?'pre_ba':''}}" > | |
110 | 111 | {{djs.sec}} |
111 | 112 | </view> |
112 | - <view class="xc-time" style="color:#d40022">秒</view> | |
113 | + <view class="xc-time {{type==0?'pre_cl':''}}">秒</view> | |
113 | 114 | </view> |
114 | 115 | </block> |
115 | 116 | </view> |
... | ... | @@ -128,11 +129,11 @@ |
128 | 129 | </view> |
129 | 130 | </view> |
130 | 131 | <view wx:if="{{presellForm.presell_type==0}}" class="fs24" style="padding-bottom:20rpx"> |
131 | - <view class="stock" style="color:#999">尾款:{{filters.format_time(presellForm.pay_begindate,1)}}-{{filters.format_time(presellForm.pay_enddate,1)}}</view> | |
132 | + <view class="stock" style="color:#999">尾款:{{filters.format_time(presellForm.pay_begindate,1)}}-{{filters.format_time(presellForm.pay_enddate,1)}}</view> | |
132 | 133 | </view> |
133 | 134 | <view class="goods-num"> |
134 | 135 | <block wx:if="{{presellList.virtual_qty}}"> |
135 | - <view class="stock">总数量:{{presellList.presell_sumqty+presellList.virtual_qty}}件</view> | |
136 | + <view class="stock">总数量:{{presellList.presell_sumqty+presellList.virtual_qty}}件</view> | |
136 | 137 | <view class="stock" wx:if="{{presellList.vip_butyqty}}">限购:{{presellList.vip_butyqty}}件</view> |
137 | 138 | <view class="stock" wx:else>限购:不限</view> |
138 | 139 | <view class="sales">已购:{{presellList.buy_goodnum+presellList.virtual_qty}}件</view> |
... | ... | @@ -209,7 +210,7 @@ |
209 | 210 | </view> |
210 | 211 | <scroll-view scroll-x="true" class="pj_scroll"> |
211 | 212 | <view class="flex"> |
212 | - <view class="xc_comment-detail" style="" wx:for="{{fir_comments}}" wx:key="fir_comments"> | |
213 | + <view class="xc_comment-detail" wx:for="{{fir_comments}}" wx:key="fir_comments"> | |
213 | 214 | <view class="xc_comment-left"> |
214 | 215 | <view class="xc_comment-user"> |
215 | 216 | <view class="xc_user-img"> |
... | ... | @@ -219,7 +220,7 @@ |
219 | 220 | <view class="xc_user-name five-level-word"> |
220 | 221 | {{item.is_anonymous!=1?item.username:'匿名'}} |
221 | 222 | </view> |
222 | - <image class="xc_comment-img" src="{{iurl}}/miniapp/images/star-red.png" wx:for="{{item.sum_rank}}" wx:key="{{index}}"></image> | |
223 | + <image class="xc_comment-img" src="{{iurl}}/miniapp/images/star-red.png" wx:for="{{item.sum_rank}}" wx:key="rank"></image> | |
223 | 224 | </view> |
224 | 225 | </view> |
225 | 226 | <view class="xc_comment-font pj_word_size ellipsis-1 pdt12"> |
... | ... | @@ -434,7 +435,7 @@ |
434 | 435 | <view class="middle-user"> |
435 | 436 | {{item.username==''||item.is_anonymous==1 ?'匿名用户':item.username}} |
436 | 437 | </view> |
437 | - <image class="star" src="{{iurl}}/miniapp/images/star-red.png" wx:for="{{item.sum_rank}}" wx:key="{{index}}"></image> | |
438 | + <image class="star" src="{{iurl}}/miniapp/images/star-red.png" wx:for="{{item.sum_rank}}" wx:key="index"></image> | |
438 | 439 | </view> |
439 | 440 | </view> |
440 | 441 | <view class="xc-pirces"> |
... | ... | @@ -450,12 +451,12 @@ |
450 | 451 | </view> |
451 | 452 | <view class="img-ul"> |
452 | 453 | <block wx:if="{{item.source_type==0}}"> |
453 | - <view class="img-li" wx:for="{{item.img}}" wx:key="{{index}}"> | |
454 | + <view class="img-li" wx:for="{{item.img}}" wx:key="index"> | |
454 | 455 | <image bindtap="previewCommentImgs" class="wh100" data-cidx="{{cIdx}}" data-img="{{iurl}}{{item}}" data-id="{{index}}" src="{{iurl}}{{item}}"></image> |
455 | 456 | </view> |
456 | 457 | </block> |
457 | 458 | <block wx:if="{{item.source_type==1}}"> |
458 | - <view class="img-li" wx:for="{{item.weapp_img}}" wx:if="{{aitem.length>10}}" wx:key="{{index}}" wx:for-item="aitem"> | |
459 | + <view class="img-li" wx:for="{{item.weapp_img}}" wx:if="{{aitem.length>10}}" wx:key="index" wx:for-item="aitem"> | |
459 | 460 | <image bindtap="previewCommentImgs_w" class="wh100" data-cidx="{{cIdx}}" data-img="{{aitem}}" data-id="{{index}}" src="{{aitem}}"></image> |
460 | 461 | </view> |
461 | 462 | </block> |
... | ... | @@ -474,7 +475,7 @@ |
474 | 475 | <view class="reply rel" wx:if="{{item.replay_list}}"> |
475 | 476 | <view class="line_bulge"></view> |
476 | 477 | <view class="shop-reply">店家回复:</view> |
477 | - <view class="shop-font" wx:for="{{item.replay_list}}" wx:for-item="r_item" wx:key="{{index}}"> | |
478 | + <view class="shop-font" wx:for="{{item.replay_list}}" wx:for-item="r_item" wx:key="index"> | |
478 | 479 | {{r_item.content}} |
479 | 480 | </view> |
480 | 481 | </view> |
... | ... | @@ -529,7 +530,8 @@ |
529 | 530 | </navigator> |
530 | 531 | </view> |
531 | 532 | |
532 | - <view class="fs24 f1 flex ai-center bg-FF4732 t-c white" style="border-radius:10rpx;justify-content: center"> | |
533 | + <view wx:if="{{type == 0}}" class="buy-btn cart-btn cart-btn-lg lanse set_width" style="border-radius: 56rpx;">即将开始</view> | |
534 | + <view wx:else class="fs24 f1 flex ai-center bg-FF4732 t-c white" style="border-radius:10rpx;justify-content: center"> | |
533 | 535 | <view style="padding: 0 6rpx"> |
534 | 536 | <view class="">{{filters.format_time(presellForm.end_time,2)}} 预售结束</view> |
535 | 537 | <!-- <view class="">08.30 23:59:59 开始发货</view> --> |
... | ... | @@ -721,7 +723,7 @@ |
721 | 723 | {{sec_sto.name}} |
722 | 724 | </view> |
723 | 725 | <view class="itemlists" hidden="{{is_sec_mend==0}}"> |
724 | - <view wx:for="{{sec_sto.s_arr}}" wx:key="{{index}}" class="item" bindtap="hidemend" data-p_id="{{item.pickup_id}}" data-p_name="{{item.pickup_name}}" data-p_dis="{{item.distr_type}}"> | |
726 | + <view wx:for="{{sec_sto.s_arr}}" wx:key="index" class="item" bindtap="hidemend" data-p_id="{{item.pickup_id}}" data-p_name="{{item.pickup_name}}" data-p_dis="{{item.distr_type}}"> | |
725 | 727 | {{item.pickup_name}} |
726 | 728 | </view> |
727 | 729 | </view> |
... | ... | @@ -735,7 +737,7 @@ |
735 | 737 | <view class="prom-model"> |
736 | 738 | <icon bindtap="closePromModal" class="modal-close" color="gray" size="22" type="cancel"></icon> |
737 | 739 | <view class="prom-title">优惠信息</view> |
738 | - <view class="logistics-item" wx:for="{{select.activity.data}}" wx:key="{{index}}"> | |
740 | + <view class="logistics-item" wx:for="{{select.activity.data}}" wx:key="index"> | |
739 | 741 | <view class="item-title"> |
740 | 742 | <text class="prom-item">{{item.title}}</text> |
741 | 743 | </view> |
... | ... | @@ -759,7 +761,7 @@ |
759 | 761 | <view class="top-frame"> |
760 | 762 | <view class="xc-coupon-frame "> |
761 | 763 | <!-- -单张的券- --> |
762 | - <view class="rel" wx:for="{{quan_list}}" wx:key="{{index}}"> | |
764 | + <view class="rel" wx:for="{{quan_list}}" wx:key="index"> | |
763 | 765 | <view class="coupon flex"> |
764 | 766 | <view class="circle xc-circular-one"></view> |
765 | 767 | <view class="xc-coupon-left "> |
... | ... | @@ -817,7 +819,7 @@ |
817 | 819 | <block wx:if="{{choice_sort_store==0}}"> |
818 | 820 | <!-- 需要for循环 --> |
819 | 821 | <block wx:if="{{is_show_sto_cat==1}}"> |
820 | - <view class="store_choose flex" wx:for="{{def_pickpu_list}}" bindtap="choose_for_store_fir" data-ind="{{index}}"> | |
822 | + <view class="store_choose flex" wx:for="{{def_pickpu_list}}" wx:key="dpl" bindtap="choose_for_store_fir" data-ind="{{index}}"> | |
821 | 823 | <view class="store flex-vertical"> |
822 | 824 | <!-- 需要点击事件 --> |
823 | 825 | <block wx:if="{{index==fir_pick_index}}"> |
... | ... | @@ -843,7 +845,7 @@ |
843 | 845 | </view> |
844 | 846 | </block> |
845 | 847 | <block wx:else> |
846 | - <view class="store_choose flex" wx:for="{{only_pk}}" bindtap="choose_for_store_fir" data-ind="{{index}}"> | |
848 | + <view class="store_choose flex" wx:for="{{only_pk}}" wx:key="olpk" bindtap="choose_for_store_fir" data-ind="{{index}}"> | |
847 | 849 | <view class="store flex-vertical"> |
848 | 850 | <!-- 需要点击事件 --> |
849 | 851 | <block wx:if="{{index==fir_pick_index}}"> |
... | ... | @@ -871,7 +873,7 @@ |
871 | 873 | </block> |
872 | 874 | <block wx:else> |
873 | 875 | <!-- 如果是点击选择门店分类后显示分类下的门店 --> |
874 | - <view class="store_choose flex" wx:for="{{sec_sto.s_arr}}" data-ind="{{index}}" bindtap="choose_for_store"> | |
876 | + <view class="store_choose flex" wx:for="{{sec_sto.s_arr}}" wx:key="sec_arr" data-ind="{{index}}" bindtap="choose_for_store"> | |
875 | 877 | <view class="store flex-vertical"> |
876 | 878 | <!-- 需要点击事件 --> |
877 | 879 | <block wx:if="{{index==sec_pick_index}}"> |
... | ... | @@ -922,7 +924,7 @@ |
922 | 924 | </view> |
923 | 925 | </view> |
924 | 926 | <view class="sort_store_list"> |
925 | - <view class="sort-store-frame" wx:for="{{all_sto}}" data-index="{{index}}" bindtap="choice_sort_store" data-region="{{item.name}}"> | |
927 | + <view class="sort-store-frame" wx:for="{{all_sto}}" wx:key="all_sto" data-index="{{index}}" bindtap="choice_sort_store" data-region="{{item.name}}"> | |
926 | 928 | <view class="sort-store flex-vertical-between"> |
927 | 929 | <view class="fs30" di>{{item.name}}</view> |
928 | 930 | <view class="black_rights-frame"> | ... | ... |
packageC/pages/presell/goodsInfo/goodsInfo.wxss
... | ... | @@ -2361,8 +2361,30 @@ margin-top:5rpx; |
2361 | 2361 | top: -23rpx; |
2362 | 2362 | right: 56rpx; |
2363 | 2363 | } |
2364 | -.xc-time-val{width:36rpx;height:36rpx;border-radius:7rpx; line-height: 36rpx;} | |
2365 | -.xc-time{margin-right:10rpx; margin-left:10rpx; margin-top:-32rpx; | |
2364 | +.xc-time-val{ | |
2365 | + width:36rpx; | |
2366 | + height:36rpx; | |
2367 | + border-radius:7rpx; | |
2368 | + line-height: 36rpx; | |
2369 | + background:#d40022; | |
2370 | +} | |
2371 | +.xc-time{ | |
2372 | + margin-right:10rpx; | |
2373 | + margin-left:10rpx; | |
2374 | + margin-top:-32rpx; | |
2375 | + color: #d40022; | |
2376 | +} | |
2377 | +.ba_r { | |
2378 | + background:#d40022; | |
2379 | +} | |
2380 | +.cl_r { | |
2381 | + color: #d40022; | |
2382 | +} | |
2383 | +.pre_ba { | |
2384 | + background:#0097e0; | |
2385 | +} | |
2386 | +.pre_cl { | |
2387 | + color: #0097e0; | |
2366 | 2388 | } |
2367 | 2389 | .xc-goods-explain{ |
2368 | 2390 | width:100%; |
... | ... | @@ -2947,7 +2969,7 @@ button.custom-service::after{ |
2947 | 2969 | /* position: absolute; */ |
2948 | 2970 | display: flex; |
2949 | 2971 | align-items: center; |
2950 | - /* justify-content: center; */ | |
2972 | + justify-content: center; | |
2951 | 2973 | border-radius: 60rpx; |
2952 | 2974 | background-color: rgba(0,0,0,.4); |
2953 | 2975 | /* position: absolute; */ | ... | ... |
packageC/pages/presell/list/list.js
... | ... | @@ -11,7 +11,7 @@ Page({ |
11 | 11 | isshow: 0, |
12 | 12 | ad_data: null, |
13 | 13 | max_sw_height: 200, |
14 | - type: 1, | |
14 | + type: 0, | |
15 | 15 | }, |
16 | 16 | |
17 | 17 | //------初始化加载---------- |
... | ... | @@ -136,7 +136,7 @@ Page({ |
136 | 136 | store_id: os.stoid, |
137 | 137 | page: this.data.page, |
138 | 138 | pageSize: 10, |
139 | - timetype: self.data.type, | |
139 | + // timetype: self.data.type, | |
140 | 140 | isuse:1 |
141 | 141 | } |
142 | 142 | if(getApp().globalData.userInfo){ |
... | ... | @@ -150,12 +150,20 @@ Page({ |
150 | 150 | getApp().request.get("/api/weshop/marketing/marketingPresellList/page", { |
151 | 151 | data: req, |
152 | 152 | success: function (res) { |
153 | + let now = ut.gettimestamp(); | |
153 | 154 | self.data.loading = 0; |
154 | 155 | if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { |
155 | 156 | var list = self.data.goodlist ? self.data.goodlist : []; |
156 | 157 | var arr = res.data.data.pageData; |
157 | 158 | //数组合起来 |
158 | 159 | for (var i in arr) { |
160 | + arr[i].type = arr[i].show_time&&(now>=arr[i].show_time&&now<arr[i].start_time)?0:(now>arr[i].start_time&&now<arr[i].end_time)?1:2; | |
161 | + arr[i].djs = { | |
162 | + day: '00', | |
163 | + hou: '00', | |
164 | + min: '00', | |
165 | + sec: '00', | |
166 | + }; | |
159 | 167 | list.push(arr[i]); |
160 | 168 | } |
161 | 169 | self.data.page++; |
... | ... | @@ -215,36 +223,49 @@ Page({ |
215 | 223 | if(endTimeList==null) return null |
216 | 224 | // 对结束时间进行处理渲染到页面 |
217 | 225 | for (var i = 0; i < endTimeList.length; i++){ |
218 | - var o = endTimeList[i]; | |
219 | - var endTime = o.start_time; | |
220 | - let obj = null; | |
221 | - // 如果活动未结束,对时间进行处理 | |
222 | - if (endTime - newTime > 0){ | |
223 | - let time = (endTime - newTime); | |
224 | - // 获取天、时、分、秒 | |
225 | - let day = parseInt(time / (60 * 60 * 24)); | |
226 | - let hou = parseInt(time % (60 * 60 * 24) / 3600); | |
227 | - let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
228 | - let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
229 | - obj = { | |
230 | - day: this.timeFormat(day), | |
231 | - hou: this.timeFormat(hou), | |
232 | - min: this.timeFormat(min), | |
233 | - sec: this.timeFormat(sec), | |
234 | - hide: 1 | |
235 | - } | |
236 | - }else{ | |
237 | - //活动已结束,全部设置为'00' | |
238 | - obj = { | |
239 | - day: '00', | |
240 | - hou: '00', | |
241 | - min: '00', | |
242 | - sec: '00' | |
226 | + var o = endTimeList[i]; | |
227 | + var endTime = o.start_time; | |
228 | + let obj = null; | |
229 | + var type = 1; | |
230 | + var tend = false; | |
231 | + // if (o.show_time && newTime < endTime && newTime >= o.show_time) { | |
232 | + // type = 0; | |
233 | + // } | |
234 | + // 如果活动未结束,对时间进行处理 | |
235 | + if (o.show_time && newTime < endTime && newTime > o.show_time){ | |
236 | + let time = (endTime - newTime); | |
237 | + // 获取天、时、分、秒 | |
238 | + let day = parseInt(time / (60 * 60 * 24)); | |
239 | + let hou = parseInt(time % (60 * 60 * 24) / 3600); | |
240 | + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
241 | + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
242 | + obj = { | |
243 | + day: this.timeFormat(day), | |
244 | + hou: this.timeFormat(hou), | |
245 | + min: this.timeFormat(min), | |
246 | + sec: this.timeFormat(sec), | |
247 | + hide: 1 | |
243 | 248 | } |
249 | + type = 0; | |
250 | + }else{ | |
251 | + //活动已结束,全部设置为'00' | |
252 | + obj = { | |
253 | + day: '00', | |
254 | + hou: '00', | |
255 | + min: '00', | |
256 | + sec: '00' | |
244 | 257 | } |
245 | - var txt ="goodlist["+i+"].djs"; | |
246 | - th.setData({ [txt]: obj}); | |
258 | + tend = true | |
247 | 259 | } |
260 | + var txt ="goodlist["+i+"].djs"; | |
261 | + var typ ="goodlist["+i+"].type"; | |
262 | + var end ="goodlist["+i+"].end"; | |
263 | + th.setData({ | |
264 | + [txt]: obj, | |
265 | + [typ]: type, | |
266 | + [end]: tend, | |
267 | + }); | |
268 | + } | |
248 | 269 | }, |
249 | 270 | go_url(e){ |
250 | 271 | let url=e.currentTarget.dataset.url; | ... | ... |
packageC/pages/presell/list/list.wxml
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | |
7 | 7 | <swiper class="swiper" circular="true" autoplay="true" |
8 | 8 | indicator-dots="true" interval="2500" style="height:{{max_sw_height}}rpx" > |
9 | - <block wx:for="{{ad_data}}"> | |
9 | + <block wx:for="{{ad_data}}" wx:key="as"> | |
10 | 10 | |
11 | 11 | <navigator url="{{item.ad_weapplink}}" class="s1_gk_a1" wx:if="{{g_filter.has_char(item.ad_weapplink,'plugin')>=0}}"> |
12 | 12 | <swiper-item> |
... | ... | @@ -26,7 +26,7 @@ |
26 | 26 | |
27 | 27 | |
28 | 28 | <view class="kill-list seckill_list"> |
29 | - <view class="kill-item" wx:for="{{goodlist}}"> | |
29 | + <view class="kill-item" wx:for="{{goodlist}}" wx:key="gs"> | |
30 | 30 | <navigator class="kill-pic rel" url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}"> |
31 | 31 | <image class="wh100" src="{{url+item.original_img}}" data-val="{{item.original_img}}" |
32 | 32 | data-errorimg="goodlist[{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image> |
... | ... | @@ -37,9 +37,10 @@ |
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" style="background-color: {{type == 0 ? '#059de5' : ''}};"> | |
41 | - <view class="t-c abs xc-fill" ></view> | |
42 | - <text class="fs20 white abs xc-fill-text">已预售0%</text> | |
40 | + <view class="flex-vertical rel total" style="background-color: {{item.type == 0 ? '#059de5' : item.type == 1 ? '#ffe3e2' : ''}};"> | |
41 | + <view wx:if="{{item.type == 1}}" class="t-c abs xc-fill" style="background: #e4374d;width: calc({{filters.toFix(100-(item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)||100}} * 1%);"></view> | |
42 | + <text wx:if="{{item.type == 1}}" class="fs20 white abs xc-fill-text">剩余{{filters.toFix(100-(item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)||100}}%</text> | |
43 | + <text wx:else class="fs20 white abs xc-fill-text">已预售{{filters.toFix((item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)||0}}%</text> | |
43 | 44 | </view> |
44 | 45 | |
45 | 46 | </view> |
... | ... | @@ -48,23 +49,24 @@ |
48 | 49 | |
49 | 50 | <view class="goods-num"> |
50 | 51 | <view> |
51 | - <view class="blue_c" wx:if="{{type == 0}}"> | |
52 | - <text>剩余:</text> | |
53 | - <text class='tui-conutdown-box'> {{item.djs.day}}</text>天 | |
52 | + <view class="blue_c" wx:if="{{item.type == 0 && false}}" style="display: none;position: absolute;margin-top: -40rpx;"> | |
53 | + <text>剩余:</text> | |
54 | + <text class='tui-conutdown-box'>{{item.djs.day}}</text>天 | |
54 | 55 | <text class='tui-conutdown-box'>{{item.djs.hou}}</text>时 |
55 | 56 | <text class='tui-conutdown-box'>{{item.djs.min}}</text>分 |
56 | 57 | <text class='tui-conutdown-box tui-countdown-bg'>{{item.djs.sec}}</text>秒 |
57 | 58 | </view> |
58 | 59 | |
59 | - <view class="fs40 flex xc-buttom-money {{type==1?'xc-wc':'blue_c'}}" > | |
60 | + <view class="fs40 flex xc-buttom-money {{item.type==1?'xc-wc':'blue_c'}}" > | |
60 | 61 | <view class="fs28" style="line-height: 16px;">¥{{item.presell_price}}</view> |
61 | 62 | <text>{{item.price}}</text> |
62 | 63 | <!-- <span class="underline fs20">零售价¥{{item.market_price}}</span>--> |
63 | 64 | </view> |
64 | 65 | </view> |
65 | 66 | <view class="kill-btn "> |
66 | - <navigator wx:if="{{type==1}}" url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">去抢购</navigator> | |
67 | - <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> | |
67 | + <navigator wx:if="{{item.type==1}}" url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">去抢购</navigator> | |
68 | + <!-- <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> --> | |
69 | + <navigator wx:else url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}" style="background:#059de5;"><view style="color:#fff;">即将开始</view></navigator> | |
68 | 70 | </view> |
69 | 71 | |
70 | 72 | </view> | ... | ... |
pages/index/index/index.js
... | ... | @@ -361,7 +361,8 @@ Page({ |
361 | 361 | console.log(this.data.isTemplate, '首页'); |
362 | 362 | |
363 | 363 | if (!this.data.isTemplate) { |
364 | - var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1 }; | |
364 | + // timetype: 1 仅查询已预售 置空查询全部, | |
365 | + var pre_data = { store_id: os.stoid, is_end: 0, isuse: 1 }; | |
365 | 366 | if (user_id) { |
366 | 367 | pre_data.user_id = user_id; |
367 | 368 | } |
... | ... | @@ -370,7 +371,25 @@ Page({ |
370 | 371 | data: pre_data, |
371 | 372 | success: function (e) { |
372 | 373 | if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { |
373 | - var pre_data = e.data.data.pageData; | |
374 | + var pre_data = e.data.data.pageData; | |
375 | + //当前时间戳 | |
376 | + var st = ut.gettimestamp(); | |
377 | + | |
378 | + pre_data.forEach(function (val, ind) { | |
379 | + | |
380 | + if (val.user_price) val.price = val.user_price; | |
381 | + if (val.start_time > st) { | |
382 | + pre_data[ind].status = 0; | |
383 | + } else if (val.end_time > st) { | |
384 | + pre_data[ind].status = 1; | |
385 | + } else { | |
386 | + pre_data[ind].status = 2; | |
387 | + } | |
388 | + | |
389 | + // if (val.buy_num >= val.goods_num) { | |
390 | + // pre_data[ind].status = 2; | |
391 | + // } | |
392 | + }); | |
374 | 393 | var arr = new Array(); |
375 | 394 | //--三个三个一组--- |
376 | 395 | for (var i = 0; i < pre_data.length; i += 3) { | ... | ... |
pages/index/index/index.wxml
... | ... | @@ -145,7 +145,7 @@ |
145 | 145 | </navigator> |
146 | 146 | <view class="seckill-list"> |
147 | 147 | <swiper class="s_prom" indicator-dots="{{false}}" bindchange="flashSwiperChange"> |
148 | - <swiper-item wx:for="{{saleGoods}}" wx:key="{{index}}" class="p_swiper" wx:key="saleGoods" style="padding: 0; margin-left: 10rpx"> | |
148 | + <swiper-item wx:for="{{saleGoods}}" class="p_swiper" wx:key="saleGoods" style="padding: 0; margin-left: 10rpx"> | |
149 | 149 | <navigator style="flex-shrink: 0;width: 247rpx" class="nav" hover-class="none" url="{{aitem.goods_type == 0 ? ('/pages/goods/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id):('/packageA/pages/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id )}}" wx:for="{{item}}" wx:key="item" wx:for-item="aitem" wx:for-index="aind"> |
150 | 150 | <view class="imgview"> |
151 | 151 | <image src="{{url+aitem.original_img}}" mode="aspectFill" lazy-load="true" data-errorimg="saleGoods[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3" data-img="{{aitem.original_img}}"></image> |
... | ... | @@ -189,8 +189,13 @@ |
189 | 189 | <navigator bindtap="go_pre" class="nav" hover-class="none" |
190 | 190 | data-url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}&pre_id={{aitem.id}}" |
191 | 191 | wx:for="{{item}}" wx:key="item" wx:for-item="aitem" wx:for-index="aind"> |
192 | - <view class="imgview presell"> | |
192 | + <!-- <view class="imgview presell"> --> | |
193 | + <view class="imgview"> | |
193 | 194 | <image src="{{url+aitem.original_img}}" mode="aspectFill" lazy-load="true" data-errorimg="preGoods[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3" data-img="{{aitem.original_img}}"></image> |
195 | + | |
196 | + <image wx:if="{{aitem.status==0}}" class="status_img" src="{{url}}/miniapp/images/miao/yure.png"/> | |
197 | + <image wx:elif="{{aitem.status==1}}" class="status_img" src="{{url}}/miniapp/images/miao/going.png"/> | |
198 | + <image wx:else="{{aitem.status==2}}" class="status_img" src="{{url}}/miniapp/images/miao/mend.png"/> | |
194 | 199 | </view> |
195 | 200 | <view class="ellipsis-2 mar-top10" style="height: 75rpx; width: 200rpx">{{aitem.act_name}}</view> |
196 | 201 | <view class="co-red mar-top10 flex jc_sb ali-c"> |
... | ... | @@ -401,7 +406,7 @@ |
401 | 406 | |
402 | 407 | </view> |
403 | 408 | |
404 | - <block wx:for="{{template_arr}}" wx:key="{{index}}"> | |
409 | + <block wx:for="{{template_arr}}" wx:key="index"> | |
405 | 410 | <view> |
406 | 411 | <!--导航--> |
407 | 412 | <block wx:if="{{item.ename=='nav'}}"> | ... | ... |