调整日程日期选择与预约入口

This commit is contained in:
2026-10-31 03:03:34 +08:00
parent 0e4043628e
commit ddc04705e3
5 changed files with 108 additions and 41 deletions
+27 -17
View File
@@ -320,21 +320,25 @@ Page({
this.loadCalendar()
},
quickCreateAppointment(event) {
if (!this.data.canCreateAppointment) {
wx.showToast({ title: '当前账号仅支持查看预约', icon: 'none' })
return
}
selectMonthDate(event) {
const appointmentDate = dateUtil.formatDate(event.currentTarget.dataset.date)
if (appointmentDate < dateUtil.formatDate(new Date())) {
this.openBackfillOrder(appointmentDate)
return
}
if (!this.data.businessHoursConfigured) {
wx.showToast({ title: '请先在店铺设置中配置营业时间', icon: 'none' })
return
}
this.openAppointmentForm(appointmentDate)
const target = toLocalDate(appointmentDate)
this.setData({
viewMode: 'day',
currentDate: target,
currentDateText: appointmentDate
})
this.loadCalendar()
},
selectWeekDate(event) {
const appointmentDate = dateUtil.formatDate(event.currentTarget.dataset.date)
const target = toLocalDate(appointmentDate)
this.setData({
currentDate: target,
currentDateText: appointmentDate
})
this.prepareView()
},
prevRange() {
@@ -763,7 +767,7 @@ Page({
wx.showToast({ title: '请先在店铺设置中配置营业时间', icon: 'none' })
return
}
this.openAppointmentForm(this.data.currentDateText)
this.openAppointmentForm(this.data.viewMode === 'day' ? this.data.currentDateText : '')
},
openBackfillOrder(serviceDate) {
@@ -779,11 +783,17 @@ Page({
},
openAppointmentForm(appointmentDate) {
const query = [`date=${encodeURIComponent(appointmentDate)}`]
const query = []
if (appointmentDate) {
query.push(`date=${encodeURIComponent(appointmentDate)}`)
} else {
query.push('dateMode=manual')
}
if (this.data.selectedArtistId) {
query.push(`artistId=${encodeURIComponent(this.data.selectedArtistId)}`)
}
wx.navigateTo({ url: `/pages/appointment-form/index?${query.join('&')}` })
const queryText = query.length ? `?${query.join('&')}` : ''
wx.navigateTo({ url: `/pages/appointment-form/index${queryText}` })
},
openShopSettings() {