| @@ -24,7 +24,8 @@ Page({ | |||||
| min: "00", | min: "00", | ||||
| sec: "00", | sec: "00", | ||||
| paramData:null, | paramData:null, | ||||
| showErr:false | |||||
| showErr:false, | |||||
| showTime:true | |||||
| }, | }, | ||||
| /** | /** | ||||
| @@ -109,13 +110,17 @@ Page({ | |||||
| d1: sec | d1: sec | ||||
| } | } | ||||
| }, | }, | ||||
| countdown(end_time) { | |||||
| countdown(time) { | |||||
| let that = this; | 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 NowTime = new Date().getTime(); | ||||
| var total_micro_second = EndTime - NowTime || []; | var total_micro_second = EndTime - NowTime || []; | ||||
| // 渲染倒计时时钟 | // 渲染倒计时时钟 | ||||
| let obj = that.dateformat(total_micro_second); | let obj = that.dateformat(total_micro_second); | ||||
| console.log(obj) | |||||
| if (total_micro_second > 0) { | if (total_micro_second > 0) { | ||||
| that.setData({ | that.setData({ | ||||
| clock: obj, | clock: obj, | ||||
| @@ -126,17 +131,21 @@ Page({ | |||||
| }) | }) | ||||
| } else { | } else { | ||||
| that.setData({ | that.setData({ | ||||
| // spellData:null, | |||||
| clock: "00", | clock: "00", | ||||
| day: "0", | |||||
| day: "00", | |||||
| hour: "00", | hour: "00", | ||||
| min: "00", | min: "00", | ||||
| sec: "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 () { | onShow: function () { | ||||
| this.setData({ | this.setData({ | ||||
| canSpell: true, | canSpell: true, | ||||
| canBuyIf: true | |||||
| canBuyIf: true, | |||||
| showTime: true | |||||
| }) | }) | ||||
| if (this.data.spellData != null) { | |||||
| this.countdown() | |||||
| } | |||||
| }, | }, | ||||
| /** | /** | ||||
| * 生命周期函数--监听页面隐藏 | * 生命周期函数--监听页面隐藏 | ||||
| */ | */ | ||||
| onHide: function () { | onHide: function () { | ||||
| }, | }, | ||||
| /** | /** | ||||
| * 生命周期函数--监听页面卸载 | * 生命周期函数--监听页面卸载 | ||||
| */ | */ | ||||
| onUnload: function () { | onUnload: function () { | ||||
| this.setData({ | |||||
| showTime: false | |||||
| }) | |||||
| }, | }, | ||||
| /** | /** | ||||
| @@ -69,7 +69,7 @@ | |||||
| <view class='al-top'> | <view class='al-top'> | ||||
| <image src='{{orderGroupFail}}' mode="widthFix"></image> | <image src='{{orderGroupFail}}' mode="widthFix"></image> | ||||
| </view> | </view> | ||||
| <view class='al-center'>好友的拼团已完成,您的退款将在24小时内返回到您的支付账号</view> | |||||
| <view class='al-center'>您的拼团未成功,退款将在24小时内返回到您的支付账号</view> | |||||
| <view class='al-bottom' bindtap='gotoIndex'>返回首页</view> | <view class='al-bottom' bindtap='gotoIndex'>返回首页</view> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| @@ -129,13 +129,17 @@ Page({ | |||||
| d1: sec | d1: sec | ||||
| } | } | ||||
| }, | }, | ||||
| countdown(end_time) { | |||||
| countdown(time) { | |||||
| let that = this; | 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 NowTime = new Date().getTime(); | ||||
| var total_micro_second = EndTime - NowTime || []; | var total_micro_second = EndTime - NowTime || []; | ||||
| // 渲染倒计时时钟 | // 渲染倒计时时钟 | ||||
| let obj = that.dateformat(total_micro_second); | let obj = that.dateformat(total_micro_second); | ||||
| console.log(obj) | |||||
| if (total_micro_second > 0) { | if (total_micro_second > 0) { | ||||
| that.setData({ | that.setData({ | ||||
| clock: obj, | clock: obj, | ||||
| @@ -146,17 +150,21 @@ Page({ | |||||
| }) | }) | ||||
| } else { | } else { | ||||
| that.setData({ | that.setData({ | ||||
| // data:null, | |||||
| clock: "00", | clock: "00", | ||||
| day: "0", | |||||
| day: "00", | |||||
| hour: "00", | hour: "00", | ||||
| min: "00", | min: "00", | ||||
| sec: "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() { | gotoClose() { | ||||
| @@ -183,7 +191,7 @@ Page({ | |||||
| wx.stopPullDownRefresh(); | wx.stopPullDownRefresh(); | ||||
| let data = res.data; | let data = res.data; | ||||
| data.statustext = that.changeSatus(data.status); | data.statustext = that.changeSatus(data.status); | ||||
| if (data.status != 11) { | |||||
| if (data.status ==10) { | |||||
| that.countdown(data.expiredDate); | that.countdown(data.expiredDate); | ||||
| } | } | ||||
| data.salePrice = (data.salePrice / 100).toFixed(2) | data.salePrice = (data.salePrice / 100).toFixed(2) | ||||
| @@ -212,7 +220,12 @@ Page({ | |||||
| * 生命周期函数--监听页面显示 | * 生命周期函数--监听页面显示 | ||||
| */ | */ | ||||
| onShow: function () { | 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 () { | onUnload: function () { | ||||
| }, | |||||
| this.setData({ | |||||
| showTime: false | |||||
| }) | |||||
| }, | |||||
| /** | /** | ||||
| * 页面相关事件处理函数--监听用户下拉动作 | * 页面相关事件处理函数--监听用户下拉动作 | ||||
| @@ -21,6 +21,7 @@ Page({ | |||||
| hour: "00", | hour: "00", | ||||
| min: "00", | min: "00", | ||||
| sec: "00", | sec: "00", | ||||
| showTime:true | |||||
| }, | }, | ||||
| /** | /** | ||||
| @@ -90,13 +91,17 @@ Page({ | |||||
| d1: sec | d1: sec | ||||
| } | } | ||||
| }, | }, | ||||
| countdown(end_time) { | |||||
| countdown(time) { | |||||
| let that = this; | 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 NowTime = new Date().getTime(); | ||||
| var total_micro_second = EndTime - NowTime || []; | var total_micro_second = EndTime - NowTime || []; | ||||
| // 渲染倒计时时钟 | // 渲染倒计时时钟 | ||||
| let obj = that.dateformat(total_micro_second); | let obj = that.dateformat(total_micro_second); | ||||
| console.log(obj) | |||||
| if (total_micro_second > 0) { | if (total_micro_second > 0) { | ||||
| that.setData({ | that.setData({ | ||||
| clock: obj, | clock: obj, | ||||
| @@ -116,10 +121,12 @@ Page({ | |||||
| }) | }) | ||||
| // that.getOneSpell(that.data.couponId) | // 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 () { | onShow: function () { | ||||
| this.setData({ | this.setData({ | ||||
| canSpell:true, | canSpell:true, | ||||
| canBuyIf:true | |||||
| canBuyIf:true, | |||||
| showTime: true | |||||
| }) | }) | ||||
| if(this.data.spellData!=null){ | |||||
| this.countdown() | |||||
| } | |||||
| }, | }, | ||||
| /** | /** | ||||
| * 生命周期函数--监听页面隐藏 | * 生命周期函数--监听页面隐藏 | ||||
| */ | */ | ||||
| onHide: function () { | onHide: function () { | ||||
| }, | }, | ||||
| /** | /** | ||||
| * 生命周期函数--监听页面卸载 | * 生命周期函数--监听页面卸载 | ||||
| */ | */ | ||||
| onUnload: function () { | onUnload: function () { | ||||
| this.setData({ | |||||
| showTime: false | |||||
| }) | |||||
| }, | }, | ||||
| /** | /** | ||||
| @@ -24,6 +24,7 @@ | |||||
| </view> | </view> | ||||
| <view class='status02 st'>{{spellData.nickName}}的团还差<view class='r-p-num'>1人</view></view> | <view class='status02 st'>{{spellData.nickName}}的团还差<view class='r-p-num'>1人</view></view> | ||||
| <view class='status03 st'> | <view class='status03 st'> | ||||
| <view class='mm'>{{day}}</view><text style='font-size:32rpx;'> 天 </text> | |||||
| <view class='hh'>{{hour}}</view>: | <view class='hh'>{{hour}}</view>: | ||||
| <view class='mm'>{{min}}</view>: | <view class='mm'>{{min}}</view>: | ||||
| <view class='ss'>{{sec}}</view> | <view class='ss'>{{sec}}</view> | ||||
| @@ -104,7 +104,7 @@ | |||||
| .status03{ | .status03{ | ||||
| /* width: 160rpx; */ | /* width: 160rpx; */ | ||||
| float: left; | float: left; | ||||
| padding-left: 80rpx; | |||||
| padding-left: 10rpx; | |||||
| color: #F74812; | color: #F74812; | ||||
| } | } | ||||
| .hh,.mm,.ss{ | .hh,.mm,.ss{ | ||||
| @@ -123,7 +123,7 @@ | |||||
| } | } | ||||
| .status04{ | .status04{ | ||||
| float: left; | float: left; | ||||
| width: 163rpx; | |||||
| width: 146rpx; | |||||
| } | } | ||||
| .s-button{ | .s-button{ | ||||
| background:#ED3D2E; | background:#ED3D2E; | ||||