Commit bb0d9f77b3700effceda938d017093cc069cd784

Authored by 后端开发-许程
1 parent 238592bb

首页拼单修改

pages/index/index/index.js
@@ -75,8 +75,11 @@ Page({ @@ -75,8 +75,11 @@ Page({
75 75
76 76
77 }, 77 },
  78 +
  79 +
78 async onShow() { 80 async onShow() {
79 var th=this; 81 var th=this;
  82 +
80 await this.init_load(); 83 await this.init_load();
81 //显示的时候要开启计时器 84 //显示的时候要开启计时器
82 this.data.is_timer = 1; 85 this.data.is_timer = 1;
@@ -117,7 +120,7 @@ Page({ @@ -117,7 +120,7 @@ Page({
117 } 120 }
118 }) 121 })
119 }, 122 },
120 - 123 +
121 //当隐藏的时候就关闭计时器 124 //当隐藏的时候就关闭计时器
122 onHide:function(){ 125 onHide:function(){
123 this.data.is_timer=0; 126 this.data.is_timer=0;
@@ -141,8 +144,8 @@ Page({ @@ -141,8 +144,8 @@ Page({
141 th.setData({ template_arr: t_arr, isTemplate: 1, bgcolor_t: temp_data.bkcolor}); 144 th.setData({ template_arr: t_arr, isTemplate: 1, bgcolor_t: temp_data.bkcolor});
142 } 145 }
143 }) 146 })
144 - console.log("init_load");  
145 - console.log(getApp().globalData.config); 147 +
  148 +
146 //--首页的问题-- 149 //--首页的问题--
147 if(getApp().globalData.config && getApp().globalData.config.store_name!=undefined && getApp().globalData.config.store_name!=null ){ 150 if(getApp().globalData.config && getApp().globalData.config.store_name!=undefined && getApp().globalData.config.store_name!=null ){
148 wx.setNavigationBarTitle({ 151 wx.setNavigationBarTitle({
@@ -192,8 +195,7 @@ Page({ @@ -192,8 +195,7 @@ Page({
192 flash_data = e.data.data.pageData; 195 flash_data = e.data.data.pageData;
193 if (flash_data == null || flash_data.length <= 0) return false; 196 if (flash_data == null || flash_data.length <= 0) return false;
194 197
195 - console.log('flash_data');  
196 - console.log(flash_data); 198 +
197 //当前时间戳 199 //当前时间戳
198 var nt = ut.gettimestamp(); 200 var nt = ut.gettimestamp();
199 console.log(nt); 201 console.log(nt);
@@ -212,7 +214,7 @@ Page({ @@ -212,7 +214,7 @@ Page({
212 th.setData({ 214 th.setData({
213 saleGoods: arr 215 saleGoods: arr
214 }); 216 });
215 - th.countDown(); 217 + //th.countDown();
216 } 218 }
217 }); 219 });
218 220
@@ -228,27 +230,39 @@ Page({ @@ -228,27 +230,39 @@ Page({
228 var e = res; 230 var e = res;
229 if (e.data.code == 0) { 231 if (e.data.code == 0) {
230 var pd_data = e.data.data.pageData; 232 var pd_data = e.data.data.pageData;
231 - console.log("拼团列表的所有的数据在这里", pd_data); 233 +
232 if (pd_data.length == 0) return; 234 if (pd_data.length == 0) return;
233 -  
234 - //当前时间戳 235 +
  236 + //获取当前
235 var nt = ut.gettimestamp(); 237 var nt = ut.gettimestamp();
236 pd_data.forEach(function (val,ind) { 238 pd_data.forEach(function (val,ind) {
237 if(val.start_time>nt) pd_data[ind].status=0; 239 if(val.start_time>nt) pd_data[ind].status=0;
238 else if(val.end_time>nt) pd_data[ind].status=1; 240 else if(val.end_time>nt) pd_data[ind].status=1;
239 if(val.buy_num>=val.goods_num) pd_data[ind].status=2; 241 if(val.buy_num>=val.goods_num) pd_data[ind].status=2;
240 }); 242 });
241 - 243 +
  244 + //获取当前时间,比较拼团中还在未开始
  245 + var timestamp = new Date().getTime();
  246 + var is_team_tepy;
  247 + for (var j = 0; j < pd_data.length;j++ ){
  248 + pd_data[j].is_team_tepy = 1;
  249 + if (timestamp<pd_data[j].start_time*1000){
  250 + var is_team_tepy;
  251 + pd_data[j].is_team_tepy = 0;
  252 + }
  253 + }
  254 +
242 var arr = new Array(); 255 var arr = new Array();
243 //--2个2个一组--- 256 //--2个2个一组---
244 for(var i=0;i< pd_data.length;i+=2){ 257 for(var i=0;i< pd_data.length;i+=2){
  258 +
245 arr.push(pd_data.slice(i,i+2)); 259 arr.push(pd_data.slice(i,i+2));
246 } 260 }
247 261
248 th.setData({ 262 th.setData({
249 pindGoods: arr 263 pindGoods: arr
250 }); 264 });
251 - //th.countDown2(); 265 + th.countDown2();
252 } 266 }
253 }) 267 })
254 268
@@ -463,6 +477,9 @@ Page({ @@ -463,6 +477,9 @@ Page({
463 //----拼单倒计时函数----- 477 //----拼单倒计时函数-----
464 countDown2() { 478 countDown2() {
465 if(!this.data.is_timer) return false; 479 if(!this.data.is_timer) return false;
  480 +
  481 +
  482 +
466 var th = this; 483 var th = this;
467 // 获取当前时间,同时得到活动结束时间数组 484 // 获取当前时间,同时得到活动结束时间数组
468 var newTime = ut.gettimestamp(); 485 var newTime = ut.gettimestamp();
@@ -500,6 +517,9 @@ Page({ @@ -500,6 +517,9 @@ Page({
500 } 517 }
501 } 518 }
502 var txt = "pindGoods[" + j + "][" + i + "].djs"; 519 var txt = "pindGoods[" + j + "][" + i + "].djs";
  520 +
  521 +
  522 +
503 th.setData({ 523 th.setData({
504 [txt]: obj 524 [txt]: obj
505 }); 525 });
pages/index/index/index.wxml
1 <!--普通界面--> 1 <!--普通界面-->
2 <wxs module="filter" src="../../../utils/filter.wxs"></wxs> 2 <wxs module="filter" src="../../../utils/filter.wxs"></wxs>
3 <view class="container rel" wx:if="{{ishow}}"> 3 <view class="container rel" wx:if="{{ishow}}">
4 -<block wx:if="{{banner}}"> 4 +<block wx:if="{{banner}}">
5 <image class="xc-top-img abs" src="{{url}}/miniapp/images/top-img.png"></image> 5 <image class="xc-top-img abs" src="{{url}}/miniapp/images/top-img.png"></image>
6 </block> 6 </block>
7 <!--搜索框--> 7 <!--搜索框-->
@@ -199,23 +199,33 @@ @@ -199,23 +199,33 @@
199 199
200 </navigator> 200 </navigator>
201 <view class="flex left"> 201 <view class="flex left">
202 - <view class="tneirong red-b flex-vertical rel"> 202 + <view class="tneirong red-b flex-vertical rel" wx:if="{{aitem.is_team_tepy!=0}}">
203 <image class="xc-team-img abs" src="{{url}}/miniapp/images/fril.png"></image> 203 <image class="xc-team-img abs" src="{{url}}/miniapp/images/fril.png"></image>
204 已拼{{aitem.buy_num}}份</view> 204 已拼{{aitem.buy_num}}份</view>
205 <view class="fs20 flex xc-people-val-frame" 205 <view class="fs20 flex xc-people-val-frame"
206 - style="border-color:{{type==1?'#059de5':'#d60021'}};margin-left:8rpx">  
207 - <view class=" flex-center val-img {{type==1?'blue_b':'red-b'}}"> 206 + style="border-color:{{aitem.is_team_tepy==0?'#059de5':'#d60021'}};margin-left:{{aitem.is_team_tepy==0?'':'8rpx'}}">
  207 + <view class=" flex-center val-img {{aitem.is_team_tepy==0?'blue_b':'red-b'}}">
208 <image class="people-img"src="{{url}}/miniapp/images/bai-ren.png"></image> 208 <image class="people-img"src="{{url}}/miniapp/images/bai-ren.png"></image>
209 </view> 209 </view>
210 - <text class="{{type==1?'blue_c':'red-co'}}" style="margin-left:8rpx; margin-right:8rpx">{{aitem.ct_num}}人团</text> 210 + <text class="{{aitem.is_team_tepy==0?'blue_c':'red-co'}}" style="margin-left:8rpx; margin-right:8rpx">{{aitem.ct_num}}人团</text>
211 </view> 211 </view>
  212 +
  213 + <view class="fs20 blue_c time-blue" wx:if="{{aitem.is_team_tepy==0}}">
  214 + 距开始:
  215 + <text class='tui-conutdown-box'>{{aitem.djs.day}}</text>天
  216 + <text class='tui-conutdown-box'>{{aitem.djs.hou}}</text>时
  217 + <text class='tui-conutdown-box'>{{aitem.djs.min}}</text>分
  218 + <text class='tui-conutdown-box tui-countdown-bg'>{{aitem.djs.sec}}</text>
  219 + 秒
  220 + </view>
212 </view> 221 </view>
  222 +
213 223
214 <view class="goods-num"style="margin-top:{{type==0?'70rpx':'40rpx'}}"> 224 <view class="goods-num"style="margin-top:{{type==0?'70rpx':'40rpx'}}">
215 <view> 225 <view>
216 226
217 - <view class="fs40 flex xc-top15 {{type==1?'blue_c':' red-co ai-bas'}}">  
218 - <text class="fs28 {{type==0?'martop13':''}}">¥</text> 227 + <view class="fs40 flex xc-top15 {{aitem.is_team_tepy==0?'blue_c':' red-co ai-bas'}}">
  228 + <text class="fs28 {{aitem.is_team_tepy==0?'martop4':''}}">¥</text>
219 <text style="margin-left:-5rpx">{{aitem.price}}</text> 229 <text style="margin-left:-5rpx">{{aitem.price}}</text>
220 <span class="underline {{type==0?'martop18':''}}">零售价¥{{aitem.market_price}}</span> 230 <span class="underline {{type==0?'martop18':''}}">零售价¥{{aitem.market_price}}</span>
221 </view> 231 </view>
pages/index/index/index.wxss
@@ -499,10 +499,10 @@ margin-top: 10rpx; @@ -499,10 +499,10 @@ margin-top: 10rpx;
499 } 499 }
500 .xc-top15{ 500 .xc-top15{
501 padding-top: 15rpx; 501 padding-top: 15rpx;
502 - margin-top: 4rpx; 502 + margin-top: 43rpx;
503 } 503 }
504 .underline { 504 .underline {
505 - text-decoration: line-through; color:#999999; font-size: 20rpx; margin-left: 5rpx; 505 + text-decoration: line-through; color:#999999; font-size: 20rpx; margin-left: 5rpx;margin-top: 5rpx;
506 } 506 }
507 .navigator.navwidth{ 507 .navigator.navwidth{
508 width: 100%; 508 width: 100%;
@@ -708,4 +708,11 @@ left: 43%; @@ -708,4 +708,11 @@ left: 43%;
708 } 708 }
709 .m-left{ 709 .m-left{
710 margin-left: 18rpx; 710 margin-left: 18rpx;
  711 +}
  712 +.martop4{
  713 +margin-top: 4rpx;
  714 +
  715 +}
  716 +.time-blue{
  717 +margin-left: 10rpx;
711 } 718 }
712 \ No newline at end of file 719 \ No newline at end of file