From 96921c5b395f27d86c7501527d94e36a8d04348d Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Sat, 9 Jun 2018 19:58:01 +0800 Subject: [PATCH] no message --- pages/activity_detail/activity_detail.js | 43 ++++++++++++------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/pages/activity_detail/activity_detail.js b/pages/activity_detail/activity_detail.js index 46f3987..14459af 100644 --- a/pages/activity_detail/activity_detail.js +++ b/pages/activity_detail/activity_detail.js @@ -67,6 +67,7 @@ Page({ getActivityDetail: function () { let that = this; + that.stopInterval(); wx.showNavigationBarLoading(); //在标题栏中显示加载 var url = ""; var data = {}; @@ -75,7 +76,7 @@ Page({ } else { url = "/mall/wxa/activity/detail"; } - console.log('msg>>>' + that.data.activityNo + ',' + that.data.groupNo); + console.log("getActivityDetail>>groupNo>>>" + that.data.groupNo); wx.request({ url: app.gw.hostUrl + url, method: 'get', @@ -91,7 +92,6 @@ Page({ console.log(res); var data = res.data; var status = data.code; - console.log(res); if (status == 0) { that.setData({ activityDetail: data.response, @@ -182,7 +182,8 @@ Page({ buttomText: '重新开团', grounpInfo: "block", grounpInfo2: "none", - remarkText: "已退款", + remark: "none", + remarkText: "", }); } } @@ -218,12 +219,25 @@ Page({ }) }, + stopInterval: function () { + if (interval != undefined) { + clearInterval(interval); + interval = undefined + } + this.setData({ + countDownDay: '00', + countDownHour: '00', + countDownMinute: '00', + countDownSecond: '00', + }); + }, + /** *活动倒计时方法 */ countActivityTime: function (timeStamp) { var totalSecond = timeStamp - 1; - console.log("countActivityTime>>>" + timeStamp) + // totalSecond = 20; if (totalSecond < 0 || interval != undefined) { return } @@ -234,17 +248,14 @@ Page({ var day = Math.floor(second / 3600 / 24); var dayStr = day.toString(); if (dayStr.length == 1) dayStr = '0' + dayStr; - // 小时位 var hr = Math.floor((second - day * 3600 * 24) / 3600); var hrStr = hr.toString(); if (hrStr.length == 1) hrStr = '0' + hrStr; - // 分钟位 var min = Math.floor((second - day * 3600 * 24 - hr * 3600) / 60); var minStr = min.toString(); if (minStr.length == 1) minStr = '0' + minStr; - // 秒位 var sec = second - day * 3600 * 24 - hr * 3600 - min * 60; var secStr = sec.toString(); @@ -258,14 +269,8 @@ Page({ }); totalSecond--; if (totalSecond < 0) { - clearInterval(interval); + this.stopInterval(); this.getActivityDetail(); - this.setData({ - countDownDay: '00', - countDownHour: '00', - countDownMinute: '00', - countDownSecond: '00', - }); } }.bind(this), 1000); }, @@ -339,7 +344,6 @@ Page({ //开团与参团 groupOpenOrJoin: function (url) { let that = this; - wx.showToast({ title: '正在调起支付', icon: 'loading' @@ -357,7 +361,7 @@ Page({ 'sessionId': wx.getStorageSync('sessionId') }, success: function (res) { - //--init data + //--init data let data = res.data; let status = data.code; if (status != 0) { @@ -371,7 +375,6 @@ Page({ that.setData({ groupNo: data.response.orderNo == undefined ? that.data.groupNo : data.response.orderNo, }); - console.log(data.response); let dr = data.response.weixinTransParameters; console.log(dr); wx.requestPayment({//微信支付 @@ -433,10 +436,8 @@ Page({ * 生命周期函数--监听页面卸载 */ onUnload: function () { - if (interval != undefined){ - clearInterval(interval); - interval = undefined - } + this.topInterval(); + }, /**