Commit 607ebae9 by zhangzhen

获取时间戳优化

parent e0c4b5db
...@@ -510,7 +510,6 @@ ...@@ -510,7 +510,6 @@
} }
}, },
onLoad(option) { onLoad(option) {
// this.$refs.popupMessage.open();
uni.showLoading({ uni.showLoading({
title: "加载中" title: "加载中"
}) })
...@@ -547,7 +546,7 @@ ...@@ -547,7 +546,7 @@
}, },
onSetSelectTime(){ onSetSelectTime(){
if(this.dateIndex === 0){ if(this.dateIndex === 0){
let h = new Date().getHours() let h = Number(moment().format("HH"))
this.hourList = this.hourList.filter(item=> Number(item)>=h).map(item=> { this.hourList = this.hourList.filter(item=> Number(item)>=h).map(item=> {
let i = Number(item) let i = Number(item)
return i>=10? i: `0${i}` return i>=10? i: `0${i}`
...@@ -561,7 +560,7 @@ ...@@ -561,7 +560,7 @@
}, },
onSetStartHours(){ onSetStartHours(){
if(this.dateIndex === 0){ if(this.dateIndex === 0){
this.startHours = new Date().getHours(); this.startHours = Number(moment().format("HH"));
}else{ }else{
this.startHours = 0 this.startHours = 0
} }
...@@ -1010,8 +1009,8 @@ ...@@ -1010,8 +1009,8 @@
selectNum += 1 selectNum += 1
t = i t = i
} else if(val.status ==1 && selectNum > 0 ){ } else if(val.status ==1 && selectNum > 0 ){
let start = new Date(startDate).getTime() let start = moment(startDate).valueOf()
let end = new Date(val.startHoldTime).getTime() let end = moment(val.startHoldTime).valueOf()
if(end-start >this.duration*60*60*1000){ if(end-start >this.duration*60*60*1000){
todaySelectStatus = true; todaySelectStatus = true;
} else { } else {
...@@ -1026,9 +1025,9 @@ ...@@ -1026,9 +1025,9 @@
t = i t = i
}else if(selectNum>0 && !val.status){ }else if(selectNum>0 && !val.status){
// 计算时长 // 计算时长
let start = new Date(startDate).getTime() let start = moment(startDate).valueOf()
endDate = endDate? moment(endDate).add(1,'h').format("YYYY-MM-DD HH:mm:ss") : moment(startDate).add(1,'h').format("YYYY-MM-DD HH:mm:ss") endDate = endDate? moment(endDate).add(1,'h').format("YYYY-MM-DD HH:mm:ss") : moment(startDate).add(1,'h').format("YYYY-MM-DD HH:mm:ss")
let end = new Date(endDate).getTime() let end = moment(endDate).valueOf()
if(end-start > this.duration*60*60*1000){ if(end-start > this.duration*60*60*1000){
todaySelectStatus = true; todaySelectStatus = true;
...@@ -1460,8 +1459,8 @@ ...@@ -1460,8 +1459,8 @@
selectNum += 1 selectNum += 1
t = i t = i
} else if(val.status ==1 && selectNum > 0 ){ } else if(val.status ==1 && selectNum > 0 ){
let start = new Date(startDate).getTime() let start = moment(startDate).valueOf()
let end = new Date(val.startHoldTime).getTime() let end = moment(val.startHoldTime).valueOf()
if(end-start >this.duration*60*60*1000){ if(end-start >this.duration*60*60*1000){
todaySelectStatus = true; todaySelectStatus = true;
} else { } else {
...@@ -1476,9 +1475,9 @@ ...@@ -1476,9 +1475,9 @@
t = i t = i
}else if(selectNum>0 && !val.status){ }else if(selectNum>0 && !val.status){
// 计算时长 // 计算时长
let start = new Date(startDate).getTime() let start = moment(startDate).valueOf()
endDate = endDate? moment(endDate).add(1,'h').format("YYYY-MM-DD HH:mm:ss") : moment(startDate).add(1,'h').format("YYYY-MM-DD HH:mm:ss") endDate = endDate? moment(endDate).add(1,'h').format("YYYY-MM-DD HH:mm:ss") : moment(startDate).add(1,'h').format("YYYY-MM-DD HH:mm:ss")
let end = new Date(endDate).getTime() let end = moment(endDate).valueOf()
if(end-start > this.duration*60*60*1000){ if(end-start > this.duration*60*60*1000){
todaySelectStatus = true; todaySelectStatus = true;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment