diff --git a/components/auto_go/auto_go.js b/components/auto_go/auto_go.js new file mode 100644 index 0000000..2acae76 --- /dev/null +++ b/components/auto_go/auto_go.js @@ -0,0 +1,31 @@ +Component({ + /*** 页面的初始数据***/ + data: { + msgStatus:false, + countDownNum:3, //默认3秒后跳转 + }, + methods: { + show:function (){ + this.setData({msgStatus:true,countDownNum:3}) + this.cut_down(); + }, + hide:function (){ + this.setData({msgStatus:false}) + }, + //定时器跳转 + cut_down(){ + if(this.data.countDownNum>0){ + var a=this.data.countDownNum-1; + this.setData({countDownNum:a}) + setTimeout(()=>{ + this.cut_down(); + },1000); + }else{ + this.hide(); + this.triggerEvent('childFun'); + } + } + } + + +}) \ No newline at end of file diff --git a/components/auto_go/auto_go.json b/components/auto_go/auto_go.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/auto_go/auto_go.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/auto_go/auto_go.wxml b/components/auto_go/auto_go.wxml new file mode 100644 index 0000000..b988843 --- /dev/null +++ b/components/auto_go/auto_go.wxml @@ -0,0 +1,6 @@ + + + 暂无进行中活动 + {{countDownNum}} 秒后自动跳到即将开始 + + diff --git a/components/auto_go/auto_go.wxss b/components/auto_go/auto_go.wxss new file mode 100644 index 0000000..ea1e6ef --- /dev/null +++ b/components/auto_go/auto_go.wxss @@ -0,0 +1,21 @@ +@import "../../app.wxss"; + +.no-data .cart-image { + width: 208rpx; + height: 202rpx; +} + +.no-data .no-data-title { + font-size: 28rpx; + color: #b8b8b8; + margin-bottom: 50rpx; +} + +.no-data .lookat { + display: inline-block; + font-size: 28rpx; + border-radius: 10rpx; + background-color: #e83028; + color: white; + padding: 20rpx 50rpx; +} \ No newline at end of file diff --git a/pages/activity/pind_list/pind_list.js b/pages/activity/pind_list/pind_list.js index 103b15d..28757d6 100644 --- a/pages/activity/pind_list/pind_list.js +++ b/pages/activity/pind_list/pind_list.js @@ -19,7 +19,8 @@ Page({ ad_data: null, max_sw_height: 200, is_retail_price:0, - isget:0 + isget:0, + msgStatus:false }, //------初始化加载---------- @@ -82,7 +83,7 @@ Page({ }, onShow: function (t) { - getApp().check_can_share(); + getApp().check_can_share(); this.data.is_timer = 1; this.data.currentPage = 1; this.data.ismore = 1; @@ -143,14 +144,11 @@ Page({ //读取数据 async requestSalelist() { if (!this.data.ismore) return false; - var e = this, - th = e, - i = "/api/weshop/teamlist/pageteam/" + th.data.type + "?page=" + e.data.currentPage; - var plist = [], - alllist = th.data.goodlist; + var e = this,th = e; + var i = "/api/weshop/teamlist/pageteam/" + th.data.type + "?page=" + e.data.currentPage; + var plist = [],alllist = th.data.goodlist; if (!alllist) alllist = []; - wx.showLoading(); await getApp().request.promiseGet(i, { isShowLoading: 0, @@ -166,10 +164,8 @@ Page({ if (plist.length <= 0) { - wx.hideLoading(); - getApp().showWarning("没有更多数据"); - th.data.ismore = 0; + th.data.ismore = 0; //没有数据切换 if (e.data.currentPage == 1 && this.data.type == 1) { @@ -184,13 +180,21 @@ Page({ user_id:getApp().globalData.user_id, } }).then(res => { - if(ut.ajax_ok(res)){ - plist = res.data.data.pageData; - th.setData({ type: 0 }); + th.data.b_plist = res.data.data.pageData; } }); + wx.hideLoading(); + if(th.data.b_plist){ + //组件的id + var auto_go = th.selectComponent("#auto_go"); + auto_go.show(); + + }else{ + getApp().showWarning("没有更多数据"); + } + // if(plist){ // setTimeout(function () { // th.data.ismore = 1; @@ -202,7 +206,12 @@ Page({ // } } + else{ + wx.hideLoading(); + getApp().showWarning("没有更多数据"); + } + return false; } if(plist) { @@ -220,7 +229,6 @@ Page({ } e.data.currentPage++; } - th.setData({ goodlist: alllist, isshow: 1, @@ -324,7 +332,7 @@ Page({ } }, - onShareTimeline() { + onShareTimeline() { getApp().globalData.no_clear=1; var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; if (!store_name) @@ -350,4 +358,44 @@ Page({ } }, + //-- 自动数数,要进行跳转 --- + async auto_back(){ + + var e=this,th=this; + th.setData({ type: 0 }); + wx.showLoading(); + + var plist=this.data.b_plist; + var alllist = th.data.goodlist; + if (!alllist) alllist = []; + + if(plist) { + //--循环读取接口--- + for (var i = 0; i < plist.length; i++) { + var prom_id = plist[i].id; + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + os.stoid + "/6/" + prom_id, {}).then(res => { + if (res.data.code == 0) { + plist[i].status = 1; + if (res.data.data <= 0) plist[i].status = 3; + } + }); + alllist.push(plist[i]); + } + e.data.currentPage++; + } + th.setData({ + goodlist: alllist, + isshow: 1, + is_get:1, + }); + + setTimeout(()=>{ + wx.hideLoading(); + },400) + + + } + + }); \ No newline at end of file diff --git a/pages/activity/pind_list/pind_list.json b/pages/activity/pind_list/pind_list.json index fe12943..8bcf364 100644 --- a/pages/activity/pind_list/pind_list.json +++ b/pages/activity/pind_list/pind_list.json @@ -1,6 +1,7 @@ { "navigationBarTitleText": "天天拼单", "usingComponents": { - "share_box": "/components/share_box/share_box" + "share_box": "/components/share_box/share_box", + "auto_go": "/components/auto_go/auto_go" } } \ No newline at end of file diff --git a/pages/activity/pind_list/pind_list.wxml b/pages/activity/pind_list/pind_list.wxml index 4060f18..366bbaa 100644 --- a/pages/activity/pind_list/pind_list.wxml +++ b/pages/activity/pind_list/pind_list.wxml @@ -105,8 +105,9 @@ 没有相关内容 - + + \ No newline at end of file diff --git a/pages/activity/seckill_list/seckill_list.js b/pages/activity/seckill_list/seckill_list.js index c4523b5..4fab619 100644 --- a/pages/activity/seckill_list/seckill_list.js +++ b/pages/activity/seckill_list/seckill_list.js @@ -11,7 +11,7 @@ Page({ killtime: null, currentPage: 1, goodlist: null, - type: 1, + type: 1, //1是进行中 0是即将开始 timer: null, ismore: 1, //是否可以加载更多 isshow: 0, @@ -167,6 +167,7 @@ Page({ if (!alllist) alllist = []; var user_id = getApp().globalData.user_id; if (!user_id) user_id = user_id; + var req = { store_id: os.stoid, timetype: th.data.type, @@ -182,23 +183,44 @@ Page({ data: req }).then(res => { if (ut.ajax_ok(res)) plist = res.data.data.pageData; - }); if (!plist || plist.length <= 0) { wx.hideLoading(); - getApp().showWarning("没有更多数据"); + th.data.ismore = 0; if (e.data.currentPage == 1 && this.data.type == 1) { - setTimeout(function () { - th.data.ismore = 1; - th.setData({ - type: 0 + + //-- 弄到即将开始 -- + req.timetype=0; + await getApp().request.promiseGet(i, { + isShowLoading: 0, + data: req + }).then(res => { + if (ut.ajax_ok(res)) th.data.b_plist = res.data.data.pageData; }); - th.requestSalelist(); - }, 1000); + + wx.hideLoading(); + if(th.data.b_plist){ + //组件的id + var auto_go = th.selectComponent("#auto_go"); + auto_go.show(); + }else{ + getApp().showWarning("没有更多数据"); + } + // setTimeout(function () { + // th.data.ismore = 1; + // th.setData({ + // type: 0 + // }); + // th.requestSalelist(); + // }, 1000); + }else{ + wx.hideLoading(); + getApp().showWarning("没有更多数据"); } + return false; } @@ -343,4 +365,42 @@ Page({ getApp().goto(url); } }, + + async auto_back(){ + + var e=this,th=this; + th.setData({ type: 0 }); + wx.showLoading(); + + var plist=this.data.b_plist; + var alllist = th.data.goodlist; + if (!alllist) alllist = []; + + //--循环读取接口--- + for (var i = 0; i < plist.length; i++) { + + if (plist[i].user_price) plist[i].price = plist[i].user_price; + var prom_id = plist[i].id; + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + os.stoid + "/1/" + prom_id, {} + ).then(res => { + if (res.data.code == 0) { + plist[i].status = 1; + if (res.data.data <= 0) plist[i].status = 3; + } + }) + alllist.push(plist[i]); + } + e.data.currentPage++; + console.log("秒杀商品列表", alllist); + th.setData({ + goodlist: alllist, + isshow: 1 + }); + + setTimeout(()=>{ + wx.hideLoading(); + },400) + } + }); \ No newline at end of file diff --git a/pages/activity/seckill_list/seckill_list.json b/pages/activity/seckill_list/seckill_list.json index e533db3..2ef2396 100644 --- a/pages/activity/seckill_list/seckill_list.json +++ b/pages/activity/seckill_list/seckill_list.json @@ -1,6 +1,7 @@ { "navigationBarTitleText": "商品秒杀", "usingComponents": { - "share_box": "/components/share_box/share_box" + "share_box": "/components/share_box/share_box", + "auto_go": "/components/auto_go/auto_go" } } \ No newline at end of file diff --git a/pages/activity/seckill_list/seckill_list.wxml b/pages/activity/seckill_list/seckill_list.wxml index 47c4576..fdffe35 100644 --- a/pages/activity/seckill_list/seckill_list.wxml +++ b/pages/activity/seckill_list/seckill_list.wxml @@ -99,8 +99,10 @@ - 没有相关内容 + + +