From bb0d9f77b3700effceda938d017093cc069cd784 Mon Sep 17 00:00:00 2001 From: cheng.xu Date: Wed, 25 Sep 2019 09:45:43 +0800 Subject: [PATCH] 首页拼单修改 --- pages/index/index/index.js | 42 +++++++++++++++++++++++++++++++----------- pages/index/index/index.wxml | 24 +++++++++++++++++------- pages/index/index/index.wxss | 11 +++++++++-- 3 files changed, 57 insertions(+), 20 deletions(-) diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 4e5aa69..8422c53 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -75,8 +75,11 @@ Page({ }, + + async onShow() { var th=this; + await this.init_load(); //显示的时候要开启计时器 this.data.is_timer = 1; @@ -117,7 +120,7 @@ Page({ } }) }, - + //当隐藏的时候就关闭计时器 onHide:function(){ this.data.is_timer=0; @@ -141,8 +144,8 @@ Page({ th.setData({ template_arr: t_arr, isTemplate: 1, bgcolor_t: temp_data.bkcolor}); } }) - console.log("init_load"); - console.log(getApp().globalData.config); + + //--首页的问题-- if(getApp().globalData.config && getApp().globalData.config.store_name!=undefined && getApp().globalData.config.store_name!=null ){ wx.setNavigationBarTitle({ @@ -192,8 +195,7 @@ Page({ flash_data = e.data.data.pageData; if (flash_data == null || flash_data.length <= 0) return false; - console.log('flash_data'); - console.log(flash_data); + //当前时间戳 var nt = ut.gettimestamp(); console.log(nt); @@ -212,7 +214,7 @@ Page({ th.setData({ saleGoods: arr }); - th.countDown(); + //th.countDown(); } }); @@ -228,27 +230,39 @@ Page({ var e = res; if (e.data.code == 0) { var pd_data = e.data.data.pageData; - console.log("拼团列表的所有的数据在这里", pd_data); + if (pd_data.length == 0) return; - - //当前时间戳 + + //获取当前 var nt = ut.gettimestamp(); pd_data.forEach(function (val,ind) { if(val.start_time>nt) pd_data[ind].status=0; else if(val.end_time>nt) pd_data[ind].status=1; if(val.buy_num>=val.goods_num) pd_data[ind].status=2; }); - + + //获取当前时间,比较拼团中还在未开始 + var timestamp = new Date().getTime(); + var is_team_tepy; + for (var j = 0; j < pd_data.length;j++ ){ + pd_data[j].is_team_tepy = 1; + if (timestamp - + @@ -199,23 +199,33 @@ - + 已拼{{aitem.buy_num}}份 - + style="border-color:{{aitem.is_team_tepy==0?'#059de5':'#d60021'}};margin-left:{{aitem.is_team_tepy==0?'':'8rpx'}}"> + - {{aitem.ct_num}}人团 + {{aitem.ct_num}}人团 + + + 距开始: + {{aitem.djs.day}}天 + {{aitem.djs.hou}}时 + {{aitem.djs.min}}分 + {{aitem.djs.sec}} + 秒 + + - - + + {{aitem.price}} 零售价¥{{aitem.market_price}} diff --git a/pages/index/index/index.wxss b/pages/index/index/index.wxss index 145e8de..8e8b017 100644 --- a/pages/index/index/index.wxss +++ b/pages/index/index/index.wxss @@ -499,10 +499,10 @@ margin-top: 10rpx; } .xc-top15{ padding-top: 15rpx; - margin-top: 4rpx; + margin-top: 43rpx; } .underline { - text-decoration: line-through; color:#999999; font-size: 20rpx; margin-left: 5rpx; + text-decoration: line-through; color:#999999; font-size: 20rpx; margin-left: 5rpx;margin-top: 5rpx; } .navigator.navwidth{ width: 100%; @@ -708,4 +708,11 @@ left: 43%; } .m-left{ margin-left: 18rpx; +} +.martop4{ +margin-top: 4rpx; + +} +.time-blue{ +margin-left: 10rpx; } \ No newline at end of file -- libgit2 0.21.4