获取当前的时间:然后处理一系列逻辑
getHours(){
let time = (new Date()).getTime(); // 获取当前时间戳
console.log('time=='+time);
let timeDate = this.orderInfo.pay_time;
//let Time = new Date(timeDate);
let Time = new Date(timeDate.replace(/-/g, '/'))
let timestemp = Time.getTime(); //得到时间戳
console.log('timestemp====',timestemp)
let timeDiff = time - timestemp
console.log('timeDiff==',time - timestemp);
const hours = parseInt(timeDiff/3600000 ) // 当前时间和服务器时间的差值,计算出小时数
console.log('hours==',hours);
this.hours = hours
},
let timeDate = this.orderInfo.pay_time; let Time = new Date(timeDate.replace(/-/g, '/')) let timestemp = Time.getTime(); //得到时间戳 可以换成 let timestemp = new Date(this.orderInfo.pay_time).valueOf()