From d923de19f34e85f116a372dbecf13767087454dc Mon Sep 17 00:00:00 2001 From: banche Date: Sat, 18 Dec 2021 10:47:38 +0800 Subject: [PATCH] 预售_组合购添加预热 --- packageB/pages/zuhegou/list/g_filter.wxs | 11 ++++++++++- packageB/pages/zuhegou/list/list.js | 56 ++++++++++++++++++++++++++++++++++++++++++-------------- packageB/pages/zuhegou/list/list.wxml | 18 ++++++++++-------- packageC/pages/group_list/group_list.js | 3 ++- packageC/pages/group_list/group_list.wxml | 15 +++++++++++++++ packageC/pages/group_list/group_list.wxss | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageC/pages/presell/list/list.js | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- packageC/pages/presell/list/list.wxml | 46 +++++++++++++++++++++++++++++++++++----------- 8 files changed, 267 insertions(+), 39 deletions(-) diff --git a/packageB/pages/zuhegou/list/g_filter.wxs b/packageB/pages/zuhegou/list/g_filter.wxs index 9719e7d..0015aca 100644 --- a/packageB/pages/zuhegou/list/g_filter.wxs +++ b/packageB/pages/zuhegou/list/g_filter.wxs @@ -20,10 +20,19 @@ var g_filters = { var tnow=getDate(); if(t1>=tnow) return 1; return 0; - } + }, + goToUrl: function(type, id, name) { + if (type == 1) { + return "/packageB/pages/zuhegou/index/index?id="+id+"&title="+name + } else { + return "/packageB/pages/zuhegou/preIndex/index?id="+id+"&title="+name + } + }, + } module.exports = { has_char: g_filters.has_char, beg_time: g_filters.beg_time, end_time: g_filters.end_time, + goToUrl: g_filters.goToUrl, } \ No newline at end of file diff --git a/packageB/pages/zuhegou/list/list.js b/packageB/pages/zuhegou/list/list.js index ce87de3..3060968 100644 --- a/packageB/pages/zuhegou/list/list.js +++ b/packageB/pages/zuhegou/list/list.js @@ -90,16 +90,17 @@ Page({ //----倒计时函数----- countDown() { + if(!this.data.is_timer) return false; var th=this; // 获取当前时间,同时得到活动结束时间数组 - let newTime =ut.gettimestamp(); - var endTimeList = this.data.goodlist; - if(endTimeList==null) return null + let newTime = ut.gettimestamp(); + var endTimeList = th.data.goodlist; + if(endTimeList == null) return null; // 对结束时间进行处理渲染到页面 for (var i = 0; i < endTimeList.length;i++){ var o = endTimeList[i]; - var endTime = o.end_time; + var endTime = o.start_time; if(th.data.type==0) endTime = o.start_time; let obj = null; // 如果活动未结束,对时间进行处理 @@ -122,23 +123,36 @@ Page({ } }, + // 请求活动列表 async requestSalelist() { //--没有更多就不调用-- if(!this.data.ismore) return false; - - var e = this,th=e, i = "/api/weshop/prom/zhbuy/page?is_end=0&timetype=1&page=" + e.data.currentPage; + var e = this, + th = e, + i = "/api/weshop/prom/zhbuy/page?is_end=0&timetype=" + this.data.type + "&page=" + e.data.currentPage; // var plist=null,alllist=th.data.goodlist; // if(!alllist) alllist=[]; - let {goodlist}=this.data; + let {goodlist} = this.data; const {data:res}=await getApp().request.promiseGet(i,{ isShowLoading:1, - data:{store_id:os.stoid,user_id:getApp().globalData.user_id} + data:{ + store_id: os.stoid, + user_id: getApp().globalData.user_id + } }) if(res.code==0 && res.data.pageData.length>0){ if(res.data.page>1){ - goodlist=goodlist.concat(res.data.pageData) + th.data.goodlist = goodlist.concat(res.data.pageData) }else{ - goodlist=res.data.pageData; + th.data.goodlist = res.data.pageData; + } + + if (th.data.type == 0) { + clearInterval(ot); + var ot = setInterval(function () { + th.countDown(); + }, 1000); + } }else{ @@ -146,14 +160,21 @@ Page({ th.data.ismore=0; } e.data.currentPage++; - th.setData({goodlist,isshow:1}); + th.setData({ + goodlist: th.data.goodlist, + isshow: 1 + }); }, + onPullDownRefresh: function() { this.reloadGoodList(); }, + reloadGoodList: function() { - this.data.goodlist = null, this.data.currentPage = 1, this.requestSalelist(); + this.data.goodlist = null; + this.data.currentPage = 1; + this.requestSalelist(); }, onReachBottom: function() { @@ -162,9 +183,16 @@ Page({ //点击tab事件 tip:function(e) { - var a=e.currentTarget.dataset.ty,th=this;th.data.ismore=1; - this.setData({type:a,goodlist:null}); + var a = e.currentTarget.dataset.ty, + th = this; + th.data.type = a; + th.data.ismore = 1; + this.setData({ + type:a, + goodlist: null + }); this.reloadGoodList(); + }, diff --git a/packageB/pages/zuhegou/list/list.wxml b/packageB/pages/zuhegou/list/list.wxml index bf1780c..d0b8c7e 100644 --- a/packageB/pages/zuhegou/list/list.wxml +++ b/packageB/pages/zuhegou/list/list.wxml @@ -34,26 +34,26 @@ - + - + {{item.name}} 组合数量: {{item.zhbuyqty}} 活动时间: {{filters.format_time(item.start_time) + '至' + filters.format_time(item.end_time)}} - + {{item.zhprice}} @@ -105,7 +105,9 @@ - + + - 没有相关内容 diff --git a/packageC/pages/group_list/group_list.js b/packageC/pages/group_list/group_list.js index 59e95d2..e949f67 100644 --- a/packageC/pages/group_list/group_list.js +++ b/packageC/pages/group_list/group_list.js @@ -9,7 +9,8 @@ Page({ * 页面的初始数据 */ data: { - // type:1, + url: a.imghost, + type:1, // goodlist: null, isLogin: false, diff --git a/packageC/pages/group_list/group_list.wxml b/packageC/pages/group_list/group_list.wxml index f64f2b4..a652211 100644 --- a/packageC/pages/group_list/group_list.wxml +++ b/packageC/pages/group_list/group_list.wxml @@ -31,3 +31,18 @@ + + + + + + + + 火热进行中 + + + 即将开始 + + \ No newline at end of file diff --git a/packageC/pages/group_list/group_list.wxss b/packageC/pages/group_list/group_list.wxss index 8c38c5c..aed06aa 100644 --- a/packageC/pages/group_list/group_list.wxss +++ b/packageC/pages/group_list/group_list.wxss @@ -55,4 +55,78 @@ page { text-align: center; /* margin-top: 10rpx; */ color: #ccc; +} + +.xc-seckill-bottom{ + position: fixed; +bottom: 0rpx; +width: 100%; + +} + +.xc-bottom{ + width: 45rpx; + height: 45rpx; + margin-right: 13rpx; +} +.xc-border-right{ + border-right: 4rpx solid #eee; + +} + +.kill-time .theader .timeac { + font-size: 32rpx; height:100%; width: 50%; + color: #333; background-color: #fff; + +} + +.kill-time .theader{ + display: flex; margin: 0 auto; align-items: center; + height: 100rpx; + +} + +.kill-time { + text-align: center; + justify-content: space-around; + align-items: center; + height: 101rpx; + border-bottom: 1px solid #ddd; + border-top: 1px solid #ddd; + background-color: #f6f6f6; +} +.kill-time .theader{ + display: flex; margin: 0 auto; align-items: center; + height: 100rpx; + +} +.kill-time .theader .timeac { + font-size: 32rpx; height:100%; width: 50%; + color: #333; background-color: #fff; + +} +/* .kill-time .theader .timeac.left{border-top-left-radius: 86rpx; border-bottom-left-radius: 86rpx;} +.kill-time .theader .timeac.right{border-top-right-radius: 86rpx; border-bottom-right-radius: 86rpx;} */ +.kill-time .theader .timeac.active{color: #c4182e} + +.kill-item { + display: flex; + justify-content: space-between; + background-color: #fff; + padding: 20rpx; + margin-bottom: 20rpx; + border-radius: 10rpx; + /* height: 249rpx; */ + align-items: center; +} + +.kill-pic { + width: 215rpx; + height: 215rpx; +} + +.kill-cont { + width: 465rpx; + margin-left:20rpx; + margin-right: 5rpx; } \ No newline at end of file diff --git a/packageC/pages/presell/list/list.js b/packageC/pages/presell/list/list.js index 3125e78..0667eff 100644 --- a/packageC/pages/presell/list/list.js +++ b/packageC/pages/presell/list/list.js @@ -11,6 +11,7 @@ Page({ isshow: 0, ad_data: null, max_sw_height: 200, + type: 1, }, //------初始化加载---------- @@ -117,7 +118,7 @@ Page({ store_id: os.stoid, page: this.data.page, pageSize: 10, - timetype: 1, + timetype: self.data.type, isuse:1 } if(getApp().globalData.userInfo){ @@ -131,7 +132,6 @@ Page({ getApp().request.get("/api/weshop/marketing/marketingPresellList/page", { data: req, success: function (res) { - console.log(res); self.data.loading = 0; if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { var list = self.data.goodlist ? self.data.goodlist : []; @@ -145,17 +145,92 @@ Page({ if (arr.length < 10) { self.setData({no_more: 1}) } + + // 预热活动设置倒计时 + if (self.data.type == 0) { + clearInterval(self.data.timer); + self.data.timer = setInterval(function () { + self.countDown(); + }, 1000); + + } } else { self.setData({no_more: 1}) } self.setData({is_get: 1}) - + } }) }, + + go_index:function () { getApp().goto("/pages/index/index/index"); - } + }, + + + tip: function(e){ + // 获取模板Data数据 1进行中 0预热中 + var typeValue = e.currentTarget.dataset.ty; + // 初始化数据 + this.data.type = typeValue; + this.data.loading = 0; + this.data.no_more = 0; + this.data.page = 1; + this.data.goodlist = []; + var goodslist = this.data.goodlist; + // 设置模板Data数据 + this.setData({ + type: typeValue, + goodlist: goodslist, + }); + // 请求接口数据 + this.get_list(); + }, + + //----倒计时函数----- + countDown() { + var th=this; + // 获取当前时间,同时得到活动结束时间数组 + let newTime = ut.gettimestamp(); + var endTimeList = this.data.goodlist; + if(endTimeList==null) return null + // 对结束时间进行处理渲染到页面 + for (var i = 0; i < endTimeList.length; i++){ + var o = endTimeList[i]; + var endTime = o.start_time; + let obj = null; + // 如果活动未结束,对时间进行处理 + if (endTime - newTime > 0){ + let time = (endTime - newTime); + // 获取天、时、分、秒 + let day = parseInt(time / (60 * 60 * 24)); + let hou = parseInt(time % (60 * 60 * 24) / 3600); + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); + obj = { + day: this.timeFormat(day), + hou: this.timeFormat(hou), + min: this.timeFormat(min), + sec: this.timeFormat(sec), + hide: 1 + } + }else{ + //活动已结束,全部设置为'00' + obj = { + day: '00', + hou: '00', + min: '00', + sec: '00' + } + } + var txt ="goodlist["+i+"].djs"; + th.setData({ [txt]: obj}); + } + }, + + + }); diff --git a/packageC/pages/presell/list/list.wxml b/packageC/pages/presell/list/list.wxml index 7af0bb6..7cfe9ff 100644 --- a/packageC/pages/presell/list/list.wxml +++ b/packageC/pages/presell/list/list.wxml @@ -37,7 +37,7 @@ - + 已预售{{filters.toFix((item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)}}% @@ -45,32 +45,56 @@ 库存还剩{{item.presell_sumqty-item.buy_goodnum}}件 - - + - + + 剩余: + {{item.djs.day}}天 + {{item.djs.hou}}时 + {{item.djs.min}}分 + {{item.djs.sec}}秒 + + ¥{{item.presell_price}} {{item.price}} 零售价¥{{item.market_price}} - - 去抢购 + 去抢购 + 即将开始 + - - - 去首页逛逛 - - -- 没有更多 -- + + + + -- 没有更多 -- + + + + + + + 火热进行中 + + + + + 即将开始 + + + + + + -- libgit2 0.21.4