Feat:旅居日期选了开始日期自动选择结束日期

This commit is contained in:
LinCyJang
2026-01-31 13:41:39 +08:00
parent 3da6899db0
commit 7eeb313931
@@ -317,6 +317,16 @@ export default {
if (!day || this.isDisabled(day)) return
const selectedDate = this.getDateFromDay(day)
// 如果设置了最小预订天数,则自动计算结束日期
if (this.minBookingDays > 0) {
this.tempStartDate = selectedDate
const endDate = new Date(selectedDate)
endDate.setDate(selectedDate.getDate() + this.minBookingDays - 1)
this.tempEndDate = endDate
this.selectionState = 'completed'
return
}
// 如果已有完整的日期区间(开始日期和结束日期都存在),重置选择
if (this.tempStartDate && this.tempEndDate && this.selectionState === 'completed') {