调整日程日期选择与预约入口
This commit is contained in:
@@ -494,7 +494,10 @@ function buildArtistSelectorItem(artist) {
|
||||
}
|
||||
|
||||
function buildAppointmentDateLabels(value) {
|
||||
const dateValue = String(value || dateUtil.formatDate(new Date()))
|
||||
const dateValue = String(value || '')
|
||||
if (!dateValue) {
|
||||
return { day: '', badge: '请选择预约日期', long: '请选择预约日期' }
|
||||
}
|
||||
const date = new Date(dateValue.replace(/-/g, '/'))
|
||||
if (Number.isNaN(date.getTime())) {
|
||||
return { day: '', badge: dateValue, long: dateValue }
|
||||
@@ -596,6 +599,7 @@ Page({
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
const manualDateMode = options && options.dateMode === 'manual'
|
||||
const today = dateUtil.formatDate(new Date())
|
||||
if (options && options.date && options.date < today) {
|
||||
this._pendingHistoricalArtistId = options.artistId || ''
|
||||
@@ -603,10 +607,10 @@ Page({
|
||||
return
|
||||
}
|
||||
const creatable = canCreateAppointment()
|
||||
const draftForm = creatable && !hasPresetOptions(options) ? readDraftForm() : null
|
||||
const draftForm = creatable && (manualDateMode || !hasPresetOptions(options)) ? readDraftForm() : null
|
||||
const baseForm = draftForm || {}
|
||||
const manualProductImages = normalizeManualProductImages(baseForm)
|
||||
const appointmentDate = options.date || baseForm.appointmentDate || dateUtil.formatDate(new Date())
|
||||
const appointmentDate = options.date || baseForm.appointmentDate || (manualDateMode ? '' : today)
|
||||
const dateLabels = buildAppointmentDateLabels(appointmentDate)
|
||||
this.setData({
|
||||
canCreateAppointment: creatable,
|
||||
@@ -692,8 +696,8 @@ Page({
|
||||
: {}
|
||||
try {
|
||||
const calendar = await planningApi.calendar({
|
||||
startDate: this.data.form.appointmentDate,
|
||||
endDate: this.data.form.appointmentDate
|
||||
startDate: this.data.form.appointmentDate || dateUtil.formatDate(new Date()),
|
||||
endDate: this.data.form.appointmentDate || dateUtil.formatDate(new Date())
|
||||
})
|
||||
let artists = getCalendarArtists(calendar)
|
||||
const businessHours = resolveBusinessHours(calendar)
|
||||
|
||||
Reference in New Issue
Block a user