添加预约时间和已被预约数量限制
This commit is contained in:
parent
e0579b82ab
commit
b0b79b2ce0
@ -198,11 +198,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- 日历组件 -->
|
<!-- 日历组件 -->
|
||||||
<u-calendar
|
<u-calendar :key="calendarKey" :show="showCalendar" mode="single" :min-date="minDate" :max-date="maxDate"
|
||||||
:key="calendarKey"
|
|
||||||
:show="showCalendar"
|
|
||||||
mode="single" :min-date="minDate"
|
|
||||||
:max-date="maxDate"
|
|
||||||
@confirm="handleDateConfirm" @close="showCalendar = false" :mask-close-able="true"></u-calendar>
|
@confirm="handleDateConfirm" @close="showCalendar = false" :mask-close-able="true"></u-calendar>
|
||||||
|
|
||||||
<!-- 时间选择器 -->
|
<!-- 时间选择器 -->
|
||||||
@ -279,7 +275,7 @@
|
|||||||
if (endHours >= 24) endHours = 0;
|
if (endHours >= 24) endHours = 0;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
noIsSelfStudy:false,
|
noIsSelfStudy: false,
|
||||||
pickerType: 1,
|
pickerType: 1,
|
||||||
borrowTimeData: '',
|
borrowTimeData: '',
|
||||||
borrowTimeShow: false,
|
borrowTimeShow: false,
|
||||||
@ -399,18 +395,11 @@
|
|||||||
endTimePickerValue: ``,
|
endTimePickerValue: ``,
|
||||||
applyInfo: {},
|
applyInfo: {},
|
||||||
// 日期相关
|
// 日期相关
|
||||||
// selectedDate: `${year}-${month}-${day}`,
|
selectedDate: `${year}-${month}-${day}`,
|
||||||
// minDate: `${year}-${month}-${day}`,
|
minDate: `${year}-${month}-${day}`,
|
||||||
// maxDate: `${year + 1}-12-31`,
|
maxDate: `${year + 1}-12-31`,
|
||||||
selectedDate: `2025-08-11`, // 默认选中8月1日
|
|
||||||
minDate: `2025-08-01`, // 最小可选8月1日
|
|
||||||
maxDate: `2025-08-31`, // 最大可选8月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`,
|
startTimeValue: `09:00`,
|
||||||
endTimeValue: `10:00`,
|
endTimeValue: `10:00`,
|
||||||
@ -614,7 +603,7 @@
|
|||||||
} else {
|
} else {
|
||||||
this.endTime = `${e.value[0]}:${e.value[1]}`
|
this.endTime = `${e.value[0]}:${e.value[1]}`
|
||||||
}
|
}
|
||||||
this.noIsSelfStudy=false
|
this.noIsSelfStudy = false
|
||||||
},
|
},
|
||||||
handleEndTimeConfirm(e) {
|
handleEndTimeConfirm(e) {
|
||||||
if (this.isSelfStudy) {
|
if (this.isSelfStudy) {
|
||||||
@ -726,9 +715,39 @@
|
|||||||
resolve('所有属性验证通过');
|
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() {
|
async handleBook() {
|
||||||
try {
|
try {
|
||||||
this.readShow = false
|
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);
|
// console.log(this.applyType);
|
||||||
let bookingInfo = {
|
let bookingInfo = {
|
||||||
roomId: this.Id,
|
roomId: this.Id,
|
||||||
@ -743,14 +762,17 @@
|
|||||||
userPhone: this.userPhone,
|
userPhone: this.userPhone,
|
||||||
userAddress: this.userAddress,
|
userAddress: this.userAddress,
|
||||||
userCardId: this.userCardId,
|
userCardId: this.userCardId,
|
||||||
startTime: this.isSelfStudy?this.startTime:`${this.borrowTimeData} ${this.startTime}`,
|
startTime: this.isSelfStudy ? this.startTime :
|
||||||
endTime: this.isSelfStudy?this.endTime:`${this.borrowTimeData} ${this.endTime}`,
|
`${this.borrowTimeData}${this.startTime}`,
|
||||||
|
endTime: this.isSelfStudy ? this.endTime : `${this.borrowTimeData}${this.endTime}`,
|
||||||
counter: this.counter,
|
counter: this.counter,
|
||||||
num: this.num,
|
num: this.num,
|
||||||
// applyType:this.applyType
|
// applyType:this.applyType
|
||||||
}
|
}
|
||||||
await this.validateObject(userApplyInfo, this.applyRules)
|
await this.validateObject(userApplyInfo, this.applyRules)
|
||||||
|
|
||||||
const applyInfo = Object.assign(bookingInfo, userApplyInfo)
|
const applyInfo = Object.assign(bookingInfo, userApplyInfo)
|
||||||
|
await this.validateBorrowTime(applyInfo)
|
||||||
// 页面A设置参数
|
// 页面A设置参数
|
||||||
const app = getApp()
|
const app = getApp()
|
||||||
app.globalData.applyInfo = applyInfo
|
app.globalData.applyInfo = applyInfo
|
||||||
@ -767,16 +789,19 @@
|
|||||||
concatName: this.concatName,
|
concatName: this.concatName,
|
||||||
concatPhone: this.concatPhone,
|
concatPhone: this.concatPhone,
|
||||||
companyName: this.companyName,
|
companyName: this.companyName,
|
||||||
startTime: this.isSelfStudy?this.startTime:`${this.borrowTimeData} ${this.startTime}`,
|
startTime: this.isSelfStudy ? this.startTime :
|
||||||
endTime: this.isSelfStudy?this.endTime:`${this.borrowTimeData} ${this.endTime}`,
|
`${this.borrowTimeData}${this.startTime}`,
|
||||||
|
endTime: this.isSelfStudy ? this.endTime : `${this.borrowTimeData}${this.endTime}`,
|
||||||
counter: this.counter,
|
counter: this.counter,
|
||||||
num: this.num,
|
num: this.num,
|
||||||
stampUrl: this.stampUrl,
|
stampUrl: this.stampUrl,
|
||||||
// applyType:this.applyType
|
// applyType:this.applyType
|
||||||
}
|
}
|
||||||
await this.validateObject(userApplyInfo, this.applyRules)
|
await this.validateObject(userApplyInfo, this.applyRules)
|
||||||
|
const applyInfo = Object.assign(bookingInfo, userApplyInfo)
|
||||||
|
await this.validateBorrowTime(applyInfo)
|
||||||
const app = getApp()
|
const app = getApp()
|
||||||
app.globalData.applyInfo = Object.assign(bookingInfo, userApplyInfo)
|
app.globalData.applyInfo = applyInfo
|
||||||
this.readShow = true
|
this.readShow = true
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user