interval(completeTime) {
console.log("1");
let _this = this;
_this.timerCount = setInterval(() => {
setTimeout(() => {
let faultDate = new Date().getTime();
console.log(faultDate);
let stime = Date.parse(new Date(faultDate));
let etime = Date.parse(new Date(completeTime));
//两个时间戳相差的毫秒数
let timer = etime - stime;
if (timer > 0) {
_this.tipShow = true;
let days = Math.floor(timer / (1000 * 60 * 60 * 24));
let hours = Math.floor(
(timer % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
);
let minutes = Math.floor((timer % (1000 * 60 * 60)) / (1000 * 60));
let seconds = Math.floor((timer % (1000 * 60)) / 1000);
if (days <= 0) {
_this.tips = hours + "时" + minutes + "分" + seconds + "秒";
} else {
_this.tips =
days + "天" + hours + "时" + minutes + "分" + seconds + "秒";
}
console.log(_this.tips);
--timer;
} else {
_this.tipShow = false;
clearInterval(_this.timerCount);
}
}, 0);
}, 1000);
},