|
|
@ -47,7 +47,7 @@ |
|
|
|
立即抢购 |
|
|
|
立即抢购 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="page-footer" v-if="!isDeadLine"> |
|
|
|
<view class="page-footer" v-if="!isDeadLine"> |
|
|
|
还剩{{secondNum}}秒抢购 |
|
|
|
还剩{{finalSecondNum}}抢购 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -77,6 +77,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
secondNum:"", |
|
|
|
secondNum:"", |
|
|
|
isDeadLine:true, |
|
|
|
isDeadLine:true, |
|
|
|
|
|
|
|
finalSecondNum:"", |
|
|
|
timer:null, |
|
|
|
timer:null, |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -104,32 +105,40 @@ export default { |
|
|
|
expire_time=parseInt(expire_time/1000);//过期时间 |
|
|
|
expire_time=parseInt(expire_time/1000);//过期时间 |
|
|
|
return expire_time-timestamp; |
|
|
|
return expire_time-timestamp; |
|
|
|
}, |
|
|
|
}, |
|
|
|
// dateCalculation (second) { //返回天、时、分 |
|
|
|
//秒数转化为时分秒 |
|
|
|
// if (second > 0) { |
|
|
|
formatSeconds(value) { |
|
|
|
// var day = 0; |
|
|
|
var secondTime = parseInt(value);// 秒 |
|
|
|
// var hour = 0; |
|
|
|
var minuteTime = 0;// 分 |
|
|
|
// var minute = 0; |
|
|
|
var hourTime = 0;// 小时 |
|
|
|
// var secondNum = 0; |
|
|
|
if(secondTime > 60) {//如果秒数大于60,将秒数转换成整数 |
|
|
|
// var data = {}; |
|
|
|
//获取分钟,除以60取整数,得到整数分钟 |
|
|
|
// minute = Math.floor(second / (60)) |
|
|
|
minuteTime = parseInt(secondTime / 60); |
|
|
|
// if (parseInt(secondNum) > 60) { |
|
|
|
//获取秒数,秒数取余,得到整数秒数 |
|
|
|
// minute = parseInt(secondNum / 60); |
|
|
|
secondTime = parseInt(secondTime % 60); |
|
|
|
// minute %= 60; //算出有多分钟 |
|
|
|
//如果分钟大于60,将分钟转换成小时 |
|
|
|
// } |
|
|
|
if(minuteTime > 60) { |
|
|
|
// if (parseInt(minute) > 60) { |
|
|
|
//获取小时,获取分钟除以60,得到整数小时 |
|
|
|
// hour = parseInt(minute / 60); |
|
|
|
hourTime = parseInt(minuteTime / 60); |
|
|
|
// minute %= 60; //算出有多分钟 |
|
|
|
//获取小时后取余的分,获取分钟除以60取余的分 |
|
|
|
// } |
|
|
|
minuteTime = parseInt(minuteTime % 60); |
|
|
|
// if (parseInt(hour) > 24) { |
|
|
|
} |
|
|
|
// day = parseInt(hour / 24); |
|
|
|
} |
|
|
|
// hour %= 24; //算出有多分钟 |
|
|
|
var result = "" + parseInt(secondTime) + "秒"; |
|
|
|
// } |
|
|
|
|
|
|
|
// data.day = day; |
|
|
|
if(minuteTime > 0) { |
|
|
|
// data.hour = hour; |
|
|
|
result = "" + parseInt(minuteTime) + "分" + result; |
|
|
|
// data.minute = minute; |
|
|
|
}else{ |
|
|
|
// return data; |
|
|
|
result = "00时" + "00" + "分" + result; |
|
|
|
// } |
|
|
|
} |
|
|
|
// }, |
|
|
|
if(hourTime > 0) { |
|
|
|
|
|
|
|
result = "" + parseInt(hourTime) + "时" + result; |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
result = "00时" + result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// console.log('result',result); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
timestampToTime(val) { |
|
|
|
timestampToTime(val) { |
|
|
|
var date = new Date(); |
|
|
|
var date = new Date(); |
|
|
|
var Y = date.getFullYear() + '-'; |
|
|
|
var Y = date.getFullYear() + '-'; |
|
|
@ -156,7 +165,9 @@ export default { |
|
|
|
let finishTime = this.dateDifference(new Date(time).getTime()) |
|
|
|
let finishTime = this.dateDifference(new Date(time).getTime()) |
|
|
|
if(finishTime>0){ |
|
|
|
if(finishTime>0){ |
|
|
|
this.timer = setInterval(()=>{ |
|
|
|
this.timer = setInterval(()=>{ |
|
|
|
this.secondNum = finishTime-- |
|
|
|
let secondNum = finishTime--; |
|
|
|
|
|
|
|
this.secondNum = secondNum; |
|
|
|
|
|
|
|
this.finalSecondNum = this.formatSeconds(this.secondNum) |
|
|
|
},1000) |
|
|
|
},1000) |
|
|
|
this.isDeadLine = false; |
|
|
|
this.isDeadLine = false; |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|