优化:规划日期快捷新增预约

This commit is contained in:
2026-10-12 17:15:27 +08:00
parent e4aff0803a
commit 2714bd7201
4 changed files with 82 additions and 16 deletions
+22 -13
View File
@@ -51,9 +51,9 @@ Page({
data: {
viewMode: 'month',
viewModes: [
{ value: 'day', label: '日' },
{ value: 'month', label: '月' },
{ value: 'week', label: '周' },
{ value: 'month', label: '月' }
{ value: 'day', label: '日' }
],
monthDisplayMode: 'count',
monthDisplayModes: [
@@ -234,14 +234,17 @@ Page({
this.loadCalendar()
},
selectDate(event) {
const currentDate = dateUtil.formatDate(event.currentTarget.dataset.date)
this.setData({
currentDate,
currentDateText: currentDate,
viewMode: this.data.viewMode === 'month' ? 'day' : this.data.viewMode
})
this.prepareView()
quickCreateAppointment(event) {
if (!this.data.canCreateAppointment) {
wx.showToast({ title: '当前账号仅支持查看预约', icon: 'none' })
return
}
const appointmentDate = dateUtil.formatDate(event.currentTarget.dataset.date)
if (appointmentDate < dateUtil.formatDate(new Date())) {
wx.showToast({ title: '不能为历史日期新增预约', icon: 'none' })
return
}
this.openAppointmentForm(appointmentDate)
},
prevRange() {
@@ -545,9 +548,15 @@ Page({
wx.showToast({ title: '当前账号仅支持查看预约', icon: 'none' })
return
}
wx.navigateTo({
url: `/pages/appointment-form/index?date=${this.data.currentDateText}&artistId=${this.data.selectedArtistId || ''}`
})
this.openAppointmentForm(this.data.currentDateText)
},
openAppointmentForm(appointmentDate) {
const query = [`date=${encodeURIComponent(appointmentDate)}`]
if (this.data.selectedArtistId) {
query.push(`artistId=${encodeURIComponent(this.data.selectedArtistId)}`)
}
wx.navigateTo({ url: `/pages/appointment-form/index?${query.join('&')}` })
},
openAppointment(event) {