Commit d923de19f34e85f116a372dbecf13767087454dc

Authored by 泉州测试
1 parent a4fdee1c

预售_组合购添加预热

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
... ... @@ -34,26 +34,26 @@
34 34  
35 35 <view class="kill-list">
36 36 <view class="kill-item" wx:for="{{goodlist}}">
37   - <navigator class="kill-pic rel" url="/packageB/pages/zuhegou/index/index?id={{item.id}}&title={{item.name}}" hover-class="none">
  37 + <navigator class="kill-pic rel" url="{{g_filter.goToUrl(type, item.id, item.name)}}" hover-class="none">
38 38 <!-- <image class="abs xc-miaosha" src="{{url}}/miniapp/images/zms.png"></image> -->
39 39 <image class="wh100" src="{{url+item.img_url}}" data-val="{{item.img_url}}"
40 40 data-errorimg="goodlist[{{index}}].img_url" binderror="bind_bnerr2" lazy-load="true"></image>
41 41 </navigator>
42 42 <view class="kill-cont">
43   - <navigator class="goods-name ellipsis-2" url="/packageB/pages/zuhegou/index/index?id={{item.id}}&title={{item.name}}" hover-class="none">
  43 + <navigator class="goods-name ellipsis-2" url="{{g_filter.goToUrl(type, item.id, item.name)}}" hover-class="none">
44 44 {{item.name}}
45 45  
46 46 <view class="goods-num">
47 47 <view>
48 48 <view>组合数量: {{item.zhbuyqty}}</view>
49 49 <view>活动时间: {{filters.format_time(item.start_time) + '至' + filters.format_time(item.end_time)}}</view>
50   - <!-- <view class="{{type==1?'xc-wc':'blue_c'}}">
51   - <text>剩余:</text>
  50 + <view class="blue_c" wx:if="{{type == 0}}">
  51 + <text>剩余:</text>
52 52 <text class='tui-conutdown-box'> {{item.djs.day}}</text>天
53 53 <text class='tui-conutdown-box'>{{item.djs.hou}}</text>时
54 54 <text class='tui-conutdown-box'>{{item.djs.min}}</text>分
55 55 <text class='tui-conutdown-box tui-countdown-bg'>{{item.djs.sec}}</text>秒
56   - </view> -->
  56 + </view>
57 57 <view class="fs40 flex xc-buttom-money {{type==1?'xc-wc':'blue_c'}}" >
58 58 <view class="fs28" style="line-height: 16px;">¥</view>
59 59 <text>{{item.zhprice}}</text>
... ... @@ -105,7 +105,9 @@
105 105 <!-- <view style="height:120rpx"></view> -->
106 106 </view>
107 107  
108   -<!-- <view class="kill-time xc-seckill-bottom">
  108 +<view class="no-more" wx:if="{{goodlist.length==0}}">没有相关内容</view>
  109 +
  110 +<view class="kill-time xc-seckill-bottom">
109 111 <view class="theader" >
110 112 <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}">
111 113 <image class="xc-bottom"
... ... @@ -116,10 +118,10 @@
116 118 src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image>
117 119 即将开始</view>
118 120 </view>
119   -</view> -->
  121 +</view>
  122 +
120 123  
121 124  
122   - <view class="no-more" wx:if="{{goodlist.length==0}}">没有相关内容</view>
123 125 </view>
124 126  
125 127  
... ...
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,
... ...
packageC/pages/group_list/group_list.wxml
... ... @@ -31,3 +31,18 @@
31 31  
32 32 <view class="no-more" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">—— 已经到底啦 ——</view>
33 33 <nodata nodataContainer="t-c" wx:if="{{list.pageData.length == 0}}"></nodata>
  34 +
  35 +<view style="height:10rpx"></view>
  36 +
  37 +<view class="kill-time xc-seckill-bottom">
  38 + <view class="theader" >
  39 + <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>
  42 + 火热进行中</view>
  43 + <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>
  46 + 即将开始</view>
  47 + </view>
  48 +</view>
34 49 \ No newline at end of file
... ...
packageC/pages/group_list/group_list.wxss
... ... @@ -55,4 +55,78 @@ 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;
58 132 }
59 133 \ No newline at end of file
... ...
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  
... ...