完善功能

This commit is contained in:
wangxiaowei
2026-03-02 17:08:36 +08:00
parent 18e0423699
commit bd461f3e18
17 changed files with 607 additions and 5 deletions

View File

@ -468,11 +468,42 @@ export default {
* @param time
* @param status
*/
handleSelectTime(title, time, status) {
handleSelectTime(title, time, status, room_id, price, light_price) {
let self = this
if (status == 1) {
return;
}
// 新增逻辑:限制只能选择一个场地的免费时间段
const isClickingFree = (Number(price) || 0) <= 0;
const isCurrentlySelected = this.selectedTime[title] && this.selectedTime[title].includes(time);
// 如果是准备选中一个免费时间段(不在已选列表中)
if (isClickingFree && !isCurrentlySelected) {
let hasOtherRoomFree = false;
Object.keys(this.selectedTime).forEach(roomTitle => {
if (roomTitle !== title && this.selectedTime[roomTitle].length > 0) {
const otherRoom = this.cdList.find(cd => cd.title === roomTitle);
if (otherRoom) {
this.selectedTime[roomTitle].forEach(t => {
const tObj = otherRoom.time && otherRoom.time.find(item => item.t === t);
if (tObj && (Number(tObj.price) || 0) <= 0) {
hasOtherRoomFree = true;
}
});
}
}
});
if (hasOtherRoomFree) {
uni.showToast({
title: '只能选择同一场地的免费时间段',
icon: 'none'
});
return;
}
}
// 多选逻辑selectedTime为对象按title区分
if (!this.selectedTime[title]) {
this.$set(this.selectedTime, title, []);
@ -726,6 +757,11 @@ export default {
uni.navigateTo({
url: `/bundle/reserve/confirm?venueId=${self.venue.id}&roomId=${self.id}&typeId=${self.typeId}&orderId=${res.data.lists.id}`
});
} else {
uni.showToast({
title: res.msg || '订单提交失败,请重试',
icon: 'none'
});
}
}
)