From b0b79b2ce0562168f7f95a5d7c3e86cf096d1b66 Mon Sep 17 00:00:00 2001 From: Leo_Ding <2405260743@qq.com> Date: Tue, 16 Sep 2025 11:01:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A2=84=E7=BA=A6=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=92=8C=E5=B7=B2=E8=A2=AB=E9=A2=84=E7=BA=A6=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/meetingDetail/index.vue | 71 +++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 23 deletions(-) diff --git a/pages/meetingDetail/index.vue b/pages/meetingDetail/index.vue index 3665058..f7b05ef 100644 --- a/pages/meetingDetail/index.vue +++ b/pages/meetingDetail/index.vue @@ -198,11 +198,7 @@ - @@ -279,7 +275,7 @@ if (endHours >= 24) endHours = 0; return { - noIsSelfStudy:false, + noIsSelfStudy: false, pickerType: 1, borrowTimeData: '', borrowTimeShow: false, @@ -399,18 +395,11 @@ endTimePickerValue: ``, applyInfo: {}, // 日期相关 - // selectedDate: `${year}-${month}-${day}`, - // minDate: `${year}-${month}-${day}`, - // maxDate: `${year + 1}-12-31`, - selectedDate: `2025-08-11`, // 默认选中8月1日 - minDate: `2025-08-01`, // 最小可选8月1日 - maxDate: `2025-08-31`, // 最大可选8月31日 + selectedDate: `${year}-${month}-${day}`, + minDate: `${year}-${month}-${day}`, + maxDate: `${year + 1}-12-31`, + - // 时间相关 - // startTime: `2025-08`, - // endTime: `2025-08`, - // startTimeValue: `${startHours.toString().padStart(2, '0')}:${startMinutes.toString().padStart(2, '0')}`, - // endTimeValue: `${endHours.toString().padStart(2, '0')}:${endMinutes.toString().padStart(2, '0')}`, startTimeValue: `09:00`, endTimeValue: `10:00`, @@ -614,7 +603,7 @@ } else { this.endTime = `${e.value[0]}:${e.value[1]}` } - this.noIsSelfStudy=false + this.noIsSelfStudy = false }, handleEndTimeConfirm(e) { if (this.isSelfStudy) { @@ -726,9 +715,39 @@ resolve('所有属性验证通过'); }); }, + validateBorrowTime(applyInfo = {}) { + return new Promise(async (resolve, reject) => { + const response = await post('/api/v1/app_auth/metting-room/order/check_time', applyInfo) + if (!response || !response.success) { + reject( + uni.showToast({ + title: response.msg, + icon: 'none' + }) + ) + } + if (response.success == true) { + resolve() + } + }) + }, async handleBook() { try { this.readShow = false + if (!this.isSelfStudy) { + if (!this.startTime || !this.endTime) { + return uni.showToast({ + title: '开始和结束时间不能为空', + icon: 'none' + }) + } + if(this.startTime>this.endTime){ + return uni.showToast({ + title: '开始时间不能晚于结束时间', + icon: 'none' + }) + } + } // console.log(this.applyType); let bookingInfo = { roomId: this.Id, @@ -743,14 +762,17 @@ userPhone: this.userPhone, userAddress: this.userAddress, userCardId: this.userCardId, - startTime: this.isSelfStudy?this.startTime:`${this.borrowTimeData} ${this.startTime}`, - endTime: this.isSelfStudy?this.endTime:`${this.borrowTimeData} ${this.endTime}`, + startTime: this.isSelfStudy ? this.startTime : + `${this.borrowTimeData}${this.startTime}`, + endTime: this.isSelfStudy ? this.endTime : `${this.borrowTimeData}${this.endTime}`, counter: this.counter, num: this.num, // applyType:this.applyType } await this.validateObject(userApplyInfo, this.applyRules) + const applyInfo = Object.assign(bookingInfo, userApplyInfo) + await this.validateBorrowTime(applyInfo) // 页面A设置参数 const app = getApp() app.globalData.applyInfo = applyInfo @@ -767,16 +789,19 @@ concatName: this.concatName, concatPhone: this.concatPhone, companyName: this.companyName, - startTime: this.isSelfStudy?this.startTime:`${this.borrowTimeData} ${this.startTime}`, - endTime: this.isSelfStudy?this.endTime:`${this.borrowTimeData} ${this.endTime}`, + startTime: this.isSelfStudy ? this.startTime : + `${this.borrowTimeData}${this.startTime}`, + endTime: this.isSelfStudy ? this.endTime : `${this.borrowTimeData}${this.endTime}`, counter: this.counter, num: this.num, stampUrl: this.stampUrl, // applyType:this.applyType } await this.validateObject(userApplyInfo, this.applyRules) + const applyInfo = Object.assign(bookingInfo, userApplyInfo) + await this.validateBorrowTime(applyInfo) const app = getApp() - app.globalData.applyInfo = Object.assign(bookingInfo, userApplyInfo) + app.globalData.applyInfo = applyInfo this.readShow = true } } catch (error) {