diff --git a/pages/HealthExaminationApp/appointment/appointment.vue b/pages/HealthExaminationApp/appointment/appointment.vue index ba4b831..2af0cdf 100644 --- a/pages/HealthExaminationApp/appointment/appointment.vue +++ b/pages/HealthExaminationApp/appointment/appointment.vue @@ -96,7 +96,9 @@ -
当天剩余可预约人数:{{ reservationNumber }}人
+
+ 当天剩余可预约人数:{{ reservationNumber < 0 ? '0' : reservationNumber }}人 +

医院信息

@@ -107,7 +109,7 @@
联系方式: {{ hospitalInfo.telPhone }}
-
+
@@ -146,7 +148,8 @@ export default { checkTypeContentList: [], showIcon: false, reservationNumber: 0, - isDisabled: true + isDisabled: true, + checkId: '' } }, onLoad(opt) { @@ -236,6 +239,7 @@ export default { }, // 获取套餐内容 getCheckTypeContent(item) { + this.checkId = item.id const params = { token: this.token, checkId: item.id, @@ -343,6 +347,7 @@ export default { phyAppontTime: this.healthTime, setMealType: '2', combName: this.checkTypeContent, + checkId: this.checkId, // token: this.token } console.log('🚀 ~ handleSave ~ params:', params) @@ -361,7 +366,7 @@ export default { res = res.data console.log('🚀 ~ handleSave ~ res:', res) if (res.res == 1) { - uni.setStorageSync('appoint', true) + // uni.setStorageSync('appoint', true) uni.showToast({ title: '预约成功', icon: 'success' @@ -369,6 +374,11 @@ export default { uni.reLaunch({ url: '/pages/HealthExaminationApp/myAppointment/bookSuccessfully' }) + } else { + uni.showToast({ + title: res.resMsg, + icon: 'none' + }) } }, fail: err => { diff --git a/pages/HealthExaminationApp/index/index.vue b/pages/HealthExaminationApp/index/index.vue index a0cc650..d698133 100644 --- a/pages/HealthExaminationApp/index/index.vue +++ b/pages/HealthExaminationApp/index/index.vue @@ -97,7 +97,9 @@ export default { ], // 头像 avatar: - 'https://img.zcool.cn/community/0104c958b69c23a801219c77ba5da2.png?x-oss-process=image/auto-orient,1/resize,m_lfit,w_1280,limit_1/sharpen,100' + 'https://img.zcool.cn/community/0104c958b69c23a801219c77ba5da2.png?x-oss-process=image/auto-orient,1/resize,m_lfit,w_1280,limit_1/sharpen,100', + // 是否已预约 + isAppoint: true } }, mounted() { @@ -115,19 +117,54 @@ export default { }, // 跳转页面 handlePage(url) { - if ( - (url == 'appointment' && uni.getStorageSync('appoint')) || - (url == 'jobAppointment' && uni.getStorageSync('jobAppoint')) - ) { - uni.showToast({ - title: '您已经预约过,无法再次预约!', - icon: 'none' + if (url == 'appointment' || url == 'jobAppointment') { + const params = { + appoint: url == 'appointment' ? '2' : '3', + token: this.token + } + console.log('🚀 ~ getStatus ~ params:', params) + uni.request({ + url: config.tjBaseUrl + '/app/getphyappoint', + method: 'post', + data: params, + header: { + 'content-type': 'application/x-www-form-urlencoded', + token: this.token + }, + success: res => { + console.log('🚀 ~ getStatus ~ res:', res) + res = res.data + if (res.res == 1 && res.obj == 1) { + this.isAppoint = false + } + }, + fail: err => { + console.log('🚀 ~ getStatus ~ err:', err) + uni.showToast({ + title: '系统异常,请联系管理员', + icon: 'none' + }) + } + }) + + setTimeout(() => { + if (this.isAppoint) { + uni.showToast({ + title: '您已经预约过,无法再次预约!', + icon: 'none' + }) + return + } else { + uni.navigateTo({ + url: `/pages/HealthExaminationApp/${url}/${url}?params=${JSON.stringify(this.userInfo)}` + }) + } + }, 200) + } else { + uni.navigateTo({ + url: `/pages/HealthExaminationApp/${url}/${url}?params=${JSON.stringify(this.userInfo)}` }) - return } - uni.navigateTo({ - url: `/pages/HealthExaminationApp/${url}/${url}?params=${JSON.stringify(this.userInfo)}` - }) }, // 获取状态 getStatus() { diff --git a/pages/HealthExaminationApp/jobAppointment/jobAppointment.vue b/pages/HealthExaminationApp/jobAppointment/jobAppointment.vue index 260f8a4..b93c25c 100644 --- a/pages/HealthExaminationApp/jobAppointment/jobAppointment.vue +++ b/pages/HealthExaminationApp/jobAppointment/jobAppointment.vue @@ -206,7 +206,7 @@ export default { token: this.token, hosId: this.hospitalInfo.id, phyAppontTime: this.healthTime, - type: '2' + type: '3' } console.log('🚀 ~ getReservationNumber ~ params:', params) uni.request({ @@ -244,7 +244,7 @@ export default { const params = { hospitalId: this.hospitalInfo.id, setMealId: this.setMealId, - checkId: '', + checkId: undefined, phyAppontTime: this.healthTime, setMealType: '3', combName: this.checkType, @@ -266,7 +266,7 @@ export default { res = res.data console.log('🚀 ~ handleSave ~ res:', res) if (res.res == 1) { - uni.setStorageSync('jobAppoint', true) + // uni.setStorageSync('jobAppoint', true) uni.showToast({ title: '预约成功', icon: 'success' @@ -274,6 +274,11 @@ export default { uni.reLaunch({ url: '/pages/HealthExaminationApp/myAppointment/bookSuccessfully' }) + } else { + uni.showToast({ + title: res.resMsg, + icon: 'none' + }) } }, fail: err => { diff --git a/pages/HealthExaminationApp/myAppointment/myAppointment.vue b/pages/HealthExaminationApp/myAppointment/myAppointment.vue index 355fe41..897179a 100644 --- a/pages/HealthExaminationApp/myAppointment/myAppointment.vue +++ b/pages/HealthExaminationApp/myAppointment/myAppointment.vue @@ -12,7 +12,7 @@
- +
提示:向左滑动,取消预约