|
|
|
|
<template>
|
|
|
|
|
<div class="my_exam" :style="{ backgroundColor: examArr.length > 0 ? '#f9f9f9' : '#fff' }">
|
|
|
|
|
<div class="exam_noresult" v-if="examArr.length < 1">
|
|
|
|
|
<img src="~@/assets/image/no_result.jpg" />
|
|
|
|
|
<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="pro_top">
|
|
|
|
|
<div class="img_box">
|
|
|
|
|
<img v-if="item.apmStatus !== 1" src="~@/assets/image/time.png" alt="" />
|
|
|
|
|
<img v-else src="~@/assets/image/time_gray.png" alt="" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="time_box">
|
|
|
|
|
<div class="time_text">{{ doDateFormatter(item.apmDay) }}</div>
|
|
|
|
|
<div class="date_txt">{{ item.period + ' ' + item.timeFrame }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="pro_bottom">
|
|
|
|
|
<div class="pro_left">
|
|
|
|
|
<div class="img_box">
|
|
|
|
|
<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 ? '体检项目已完成' : item.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>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { myRecord, recordCancel, getSystemTime } from "@/api/hospital";
|
|
|
|
|
import { dateFormat, calcDate, calcTime } from "@/utils/date";
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
current: 1,
|
|
|
|
|
size: 10,
|
|
|
|
|
examArr: [],
|
|
|
|
|
userInfo: null,
|
|
|
|
|
systemTime: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
|
|
|
|
|
setInterval: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
let userInfo = sessionStorage.getItem('userInfo') ? JSON.parse(sessionStorage.getItem('userInfo')) : null;
|
|
|
|
|
if (userInfo) {
|
|
|
|
|
this.userInfo = userInfo;
|
|
|
|
|
this.querySystemTime();
|
|
|
|
|
this.queryMyRecord();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
if (this.setInterval) {
|
|
|
|
|
clearInterval(this.setInterval);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
//系统时间
|
|
|
|
|
querySystemTime() {
|
|
|
|
|
getSystemTime().then(res => {
|
|
|
|
|
this.systemTime = res.data;
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
//我的预约列表
|
|
|
|
|
queryMyRecord() {
|
|
|
|
|
this.$toast.loading({
|
|
|
|
|
message: '加载中',
|
|
|
|
|
duration: 0,
|
|
|
|
|
})
|
|
|
|
|
try {
|
|
|
|
|
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));
|
|
|
|
|
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.limitTime = this.calcDateTimeStr(systemTime < endTime ? endTime - systemTime : 0);//距离体检时间剩余毫秒数
|
|
|
|
|
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);
|
|
|
|
|
item.limitCancelTime = item.limitCancelTime > 1000 ? item.limitCancelTime - 1000 : 0;
|
|
|
|
|
})
|
|
|
|
|
}, 1000);
|
|
|
|
|
}, err => {
|
|
|
|
|
this.$toast.clear();
|
|
|
|
|
})
|
|
|
|
|
} catch (error) {
|
|
|
|
|
this.$toast.clear();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//日期格式化
|
|
|
|
|
doDateFormatter(date) {
|
|
|
|
|
return dateFormat(new Date(date), 'yyyy-MM-dd');
|
|
|
|
|
},
|
|
|
|
|
//计算距离体检还剩多长时间
|
|
|
|
|
calcDateTime(item) {
|
|
|
|
|
let systemTime = Date.parse(new Date(this.systemTime));
|
|
|
|
|
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'));
|
|
|
|
|
if (systemTime < endTime) {
|
|
|
|
|
let ret = calcDate(systemTime, endTime);
|
|
|
|
|
return `距离体检还有${ret.days}天${ret.hours}:${ret.minutes}:${(ret.seconds + '').substr(0, 2)}`
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
calcDateTimeStr(time) {
|
|
|
|
|
let ret = calcTime(time);
|
|
|
|
|
return time > 0 ? `距离体检还有${ret.days}天${ret.hours}:${ret.minutes}:${(ret.seconds + '').substr(0, 2)}` : ''
|
|
|
|
|
},
|
|
|
|
|
//取消预约
|
|
|
|
|
cancelRegisiter(row) {
|
|
|
|
|
if (row.apmStatus !== 2) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (row.limitCancelTime < 30 * 60 * 1000) {
|
|
|
|
|
lightAppJssdk.notification.alert({
|
|
|
|
|
message: "预约的时段前30分钟可取消",
|
|
|
|
|
title: "提示",//可传空
|
|
|
|
|
buttonName: "收到",
|
|
|
|
|
success: function (data) {
|
|
|
|
|
},
|
|
|
|
|
fail: function (data) { //错误返回
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
lightAppJssdk.notification.confirm({
|
|
|
|
|
message: "是否取消该体检项目",
|
|
|
|
|
title: "提示",//可传空
|
|
|
|
|
buttonLabels: ['确定', '取消'],
|
|
|
|
|
success: (data) => {
|
|
|
|
|
if (data.buttonIndex == 1) {
|
|
|
|
|
recordCancel(row.id).then(res => {
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
this.$toast('操作成功');
|
|
|
|
|
this.queryMyRecord();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
fail: function (data) { //错误返回
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.my_exam {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
background: #f9f9f9;
|
|
|
|
|
position: absolute;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
|
|
|
|
.exam_noresult {
|
|
|
|
|
text-align: center;
|
|
|
|
|
padding-top: 2rem;
|
|
|
|
|
|
|
|
|
|
img {
|
|
|
|
|
width: 2.56rem;
|
|
|
|
|
height: 2.56rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.no_title {
|
|
|
|
|
color: #666;
|
|
|
|
|
font-size: 0.44rem;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
margin-bottom: 0.1rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.no_txt {
|
|
|
|
|
color: #999;
|
|
|
|
|
font-size: 0.24rem;
|
|
|
|
|
width: 3rem;
|
|
|
|
|
line-height: 0.33rem;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.exam_box {
|
|
|
|
|
background: #fff;
|
|
|
|
|
padding: 0.5rem 0.24rem 0 0.24rem;
|
|
|
|
|
margin-bottom: 0.2rem;
|
|
|
|
|
|
|
|
|
|
.time_box {
|
|
|
|
|
font-size: 0.3rem;
|
|
|
|
|
font-family: PingFang SC-Bold, PingFang SC;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
color: #333333;
|
|
|
|
|
line-height: 0.46rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pro_box {
|
|
|
|
|
width: 98%;
|
|
|
|
|
margin-top: 0.4rem;
|
|
|
|
|
background: #fff;
|
|
|
|
|
// margin: 0.4rem auto;
|
|
|
|
|
// margin-bottom: 0.7rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.pro_top {
|
|
|
|
|
display: flex;
|
|
|
|
|
padding-bottom: 0.26rem;
|
|
|
|
|
border-bottom: 1px solid #EEEEEE;
|
|
|
|
|
|
|
|
|
|
.img_box {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-right: 0.24rem;
|
|
|
|
|
|
|
|
|
|
img {
|
|
|
|
|
width: 0.5rem;
|
|
|
|
|
height: 0.5rem;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.time_box {
|
|
|
|
|
.time_text {
|
|
|
|
|
width: 1.46rem;
|
|
|
|
|
height: 0.32rem;
|
|
|
|
|
text-align: center;
|
|
|
|
|
background: #F6F6F6;
|
|
|
|
|
border-radius: 0.08rem;
|
|
|
|
|
line-height: 0.32rem;
|
|
|
|
|
font-size: 0.24rem;
|
|
|
|
|
color: #999999;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.date_txt {
|
|
|
|
|
font-size: 0.3rem;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
color: #333;
|
|
|
|
|
line-height: 0.46rem;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pro_bottom {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
height: 1.2rem;
|
|
|
|
|
|
|
|
|
|
.pro_left {
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.img_box {
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
img {
|
|
|
|
|
width: 0.5rem;
|
|
|
|
|
height: 0.5rem;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pro_name {
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
font-size: 0.3rem;
|
|
|
|
|
color: #333;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
margin-left: 0.24rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pro_pos {
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
font-size: 0.24rem;
|
|
|
|
|
color: #999;
|
|
|
|
|
margin-left: 0.24rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tips {
|
|
|
|
|
color: #00B578;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.cancel_tip {
|
|
|
|
|
color: #F93A4A;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pro_right {
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
.cancel {
|
|
|
|
|
width: 1.5rem;
|
|
|
|
|
height: 0.5rem;
|
|
|
|
|
background: rgba(22, 119, 255, .1);
|
|
|
|
|
border-radius: 0.26rem;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
font-size: 0.24rem;
|
|
|
|
|
color: #1677FF;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.finish {
|
|
|
|
|
background: #E5E5E5;
|
|
|
|
|
color: #999;
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.cancel_item {
|
|
|
|
|
background: rgba(125, 125, 125, .2);
|
|
|
|
|
color: #999;
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|