预约时间下午时间计算逻辑修正

main
xuechunyuan 3 years ago
parent ec2fcd44fa
commit d8f81d39d4
  1. 55
      src/views/examination.vue
  2. 25
      src/views/myExam.vue

@ -61,7 +61,7 @@
<div class="exam_bottom"> <div class="exam_bottom">
<div class="exam_txt" v-for="item1 in item.detailList" :key="item1.time" <div class="exam_txt" v-for="item1 in item.detailList" :key="item1.time"
@click="clickExam(item, item1)" @click="clickExam(item, item1)"
:class="[(item1.residueNum == 0 ? 'isAct' : ''), (item1.isSelect ? 'active' : ''), Date.parse(new Date(item.apmDay.substring(0, 10) + ' ' + item1.timeFrame.split('-')[1] + ':00')) < Date.parse(new Date(systemTime)) ? 'isAct' : '']"> :class="[(item1.residueNum == 0 ? 'isAct' : ''), (item1.isSelect ? 'active' : ''), Date.parse(new Date(calcTime(item.apmDay.substring(0, 10),item1))) < Date.parse(new Date(systemTime)) ? 'isAct' : '']">
<div class="txt" style="font-size:0.22rem;color:#666;"><span <div class="txt" style="font-size:0.22rem;color:#666;"><span
style="font-size:0.24rem;color:#666">{{ item1.period }}</span> {{ item1.timeFrame }} style="font-size:0.24rem;color:#666">{{ item1.period }}</span> {{ item1.timeFrame }}
</div> </div>
@ -80,6 +80,7 @@
<script> <script>
import { queryDays, queryList } from "@/api/examination"; import { queryDays, queryList } from "@/api/examination";
import { getSystemTime, } from "@/api/hospital"; import { getSystemTime, } from "@/api/hospital";
import { dateFormat } from "@/utils/date";
export default { export default {
data() { data() {
return { return {
@ -94,26 +95,7 @@ export default {
minDate1: new Date(new Date().getFullYear(), new Date().getMonth() + 1, 1), minDate1: new Date(new Date().getFullYear(), new Date().getMonth() + 1, 1),
maxDate1: new Date(new Date().getFullYear(), new Date().getMonth() + 1, new Date(new Date().getFullYear(), new Date().getMonth() + 2, 0).getDate()), maxDate1: new Date(new Date().getFullYear(), new Date().getMonth() + 1, new Date(new Date().getFullYear(), new Date().getMonth() + 2, 0).getDate()),
numData: [], numData: [],
examData: [ examData: [],
// {name:'',position:'3',total:20,residue:15,examArr:[
// {moment:'',time:'8:00-8:30',num:2},
// {moment:'',time:'8:30-9:00',num:0},
// {moment:'',time:'9:00-9:30',num:1},
// {moment:'',time:'9:30-10:00',num:1},
// ]},
// {name:'',position:'3',total:20,residue:15,examArr:[
// {moment:'',time:'8:00-8:30',num:2},
// {moment:'',time:'8:30-9:00',num:0},
// {moment:'',time:'9:00-9:30',num:1},
// {moment:'',time:'9:30-10:00',num:1},
// ]},
// {name:'',position:'3',total:20,residue:15,examArr:[
// {moment:'',time:'8:00-8:30',num:2},
// {moment:'',time:'8:30-9:00',num:0},
// {moment:'',time:'9:00-9:30',num:1},
// {moment:'',time:'9:30-10:00',num:1},
// ]}
],
selectArr: [], selectArr: [],
selectDate: '', selectDate: '',
today: '', today: '',
@ -123,7 +105,8 @@ export default {
endTime: '', endTime: '',
cupCardNo: '', cupCardNo: '',
dayArr: [], dayArr: [],
yesterDay: '' yesterDay: '',
systemTime: dateFormat(new Date(), 'yyyy-MM-dd')
} }
}, },
created() { created() {
@ -159,6 +142,12 @@ export default {
}, },
methods: { methods: {
//
calcTime(apmDay, item) {
let lattime = apmDay.replace(/-/gi,'/') + ' ' + (item.period == '下午' ? 12 + parseInt(item.timeFrame.split('-')[1].split(':')[0]) : item.timeFrame.split('-')[1].split(':')[0]) + ':' + item.timeFrame.split('-')[1].split(':')[1] + ':00';
console.log('lattime22', lattime , this.systemTime);
return lattime;
},
querySystemTime() { querySystemTime() {
if (this.GlobalConfig.appMode) { if (this.GlobalConfig.appMode) {
vaildInterfacefn("cgstjyyxuwxt", "qdsgajjtjczhqxtsj", JSON.stringify({}), "2", "https://" + this.GlobalConfig.urlCreatesign, "https://" + this.GlobalConfig.urlGateway) vaildInterfacefn("cgstjyyxuwxt", "qdsgajjtjczhqxtsj", JSON.stringify({}), "2", "https://" + this.GlobalConfig.urlCreatesign, "https://" + this.GlobalConfig.urlGateway)
@ -247,21 +236,7 @@ export default {
this.$toast.clear(); this.$toast.clear();
let retData = JSON.parse(value) let retData = JSON.parse(value)
console.log(retData.data) console.log(retData.data)
if (retData.data.length == 0) { if(retData.code == 200) {
this.examData = retData.data
// lightAppJssdk.notification.alert({
// message: "",
// title: "",//
// buttonName: "",
// success: (data) => {
// // console.log(this.examData)
// },
// fail: data => { //
// // this.$toast.clear();
// }
// })
} else {
this.examData = retData.data; this.examData = retData.data;
this.examData.map(item => { this.examData.map(item => {
item.detailList.map(item1 => { item.detailList.map(item1 => {
@ -270,7 +245,6 @@ export default {
}) })
} }
console.log('data ===>', this.examData)
}, err => { }, err => {
this.$toast.clear(); this.$toast.clear();
}) })
@ -283,9 +257,7 @@ export default {
} }
).then(res => { ).then(res => {
this.$toast.clear(); this.$toast.clear();
if (res.data.length == 0) { if (res.code == 200) {
this.examData = res.data;
} else {
this.examData = res.data; this.examData = res.data;
this.examData.map(item => { this.examData.map(item => {
item.detailList.map(item1 => { item.detailList.map(item1 => {
@ -349,6 +321,7 @@ export default {
changeDate(item) { changeDate(item) {
// let year = new Date().getFullYear() // let year = new Date().getFullYear()
// let month = new Date().getMonth() < 10 ? '0' + parseInt(new Date().getMonth() + 1) : new Date().getMonth() + 1 // let month = new Date().getMonth() < 10 ? '0' + parseInt(new Date().getMonth() + 1) : new Date().getMonth() + 1
this.examData = [];
this.selectDate = item; this.selectDate = item;
console.log(this.selectDate) console.log(this.selectDate)
this.getList() this.getList()

@ -27,10 +27,11 @@
</div> </div>
<div class="pro_name">{{ item1.project }} </div> <div class="pro_name">{{ item1.project }} </div>
<div class="pro_pos" <div class="pro_pos"
:class="[item1.apmStatus === 2 ? 'tips' : item1.apmStatus == 1 ? 'cancel_tip' : '',]"> :class="[item1.apmStatus == 2 &&
item1.lastExamTime === 0 ? 'timeout_tip' : item1.apmStatus === 2 ? 'tips' : '', item1.apmStatus == 1 ? 'cancel_tip' : '',]">
{{ {{
item1.apmStatus == 1 ? '您的体检项目已取消' : item1.apmStatus == 3 ? '体检项目已完成' : (item1.apmStatus == 2 && item1.apmStatus == 1 ? '您的体检项目已取消' : item1.apmStatus == 3 ? '体检项目已完成' : (item1.apmStatus == 2 &&
item1.lastExamTime == 0) ? '您的体检已过期' : item1.limitTime item1.lastExamTime === 0) ? '您的体检已过期' : item1.limitTime
}}</div> }}</div>
</div> </div>
<div class="pro_right"> <div class="pro_right">
@ -131,8 +132,12 @@ export default {
console.log(item) console.log(item)
let systemTime = Date.parse(new Date(this.systemTime)); let systemTime = Date.parse(new Date(this.systemTime));
item.starTime = systemTime item.starTime = systemTime
let latime = item1.apmDay.substr(0, 10) + ' ' + item.timeFrame.split('-')[1] + ':00'; let _lattime = (item.period == '下午' ? 12 + parseInt(item.timeFrame.split('-')[1].split(':')[0]) : item.timeFrame.split('-')[1].split(':')[0]) + ':' + item.timeFrame.split('-')[1].split(':')[1];
let lasCanTime = item1.apmDay.substr(0, 10) + ' ' + item.timeFrame.split('-')[0] + ':00'; console.log('lattime', _lattime);
let latime = item1.apmDay.substr(0, 10) + ' ' + _lattime + ':00';
let _lasCanTime = (item.period == '下午' ? 12 + parseInt(item.timeFrame.split('-')[0].split(':')[0]) : item.timeFrame.split('-')[0].split(':')[0]) + ':' + item.timeFrame.split('-')[0].split(':')[1];
console.log('lasCanTime', _lasCanTime);
let lasCanTime = item1.apmDay.substr(0, 10) + ' ' + _lasCanTime + ':00';
// item.lastCanTime = Date.parse(new Date(lasCanTime.replaceAll('-', '/'))) // item.lastCanTime = Date.parse(new Date(lasCanTime.replaceAll('-', '/')))
// item.lastTime = Date.parse(new Date(latime.replaceAll('-', '/'))) // item.lastTime = Date.parse(new Date(latime.replaceAll('-', '/')))
item.lastCanTime = Date.parse(new Date(lasCanTime.replace(/-/g, '/'))) item.lastCanTime = Date.parse(new Date(lasCanTime.replace(/-/g, '/')))
@ -182,8 +187,12 @@ export default {
item1.details.map(item => { item1.details.map(item => {
let systemTime = Date.parse(new Date(this.systemTime)); let systemTime = Date.parse(new Date(this.systemTime));
item.starTime = systemTime item.starTime = systemTime
let latime = item1.apmDay.substr(0, 10) + ' ' + item.timeFrame.split('-')[1] + ':00'; let _lattime = (item.period == '下午' ? 12 + parseInt(item.timeFrame.split('-')[1].split(':')[0]) : item.timeFrame.split('-')[1].split(':')[0]) + ':' + item.timeFrame.split('-')[1].split(':')[1];
let lasCanTime = item1.apmDay.substr(0, 10) + ' ' + item.timeFrame.split('-')[0] + ':00'; console.log('lattime', _lattime);
let latime = item1.apmDay.substr(0, 10) + ' ' + _lattime + ':00';
let _lasCanTime = (item.period == '下午' ? 12 + parseInt(item.timeFrame.split('-')[0].split(':')[0]) : item.timeFrame.split('-')[0].split(':')[0]) + ':' + item.timeFrame.split('-')[0].split(':')[1];
console.log('lasCanTime', _lasCanTime);
let lasCanTime = item1.apmDay.substr(0, 10) + ' ' + _lasCanTime + ':00';
// item.lastCanTime = Date.parse(new Date(lasCanTime.replaceAll('-', '/'))) // item.lastCanTime = Date.parse(new Date(lasCanTime.replaceAll('-', '/')))
// item.lastTime = Date.parse(new Date(latime.replaceAll('-', '/'))) // item.lastTime = Date.parse(new Date(latime.replaceAll('-', '/')))
item.lastCanTime = Date.parse(new Date(lasCanTime.replace(/-/g, '/'))) item.lastCanTime = Date.parse(new Date(lasCanTime.replace(/-/g, '/')))
@ -554,6 +563,10 @@ export default {
.cancel_tip { .cancel_tip {
color: #F93A4A; color: #F93A4A;
} }
.timeout_tip {
color: #999;
}
} }
.pro_right { .pro_right {

Loading…
Cancel
Save