diff --git a/pages/joinFrDpell/index.js b/pages/joinFrDpell/index.js index 34fd949..a26c1bc 100644 --- a/pages/joinFrDpell/index.js +++ b/pages/joinFrDpell/index.js @@ -24,7 +24,8 @@ Page({ min: "00", sec: "00", paramData:null, - showErr:false + showErr:false, + showTime:true }, /** @@ -109,13 +110,17 @@ Page({ d1: sec } }, - countdown(end_time) { + countdown(time) { let that = this; - var EndTime = end_time; + var EndTime = time; + if (that.data.spellData != null) { + EndTime = that.data.spellData.expiredDate; + } var NowTime = new Date().getTime(); var total_micro_second = EndTime - NowTime || []; // 渲染倒计时时钟 let obj = that.dateformat(total_micro_second); + console.log(obj) if (total_micro_second > 0) { that.setData({ clock: obj, @@ -126,17 +131,21 @@ Page({ }) } else { that.setData({ + // spellData:null, clock: "00", - day: "0", + day: "00", hour: "00", min: "00", sec: "00", }) + // that.getOneSpell(that.data.couponId) + } + if (that.data.showTime) { + setTimeout(function () { + total_micro_second -= 1000; + that.countdown(); + }, 1000) } - setTimeout(function () { - total_micro_second -= 1000; - that.countdown(end_time); - }, 1000) }, /** * 发起拼团 @@ -457,22 +466,28 @@ Page({ onShow: function () { this.setData({ canSpell: true, - canBuyIf: true + canBuyIf: true, + showTime: true }) + if (this.data.spellData != null) { + this.countdown() + } }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { - + }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { - + this.setData({ + showTime: false + }) }, /** diff --git a/pages/joinFrDpell/index.wxml b/pages/joinFrDpell/index.wxml index 74be753..fdddf40 100644 --- a/pages/joinFrDpell/index.wxml +++ b/pages/joinFrDpell/index.wxml @@ -69,7 +69,7 @@ - 好友的拼团已完成,您的退款将在24小时内返回到您的支付账号 + 您的拼团未成功,退款将在24小时内返回到您的支付账号 返回首页 \ No newline at end of file diff --git a/pages/spellDetail/index.js b/pages/spellDetail/index.js index 1d36555..a114835 100644 --- a/pages/spellDetail/index.js +++ b/pages/spellDetail/index.js @@ -129,13 +129,17 @@ Page({ d1: sec } }, - countdown(end_time) { + countdown(time) { let that = this; - var EndTime = end_time; + var EndTime = time; + if (that.data.data != null && that.data.data.status==10) { + EndTime = that.data.data.expiredDate; + } var NowTime = new Date().getTime(); var total_micro_second = EndTime - NowTime || []; // 渲染倒计时时钟 let obj = that.dateformat(total_micro_second); + console.log(obj) if (total_micro_second > 0) { that.setData({ clock: obj, @@ -146,17 +150,21 @@ Page({ }) } else { that.setData({ + // data:null, clock: "00", - day: "0", + day: "00", hour: "00", min: "00", sec: "00", }) + // that.getOneSpell(that.data.couponId) + } + if (that.data.showTime) { + setTimeout(function () { + total_micro_second -= 1000; + that.countdown(); + }, 1000) } - setTimeout(function () { - total_micro_second -= 1000; - that.countdown(end_time); - }, 1000) }, //关闭弹框 gotoClose() { @@ -183,7 +191,7 @@ Page({ wx.stopPullDownRefresh(); let data = res.data; data.statustext = that.changeSatus(data.status); - if (data.status != 11) { + if (data.status ==10) { that.countdown(data.expiredDate); } data.salePrice = (data.salePrice / 100).toFixed(2) @@ -212,7 +220,12 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + this.setData({ + showTime: false + }) + if (this.data.data != null&&this.data.data.status ==10) { + this.countdown() + } }, /** @@ -226,8 +239,10 @@ Page({ * 生命周期函数--监听页面卸载 */ onUnload: function () { - - }, + this.setData({ + showTime: false + }) + }, /** * 页面相关事件处理函数--监听用户下拉动作 diff --git a/pages/spellGroup/mySpellGroup/index.js b/pages/spellGroup/mySpellGroup/index.js index 70ec430..9e96ad2 100644 --- a/pages/spellGroup/mySpellGroup/index.js +++ b/pages/spellGroup/mySpellGroup/index.js @@ -21,6 +21,7 @@ Page({ hour: "00", min: "00", sec: "00", + showTime:true }, /** @@ -90,13 +91,17 @@ Page({ d1: sec } }, - countdown(end_time) { + countdown(time) { let that = this; - var EndTime = end_time; + var EndTime = time; + if (that.data.spellData!=null){ + EndTime = that.data.spellData.expiredDate; + } var NowTime = new Date().getTime(); var total_micro_second = EndTime - NowTime || []; // 渲染倒计时时钟 let obj = that.dateformat(total_micro_second); + console.log(obj) if (total_micro_second > 0) { that.setData({ clock: obj, @@ -116,10 +121,12 @@ Page({ }) // that.getOneSpell(that.data.couponId) } - setTimeout(function () { - total_micro_second -= 1000; - that.countdown(end_time); - }, 1000) + if(that.data.showTime){ + setTimeout(function () { + total_micro_second -= 1000; + that.countdown(); + }, 1000) + } }, /** * 发起拼团 @@ -442,22 +449,28 @@ Page({ onShow: function () { this.setData({ canSpell:true, - canBuyIf:true + canBuyIf:true, + showTime: true }) + if(this.data.spellData!=null){ + this.countdown() + } }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { - + }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { - + this.setData({ + showTime: false + }) }, /** diff --git a/pages/spellGroup/mySpellGroup/index.wxml b/pages/spellGroup/mySpellGroup/index.wxml index bb48cb9..198c0fd 100644 --- a/pages/spellGroup/mySpellGroup/index.wxml +++ b/pages/spellGroup/mySpellGroup/index.wxml @@ -24,6 +24,7 @@ {{spellData.nickName}}的团还差1人 + {{day}} {{hour}}: {{min}}: {{sec}} diff --git a/pages/spellGroup/mySpellGroup/index.wxss b/pages/spellGroup/mySpellGroup/index.wxss index fdcaad4..5ae5910 100644 --- a/pages/spellGroup/mySpellGroup/index.wxss +++ b/pages/spellGroup/mySpellGroup/index.wxss @@ -104,7 +104,7 @@ .status03{ /* width: 160rpx; */ float: left; - padding-left: 80rpx; + padding-left: 10rpx; color: #F74812; } .hh,.mm,.ss{ @@ -123,7 +123,7 @@ } .status04{ float: left; - width: 163rpx; + width: 146rpx; } .s-button{ background:#ED3D2E;