Переглянути джерело

拼团倒计时修改

tags/富茂链客4.1.0
刘晖 6 роки тому
джерело
коміт
66d23dea3e
6 змінених файлів з 78 додано та 34 видалено
  1. +26
    -11
      pages/joinFrDpell/index.js
  2. +1
    -1
      pages/joinFrDpell/index.wxml
  3. +26
    -11
      pages/spellDetail/index.js
  4. +22
    -9
      pages/spellGroup/mySpellGroup/index.js
  5. +1
    -0
      pages/spellGroup/mySpellGroup/index.wxml
  6. +2
    -2
      pages/spellGroup/mySpellGroup/index.wxss

+ 26
- 11
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
})
},

/**


+ 1
- 1
pages/joinFrDpell/index.wxml Переглянути файл

@@ -69,7 +69,7 @@
<view class='al-top'>
<image src='{{orderGroupFail}}' mode="widthFix"></image>
</view>
<view class='al-center'>好友的拼团已完成,您的退款将在24小时内返回到您的支付账号</view>
<view class='al-center'>您的拼团未成功,退款将在24小时内返回到您的支付账号</view>
<view class='al-bottom' bindtap='gotoIndex'>返回首页</view>
</view>
</view>

+ 26
- 11
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
})
},

/**
* 页面相关事件处理函数--监听用户下拉动作


+ 22
- 9
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
})
},

/**


+ 1
- 0
pages/spellGroup/mySpellGroup/index.wxml Переглянути файл

@@ -24,6 +24,7 @@
</view>
<view class='status02 st'>{{spellData.nickName}}的团还差<view class='r-p-num'>1人</view></view>
<view class='status03 st'>
<view class='mm'>{{day}}</view><text style='font-size:32rpx;'> 天 </text>
<view class='hh'>{{hour}}</view>:
<view class='mm'>{{min}}</view>:
<view class='ss'>{{sec}}</view>


+ 2
- 2
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;


Завантаження…
Відмінити
Зберегти