pull/1/head
liudan 1 year ago
parent 9251c47341
commit 5753ea20ad
  1. 67
      pages/qianggou/productDetails.vue

@ -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{

Loading…
Cancel
Save