|
|
|
|
@ -5,9 +5,9 @@ |
|
|
|
|
<div class="no_title">查询无结果</div> |
|
|
|
|
<div class="no_txt">暂无您的预约项目,请选择医院后进行预约</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="exam_box" v-for="item in examArr" :key="item.time"> |
|
|
|
|
<div class="time_box">{{ doDateFormatter(item.apmTime) }}</div> |
|
|
|
|
<div class="pro_box"> |
|
|
|
|
<div class="exam_box" v-for="item in examArr" :key="item.id"> |
|
|
|
|
<div class="time_box">{{ item.createDeptName }}</div> |
|
|
|
|
<div class="pro_box" v-for="item1 in item.details" :key="item1.project"> |
|
|
|
|
<div class="pro_top"> |
|
|
|
|
<div class="img_box"> |
|
|
|
|
<img v-if="item.apmStatus !== 1" src="~@/assets/image/time.png" alt="" /> |
|
|
|
|
@ -15,7 +15,7 @@ |
|
|
|
|
</div> |
|
|
|
|
<div class="time_box"> |
|
|
|
|
<div class="time_text">{{ doDateFormatter(item.apmDay) }}</div> |
|
|
|
|
<div class="date_txt">{{ item.period + ' ' + item.timeFrame }}</div> |
|
|
|
|
<div class="date_txt">{{ item1.period + ' ' + item1.timeFrame }}</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="pro_bottom"> |
|
|
|
|
@ -24,15 +24,14 @@ |
|
|
|
|
<img v-if="item.apmStatus !== 1" src="~@/assets/image/pro.png" alt="" /> |
|
|
|
|
<img v-else src="~@/assets/image/pro_gray.png" alt="" /> |
|
|
|
|
</div> |
|
|
|
|
<div class="pro_name">{{ item.project }}</div> |
|
|
|
|
<div class="pro_pos" :class="item.apmStatus === 2 ? 'tips' : item.apmStatus == 1 ? 'cancel_tip' : ''"> |
|
|
|
|
{{ item.apmStatus == 1 ? '您的体检项目已取消' : item.apmStatus == 3 ? '体检项目已完成' : getTime(item.limitTime) }}</div> |
|
|
|
|
<div class="pro_name">{{ item1.project }} </div> |
|
|
|
|
<div class="pro_pos" :class="[item1.apmStatus === 2 ? 'tips' : item1.apmStatus == 1 ? 'cancel_tip' : '',]"> |
|
|
|
|
{{ item1.apmStatus == 1 ? '您的体检项目已取消' : item1.apmStatus == 3 ? '体检项目已完成' : (item1.apmStatus == 2 && item1.lastExamTime == 0) ? '您的体检已过期' : item1.limitTime }}</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="pro_right"> |
|
|
|
|
<div class="cancel" @click="cancelRegisiter(item)" |
|
|
|
|
:class="item.apmStatus == 3 ? 'finish' : item.apmStatus == 1 ? 'cancel_item' : ''">{{ |
|
|
|
|
item.apmStatus == 1 ? |
|
|
|
|
'已取消' : item.apmStatus == 2 ? '取消预约' : item.apmStatus == 3 ? '已完成' : '取消预约' |
|
|
|
|
<div class="cancel" @click="cancelRegisiter(item1)" |
|
|
|
|
:class="[item1.apmStatus == 3 ? 'finish' : item1.apmStatus == 1 ? 'cancel_item' : '',]">{{ |
|
|
|
|
item1.apmStatus == 1 ? '已取消' : item1.apmStatus == 2 ? '取消预约' : item1.apmStatus == 3 ? '已完成' : '取消预约' |
|
|
|
|
}}</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
@ -42,7 +41,7 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import { myRecord, recordCancel, getSystemTime } from "@/api/hospital"; |
|
|
|
|
import { myRecord, recordCancel, getSystemTime, } from "@/api/hospital"; |
|
|
|
|
import { dateFormat, calcDate, calcTime } from "@/utils/date"; |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
@ -55,7 +54,10 @@ export default { |
|
|
|
|
setInterval: 0, |
|
|
|
|
interVal:null, |
|
|
|
|
starTime:'', |
|
|
|
|
lastTime:'' |
|
|
|
|
lastTime:'', |
|
|
|
|
timeArr:[], |
|
|
|
|
lastCanTime:'', |
|
|
|
|
limitTime:1000 * 60 *30 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
@ -67,22 +69,8 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
computed:{ |
|
|
|
|
getTime:() =>{ |
|
|
|
|
return time =>{ |
|
|
|
|
console.log(time) |
|
|
|
|
let interVal = null |
|
|
|
|
if(interVal){ |
|
|
|
|
clearInterval(this.interVal); |
|
|
|
|
}else{ |
|
|
|
|
// this.intervalTime(this.starTime,this.lastTime) |
|
|
|
|
interVal = setInterval(() => { |
|
|
|
|
// time = this.intervalTime(time,this.lastTime) |
|
|
|
|
time = time > 1000 ? time + 1000 : 0; |
|
|
|
|
return time |
|
|
|
|
}, 1000); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
watch:{ |
|
|
|
|
}, |
|
|
|
|
beforeDestroy() { |
|
|
|
|
if (this.setInterval) { |
|
|
|
|
@ -106,34 +94,62 @@ export default { |
|
|
|
|
myRecord("", this.userInfo.papersnumber, this.current, this.size).then(res => { |
|
|
|
|
this.$toast.clear(); |
|
|
|
|
this.examArr = res.data.records; |
|
|
|
|
this.examArr.map(item => { |
|
|
|
|
let systemTime = Date.parse(new Date(this.systemTime)); |
|
|
|
|
this.starTime = systemTime |
|
|
|
|
let latime = item.apmDay.substr(0,10) + ' ' + item.timeFrame.split('-')[1] + ':00'; |
|
|
|
|
this.lastTime = Date.parse(new Date(latime)) |
|
|
|
|
let time = item.timeFrame.split('-')[1].split(':'); |
|
|
|
|
let endTime = Date.parse(new Date(this.doDateFormatter(item.apmDay) + ' ' + (time[0] < 10 ? '0' + time[0] : time[0]) + ':' + (time[1] < 10 ? '0' + time[1] : time[1]) + ':00')); |
|
|
|
|
let time2 = item.timeFrame.split('-')[0].split(':'); |
|
|
|
|
let startTime = Date.parse(new Date(this.doDateFormatter(item.apmDay) + ' ' + (time2[0] < 10 ? '0' + time2[0] : time2[0]) + ':' + (time2[1] < 10 ? '0' + time2[1] : time2[1]) + ':00')); |
|
|
|
|
item.time = systemTime < endTime ? endTime - systemTime : 0; |
|
|
|
|
// item.limitTime = this.calcDateTimeStr(systemTime < endTime ? endTime - systemTime : 0);//距离体检时间剩余毫秒数 |
|
|
|
|
item.limitTime = systemTime |
|
|
|
|
// console.log('time ===>',item.limitTime) |
|
|
|
|
item.limitCancelTime = systemTime < startTime ? startTime - systemTime : 0;//距离取消预约剩余毫秒数 |
|
|
|
|
}) |
|
|
|
|
//开启倒计时 |
|
|
|
|
if (this.setInterval) { |
|
|
|
|
clearInterval(this.setInterval); |
|
|
|
|
} |
|
|
|
|
this.setInterval = setInterval(() => { |
|
|
|
|
this.examArr.map(item => { |
|
|
|
|
// item.limitTime = this.calcDateTimeStr(item.limitTime); |
|
|
|
|
this.starTime = this.starTime > 1000 ? this.starTime + 1000 : 0; |
|
|
|
|
item.limitTime = this.intervalTime(this.starTime,this.lastTime) |
|
|
|
|
item.limitCancelTime = item.limitCancelTime > 1000 ? item.limitCancelTime - 1000 : 0; |
|
|
|
|
|
|
|
|
|
console.log(this.examArr) |
|
|
|
|
this.examArr.map(item1 =>{ |
|
|
|
|
item1.details.map(item =>{ |
|
|
|
|
console.log(item) |
|
|
|
|
let systemTime = Date.parse(new Date(this.systemTime)); |
|
|
|
|
item.starTime = systemTime |
|
|
|
|
let latime = item1.apmDay.substr(0,10) + ' ' + item.timeFrame.split('-')[1] + ':00'; |
|
|
|
|
let lasCanTime =item1.apmDay.substr(0,10) + ' ' + item.timeFrame.split('-')[0] + ':00'; |
|
|
|
|
item.lastCanTime = Date.parse(new Date(lasCanTime)) |
|
|
|
|
item.lastTime = Date.parse(new Date(latime)) |
|
|
|
|
item.limitTime = this.intervalTime(item.starTime,item.lastTime) |
|
|
|
|
item.lastExamTime = systemTime < item.lastTime ? item.lastTime - systemTime : 0 |
|
|
|
|
item.limitCancelTime = systemTime < item.lastCanTime ? item.lastCanTime - systemTime : 0;//距离取消预约剩余毫秒数 |
|
|
|
|
console.log(item.limitCancelTime) //670422000 |
|
|
|
|
// this.$set( |
|
|
|
|
// item,"limitTime",item.limitTime |
|
|
|
|
// ); |
|
|
|
|
}) |
|
|
|
|
}, 1000); |
|
|
|
|
}) |
|
|
|
|
this.timeList() |
|
|
|
|
// this.examArr.map(item => { |
|
|
|
|
// let systemTime = Date.parse(new Date(this.systemTime)); |
|
|
|
|
// this.starTime = systemTime |
|
|
|
|
// let latime = item.apmDay.substr(0,10) + ' ' + item.timeFrame.split('-')[1] + ':00'; |
|
|
|
|
// let lasCanTime =item.apmDay.substr(0,10) + ' ' + item.timeFrame.split('-')[0] + ':00'; |
|
|
|
|
// this.lastCanTime = Date.parse(new Date(lasCanTime)) |
|
|
|
|
// this.lastTime = Date.parse(new Date(latime)) |
|
|
|
|
// let time = item.timeFrame.split('-')[1].split(':'); |
|
|
|
|
// let endTime = Date.parse(new Date(this.doDateFormatter(item.apmDay) + ' ' + (time[0] < 10 ? '0' + time[0] : time[0]) + ':' + (time[1] < 10 ? '0' + time[1] : time[1]) + ':00')); |
|
|
|
|
// let time2 = item.timeFrame.split('-')[0].split(':'); |
|
|
|
|
// let startTime = Date.parse(new Date(this.doDateFormatter(item.apmDay) + ' ' + (time2[0] < 10 ? '0' + time2[0] : time2[0]) + ':' + (time2[1] < 10 ? '0' + time2[1] : time2[1]) + ':00')); |
|
|
|
|
// item.time = systemTime < endTime ? endTime - systemTime : 0; |
|
|
|
|
// // item.limitTime = this.calcDateTimeStr(systemTime < endTime ? endTime - systemTime : 0);//距离体检时间剩余毫秒数 |
|
|
|
|
// item.limitTime = this.intervalTime(this.starTime,this.lastTime) |
|
|
|
|
// // console.log('time ===>',item.limitTime) |
|
|
|
|
// item.limitCancelTime = systemTime < this.lastCanTime ? this.lastCanTime - systemTime : 0;//距离取消预约剩余毫秒数 |
|
|
|
|
// console.log(item.limitCancelTime) |
|
|
|
|
// }) |
|
|
|
|
// //开启倒计时 |
|
|
|
|
// if (this.setInterval) { |
|
|
|
|
// clearInterval(this.setInterval); |
|
|
|
|
// } |
|
|
|
|
// this.setInterval = setInterval(() => { |
|
|
|
|
// // console.log(this.examArr) |
|
|
|
|
// this.timeArr = this.examArr; |
|
|
|
|
// this.timeArr.map(item => { |
|
|
|
|
// this.starTime = this.starTime > 1000 ? this.starTime + 1000 : 0; |
|
|
|
|
// item.limitTime = this.intervalTime(this.starTime,this.lastTime) |
|
|
|
|
// // item.limitCancelTime = item.limitCancelTime > 1000 ? item.limitCancelTime - 1000 : 0; |
|
|
|
|
// // item.limitCancelTime = this.intervalTime(this.starTime,Date.parse(new Date(this.lastCanTime))) |
|
|
|
|
|
|
|
|
|
// }) |
|
|
|
|
// // console.log(this.timeArr) |
|
|
|
|
|
|
|
|
|
// }, 1000); |
|
|
|
|
// this.examArr = arr |
|
|
|
|
}, err => { |
|
|
|
|
this.$toast.clear(); |
|
|
|
|
}) |
|
|
|
|
@ -142,6 +158,26 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
timeList(){ |
|
|
|
|
if(this.setInterval){ |
|
|
|
|
clearInterval(this.setInterval) |
|
|
|
|
} |
|
|
|
|
this.setInterval = setInterval(() => { |
|
|
|
|
let arr = [] |
|
|
|
|
this.examArr.forEach(item => { |
|
|
|
|
item.details.map(item1 =>{ |
|
|
|
|
item1.starTime = item1.starTime > 1000 ? item1.starTime + 1000 : 0; |
|
|
|
|
item1.limitTime = this.intervalTime(item1.starTime,item1.lastTime); |
|
|
|
|
item1.lastExamTime = item1.lastExamTime > 1000 ? item1.lastExamTime - 1000 : 0; |
|
|
|
|
item1.limitCancelTime = item1.limitCancelTime > 1000 ? item1.limitCancelTime - 1000 : 0 |
|
|
|
|
this.$set(item.details,item1.limitTime,item1.limitTime) |
|
|
|
|
// this.$set(item.details,item1.limitCancelTime,item1.limitCancelTime) |
|
|
|
|
}) |
|
|
|
|
// console.log(this.examArr) |
|
|
|
|
}) |
|
|
|
|
}, 1000) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 计算时间差 |
|
|
|
|
//计算两个时间之间的时间差 多少天时分秒 |
|
|
|
|
intervalTime(startTime,endTime) { |
|
|
|
|
@ -156,8 +192,10 @@ export default { |
|
|
|
|
var date2 = endTime; //结束时间 |
|
|
|
|
// var date3 = date2.getTime() - date1.getTime(); //时间差的毫秒数 |
|
|
|
|
var date3 = (date2- date1); //时间差的毫秒数 |
|
|
|
|
date3 = date3 < 0 ? 0 : date3 |
|
|
|
|
//计算出相差天数 |
|
|
|
|
var days = Math.floor(date3 / (24 * 3600 * 1000)); |
|
|
|
|
days = days < 0 ? '' :days + '天' |
|
|
|
|
//计算出小时数 |
|
|
|
|
|
|
|
|
|
var leave1 = date3 % (24 * 3600 * 1000); //计算天数后剩余的毫秒数 |
|
|
|
|
@ -165,14 +203,21 @@ export default { |
|
|
|
|
//计算相差分钟数 |
|
|
|
|
var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数 |
|
|
|
|
var minutes = Math.floor(leave2 / (60 * 1000)); |
|
|
|
|
minutes = minutes < 10 ? '0' + minutes : minutes |
|
|
|
|
|
|
|
|
|
//计算相差秒数 |
|
|
|
|
|
|
|
|
|
var leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数 |
|
|
|
|
var seconds = Math.round(leave3 / 1000); |
|
|
|
|
seconds = seconds < 10 ? '0' + seconds : seconds; |
|
|
|
|
// console.log(days + "天 " + hours + "小时 ") |
|
|
|
|
// return days + "天 " + hours + "小时 " + minutes + " 分钟" + seconds + " 秒" |
|
|
|
|
return days + "天 " + hours + "小时 " + minutes + '分钟' + seconds + '秒' |
|
|
|
|
return `距离体检还有${days}${hours}:${minutes}:${seconds}` |
|
|
|
|
// return { |
|
|
|
|
// days, |
|
|
|
|
// hours, |
|
|
|
|
// minutes, |
|
|
|
|
// seconds |
|
|
|
|
// } |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -218,8 +263,11 @@ export default { |
|
|
|
|
title: "提示",//可传空 |
|
|
|
|
buttonLabels: ['确定', '取消'], |
|
|
|
|
success: (data) => { |
|
|
|
|
if (data.buttonIndex == 1) { |
|
|
|
|
console.log(data) |
|
|
|
|
if (JSON.parse(data).buttonIndex == 1) { |
|
|
|
|
console.log('ces') |
|
|
|
|
recordCancel(row.id).then(res => { |
|
|
|
|
console.log(res) |
|
|
|
|
if (res.code == 200) { |
|
|
|
|
this.$toast('操作成功'); |
|
|
|
|
this.queryMyRecord(); |
|
|
|
|
@ -398,6 +446,12 @@ export default { |
|
|
|
|
pointer-events: none; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.limit{ |
|
|
|
|
pointer-events: none; |
|
|
|
|
background: #E5E5E5; |
|
|
|
|
color: #999; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.cancel_item { |
|
|
|
|
background: rgba(125, 125, 125, .2); |
|
|
|
|
color: #999; |
|
|
|
|
|