改造店务小程序预约时间选择器
This commit is contained in:
@@ -375,6 +375,65 @@ function isWindowAvailable(calendar, form, startMinute, durationMinutes, busyRan
|
||||
return true
|
||||
}
|
||||
|
||||
function formatDayEndMinute(minute) {
|
||||
return minute >= DAY_MINUTES ? '24:00' : dateUtil.timeFromMinutes(minute)
|
||||
}
|
||||
|
||||
function formatSegmentRange(segment) {
|
||||
return `${segment.date} ${dateUtil.timeFromMinutes(segment.startMinute)}-${formatDayEndMinute(segment.endMinute)}`
|
||||
}
|
||||
|
||||
function resolveBusinessUnavailableTip(calendar, segment) {
|
||||
const daySummary = findDaySummary(calendar, segment.date)
|
||||
if (daySummary && daySummary.dayStatus === 'rest') {
|
||||
return `${segment.date} 为店铺休息日`
|
||||
}
|
||||
const businessStartTime = (daySummary && daySummary.businessStartTime) || calendar.businessStartTime
|
||||
const businessEndTime = (daySummary && daySummary.businessEndTime) || calendar.businessEndTime
|
||||
const businessStartMinute = businessStartTime ? dateUtil.minutesOfDay(extractTimeText(businessStartTime)) : segment.startMinute
|
||||
const businessEndMinute = businessEndTime ? resolveCoverageEndMinute(businessEndTime) : segment.endMinute
|
||||
if (segment.startMinute < businessStartMinute || segment.endMinute > businessEndMinute) {
|
||||
return `预约时间不在门店营业时间内(${segment.date} 营业时间 ${dateUtil.timeFromMinutes(businessStartMinute)}-${formatDayEndMinute(businessEndMinute)})`
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
function resolveScheduleUnavailableTip(calendar, form, segment) {
|
||||
const schedules = (calendar.schedules || [])
|
||||
.filter(item => String(item.artistId) === String(form.artistId))
|
||||
.filter(item => item.date === segment.date)
|
||||
const activeSchedules = schedules
|
||||
.filter(item => item.status === 1 && Number(item.capacity === undefined ? 1 : item.capacity) >= 1)
|
||||
if (activeSchedules.length === 0) {
|
||||
return `该美甲师 ${segment.date} 没有可预约排班`
|
||||
}
|
||||
const covered = activeSchedules.some(schedule => {
|
||||
const scheduleStartMinute = dateUtil.minutesOfDay(extractTimeText(schedule.startTime))
|
||||
const scheduleEndMinute = resolveCoverageEndMinute(schedule.endTime)
|
||||
return segment.startMinute >= scheduleStartMinute && segment.endMinute <= scheduleEndMinute
|
||||
})
|
||||
return covered ? '' : `该美甲师排班未覆盖 ${formatSegmentRange(segment)}`
|
||||
}
|
||||
|
||||
function resolveUnavailableTimeTip(calendar, form, startMinute, durationMinutes, busyRanges) {
|
||||
const segments = splitWindowSegments(form.appointmentDate, startMinute, durationMinutes)
|
||||
for (let index = 0; index < segments.length; index += 1) {
|
||||
const segment = segments[index]
|
||||
const businessTip = resolveBusinessUnavailableTip(calendar, segment)
|
||||
if (businessTip) {
|
||||
return businessTip
|
||||
}
|
||||
const scheduleTip = resolveScheduleUnavailableTip(calendar, form, segment)
|
||||
if (scheduleTip) {
|
||||
return scheduleTip
|
||||
}
|
||||
}
|
||||
if (hasBusyConflict(startMinute, startMinute + durationMinutes, busyRanges)) {
|
||||
return `该时间段已被其他预约占用(${buildTimeRangeLabel(startMinute, durationMinutes)})`
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
function getCurrentMinuteOfDay() {
|
||||
const now = new Date()
|
||||
return now.getHours() * 60 + now.getMinutes()
|
||||
@@ -398,11 +457,56 @@ function canUseTimeMinute(form, minute) {
|
||||
return minute > getCurrentMinuteOfDay()
|
||||
}
|
||||
|
||||
function resolveTimeSelectTip(form, availableTimes) {
|
||||
if (availableTimes.length > 0) {
|
||||
return '请选择预约时间'
|
||||
function splitTimeValue(value) {
|
||||
const parts = String(value || '').split(':')
|
||||
return {
|
||||
hour: parts[0] || '',
|
||||
minute: parts[1] || ''
|
||||
}
|
||||
return isToday(form.appointmentDate) ? '今天暂无未来可约时间' : '当前美甲师当天暂无可约时间'
|
||||
}
|
||||
|
||||
function buildTimePickerState(selectedValue) {
|
||||
const hourValues = []
|
||||
const minuteValues = []
|
||||
for (let hour = 0; hour < 24; hour += 1) {
|
||||
hourValues.push(String(hour).padStart(2, '0'))
|
||||
}
|
||||
for (let minute = 0; minute < 60; minute += 1) {
|
||||
minuteValues.push(String(minute).padStart(2, '0'))
|
||||
}
|
||||
const selectedParts = splitTimeValue(selectedValue)
|
||||
const selectedHour = hourValues.includes(selectedParts.hour) ? selectedParts.hour : hourValues[0]
|
||||
const selectedMinute = minuteValues.includes(selectedParts.minute) ? selectedParts.minute : minuteValues[0]
|
||||
const value = `${selectedHour}:${selectedMinute}`
|
||||
return {
|
||||
hourValues,
|
||||
minuteValues,
|
||||
value,
|
||||
indices: [hourValues.indexOf(selectedHour), minuteValues.indexOf(selectedMinute)]
|
||||
}
|
||||
}
|
||||
|
||||
function resolveInitialTimePickerValue(form) {
|
||||
if (form.appointmentTime) {
|
||||
return form.appointmentTime
|
||||
}
|
||||
if (!isToday(form.appointmentDate)) {
|
||||
return '00:00'
|
||||
}
|
||||
return dateUtil.timeFromMinutes(Math.min(DAY_MINUTES - 1, getCurrentMinuteOfDay() + 1))
|
||||
}
|
||||
|
||||
function resolveTimeConfirmTip(form) {
|
||||
if (!form.appointmentDate) {
|
||||
return '请先选择预约日期'
|
||||
}
|
||||
if (!form.artistId) {
|
||||
return '请先选择美甲师'
|
||||
}
|
||||
if (!normalizeDuration(form.durationMinutes)) {
|
||||
return '请先填写预约时长'
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
function buildAvailableTimeGroups(calendar, form, durationMinutes) {
|
||||
@@ -688,10 +792,14 @@ Page({
|
||||
draftSavedAtText: '',
|
||||
manualImageUploading: false,
|
||||
timeSheetVisible: false,
|
||||
timeLoading: false,
|
||||
timeError: '',
|
||||
timeSelectTip: '请先选择美甲师并填写时长',
|
||||
availableTimeGroups: [],
|
||||
timeSelectTip: '请选择预约时间',
|
||||
timePickerHours: [],
|
||||
timePickerMinutes: [],
|
||||
timePickerIndices: [0, 0],
|
||||
timePickerValue: '',
|
||||
timePickerConfirming: false,
|
||||
pageMaskVisible: false,
|
||||
pageMaskText: '',
|
||||
loading: false
|
||||
},
|
||||
|
||||
@@ -716,23 +824,42 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
showPageMask(text) {
|
||||
this.setData({
|
||||
pageMaskVisible: true,
|
||||
pageMaskText: text
|
||||
})
|
||||
},
|
||||
|
||||
hidePageMask() {
|
||||
this.setData({
|
||||
pageMaskVisible: false,
|
||||
pageMaskText: ''
|
||||
})
|
||||
},
|
||||
|
||||
async loadOptions() {
|
||||
this.showPageMask('正在加载预约信息')
|
||||
try {
|
||||
const productsData = await productsApi.list({ page: 1, size: 100 })
|
||||
const products = productsData.list || productsData || []
|
||||
this.setData({ products, productError: '' })
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
products: [],
|
||||
filteredProducts: [],
|
||||
productError: error.message || '作品列表加载失败'
|
||||
})
|
||||
try {
|
||||
const productsData = await productsApi.list({ page: 1, size: 100 })
|
||||
const products = productsData.list || productsData || []
|
||||
this.setData({ products, productError: '' })
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
products: [],
|
||||
filteredProducts: [],
|
||||
productError: error.message || '作品列表加载失败'
|
||||
})
|
||||
}
|
||||
await this.loadTags()
|
||||
await this.loadArtists()
|
||||
this.refreshProductCards()
|
||||
await this.refreshAvailableTimes()
|
||||
await this.checkAvailability(this.data.form.appointmentTime)
|
||||
} finally {
|
||||
this.hidePageMask()
|
||||
}
|
||||
await this.loadTags()
|
||||
await this.loadArtists()
|
||||
this.refreshProductCards()
|
||||
await this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
async loadTags() {
|
||||
@@ -888,13 +1015,18 @@ Page({
|
||||
},
|
||||
|
||||
async onDateChange(event) {
|
||||
this.setData({
|
||||
'form.appointmentDate': event.detail.value,
|
||||
'form.appointmentTime': ''
|
||||
})
|
||||
await this.loadArtists()
|
||||
await this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
this.showPageMask('正在切换预约日期')
|
||||
try {
|
||||
this.setData({
|
||||
'form.appointmentDate': event.detail.value,
|
||||
'form.appointmentTime': ''
|
||||
})
|
||||
await this.loadArtists()
|
||||
await this.refreshAvailableTimes()
|
||||
await this.checkAvailability(this.data.form.appointmentTime)
|
||||
} finally {
|
||||
this.hidePageMask()
|
||||
}
|
||||
},
|
||||
|
||||
refreshProductCards() {
|
||||
@@ -1032,7 +1164,7 @@ Page({
|
||||
})
|
||||
this.closeProductModal()
|
||||
this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
void this.checkAvailability(this.data.form.appointmentTime)
|
||||
},
|
||||
|
||||
async chooseManualProductImage() {
|
||||
@@ -1143,96 +1275,120 @@ Page({
|
||||
pendingArtistId: ''
|
||||
})
|
||||
this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
void this.checkAvailability(this.data.form.appointmentTime)
|
||||
},
|
||||
|
||||
canOpenTimeSheet() {
|
||||
const form = this.data.form
|
||||
return Boolean(form.appointmentDate && form.artistId && normalizeDuration(form.durationMinutes))
|
||||
return Boolean(form.appointmentDate)
|
||||
},
|
||||
|
||||
async refreshAvailableTimes() {
|
||||
refreshAvailableTimes() {
|
||||
const form = this.data.form
|
||||
const durationMinutes = normalizeDuration(form.durationMinutes)
|
||||
const requestSeq = (this._availableTimeRequestSeq || 0) + 1
|
||||
this._availableTimeRequestSeq = requestSeq
|
||||
if (!form.appointmentDate || !form.artistId || !durationMinutes) {
|
||||
const patch = {
|
||||
availableTimeGroups: [],
|
||||
timeError: '',
|
||||
timeSelectTip: '请先选择美甲师并填写时长'
|
||||
}
|
||||
if (form.appointmentTime) {
|
||||
patch['form.appointmentTime'] = ''
|
||||
}
|
||||
this.setData(patch)
|
||||
if (!form.appointmentDate) {
|
||||
this.setData({
|
||||
timeSelectTip: '请选择预约时间',
|
||||
timePickerHours: [],
|
||||
timePickerMinutes: [],
|
||||
timePickerIndices: [0, 0],
|
||||
timePickerValue: ''
|
||||
})
|
||||
return
|
||||
}
|
||||
const timePickerState = buildTimePickerState(resolveInitialTimePickerValue(form))
|
||||
this.setData({
|
||||
timeLoading: true,
|
||||
timeError: '',
|
||||
timeSelectTip: '正在计算可约时间...'
|
||||
timeSelectTip: '请选择预约时间',
|
||||
timePickerHours: timePickerState.hourValues,
|
||||
timePickerMinutes: timePickerState.minuteValues,
|
||||
timePickerIndices: timePickerState.indices,
|
||||
timePickerValue: timePickerState.value
|
||||
})
|
||||
try {
|
||||
const calendar = await planningApi.calendar({
|
||||
startDate: form.appointmentDate,
|
||||
endDate: resolveAppointmentCalendarEndDate(form),
|
||||
artistId: form.artistId
|
||||
})
|
||||
if (requestSeq !== this._availableTimeRequestSeq) {
|
||||
return
|
||||
}
|
||||
const availableTimeGroups = buildAvailableTimeGroups(calendar, form, durationMinutes)
|
||||
const availableTimes = flattenTimeGroups(availableTimeGroups).map(item => item.value)
|
||||
const patch = {
|
||||
availableTimeGroups,
|
||||
timeSelectTip: resolveTimeSelectTip(form, availableTimes)
|
||||
}
|
||||
if (form.appointmentTime && !availableTimes.includes(form.appointmentTime)) {
|
||||
patch['form.appointmentTime'] = ''
|
||||
}
|
||||
this.setData(patch)
|
||||
} catch (error) {
|
||||
if (requestSeq !== this._availableTimeRequestSeq) {
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
availableTimeGroups: [],
|
||||
timeError: error.message || '可约时间加载失败',
|
||||
timeSelectTip: '可约时间加载失败'
|
||||
})
|
||||
} finally {
|
||||
if (requestSeq === this._availableTimeRequestSeq) {
|
||||
this.setData({ timeLoading: false })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async openTimeSheet() {
|
||||
if (!this.canOpenTimeSheet()) {
|
||||
wx.showToast({ title: '请先选择美甲师并填写时长', icon: 'none' })
|
||||
wx.showToast({ title: '请先选择预约日期', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ timeSheetVisible: true })
|
||||
await this.refreshAvailableTimes()
|
||||
this.setData({
|
||||
timeSheetVisible: true,
|
||||
timePickerConfirming: false
|
||||
})
|
||||
this.refreshAvailableTimes()
|
||||
},
|
||||
|
||||
closeTimeSheet() {
|
||||
this.setData({ timeSheetVisible: false })
|
||||
},
|
||||
|
||||
selectAvailableTime(event) {
|
||||
const value = event.currentTarget.dataset.value
|
||||
this.setData({
|
||||
'form.appointmentTime': value,
|
||||
timeSheetVisible: false
|
||||
timeSheetVisible: false,
|
||||
timePickerConfirming: false
|
||||
})
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
async checkAvailability() {
|
||||
onTimePickerChange(event) {
|
||||
const value = Array.isArray(event.detail.value) ? event.detail.value : []
|
||||
const hourValues = this.data.timePickerHours || []
|
||||
const minuteValues = this.data.timePickerMinutes || []
|
||||
const hourIndex = Math.max(0, Math.min(hourValues.length - 1, Number(value[0] || 0)))
|
||||
const minuteIndex = Math.max(0, Math.min(minuteValues.length - 1, Number(value[1] || 0)))
|
||||
const selectedHour = hourValues[hourIndex] || hourValues[0] || '00'
|
||||
const selectedMinute = minuteValues[minuteIndex] || minuteValues[0] || '00'
|
||||
const selectedValue = selectedHour && selectedMinute ? `${selectedHour}:${selectedMinute}` : ''
|
||||
this.setData({
|
||||
timePickerIndices: [hourIndex, minuteIndex],
|
||||
timePickerValue: selectedValue
|
||||
})
|
||||
},
|
||||
|
||||
async confirmTimeSelection() {
|
||||
if (this.data.timePickerConfirming) {
|
||||
return
|
||||
}
|
||||
const selectedTime = this.data.timePickerValue
|
||||
if (!selectedTime) {
|
||||
wx.showToast({ title: '请先选择预约时间', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const confirmTip = resolveTimeConfirmTip(this.data.form)
|
||||
if (confirmTip) {
|
||||
wx.showModal({
|
||||
title: '无法确认时间',
|
||||
content: confirmTip,
|
||||
showCancel: false,
|
||||
confirmText: '知道了'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.setData({ timePickerConfirming: true })
|
||||
this.showPageMask('正在校验预约时间')
|
||||
try {
|
||||
const availability = await this.checkAvailability(selectedTime)
|
||||
this.hidePageMask()
|
||||
if (!availability.ok) {
|
||||
wx.showModal({
|
||||
title: '当前时间不可预约',
|
||||
content: availability.tip || '当前时间不可预约,请重新选择可约时间',
|
||||
showCancel: false,
|
||||
confirmText: '知道了'
|
||||
})
|
||||
await this.checkAvailability(this.data.form.appointmentTime)
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
'form.appointmentTime': selectedTime,
|
||||
timeSheetVisible: false
|
||||
})
|
||||
} catch (error) {
|
||||
this.hidePageMask()
|
||||
wx.showToast({ title: error.message || '时间校验失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ timePickerConfirming: false })
|
||||
}
|
||||
},
|
||||
|
||||
async checkAvailability(appointmentTime) {
|
||||
const form = this.data.form
|
||||
if (!form.appointmentDate || !form.appointmentTime || !form.artistId) {
|
||||
const selectedTime = appointmentTime || form.appointmentTime
|
||||
if (!form.appointmentDate || !selectedTime || !form.artistId) {
|
||||
this.setData({ conflictTip: '', conflictLevel: 'free' })
|
||||
return { ok: true }
|
||||
}
|
||||
@@ -1241,7 +1397,8 @@ Page({
|
||||
this.setData({ conflictTip: '', conflictLevel: 'free' })
|
||||
return { ok: true }
|
||||
}
|
||||
if (isPastAppointmentTime(form)) {
|
||||
const selectedForm = { ...form, appointmentTime: selectedTime }
|
||||
if (isPastAppointmentTime(selectedForm)) {
|
||||
const tip = '请选择当前时间之后的预约时间'
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'danger' })
|
||||
return { ok: false, tip }
|
||||
@@ -1249,23 +1406,18 @@ Page({
|
||||
try {
|
||||
const calendar = await planningApi.calendar({
|
||||
startDate: form.appointmentDate,
|
||||
endDate: resolveAppointmentCalendarEndDate(form),
|
||||
endDate: resolveAppointmentCalendarEndDate(selectedForm),
|
||||
artistId: form.artistId
|
||||
})
|
||||
const daySummary = findDaySummary(calendar, form.appointmentDate)
|
||||
if (daySummary && daySummary.dayStatus === 'rest') {
|
||||
const tip = '当前日期为店铺休息日'
|
||||
const selectedMinute = dateUtil.minutesOfDay(selectedTime)
|
||||
const busyRanges = buildBusyRanges(calendar.appointments || [], selectedForm)
|
||||
const unavailableTip = resolveUnavailableTimeTip(calendar, selectedForm, selectedMinute, durationMinutes, busyRanges)
|
||||
if (unavailableTip) {
|
||||
const tip = unavailableTip
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'danger' })
|
||||
return { ok: false, tip }
|
||||
}
|
||||
const availableTimeGroups = buildAvailableTimeGroups(calendar, form, durationMinutes)
|
||||
const selectedTime = flattenTimeGroups(availableTimeGroups).find(item => item.value === form.appointmentTime)
|
||||
if (!selectedTime) {
|
||||
const tip = '当前时间不可预约,请重新选择可约时间'
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'danger' })
|
||||
return { ok: false, tip }
|
||||
}
|
||||
const tip = `${this.data.selectedArtist.name || '该美甲师'} ${selectedTime.rangeText} 可预约`
|
||||
const tip = `${this.data.selectedArtist.name || '该美甲师'} ${buildTimeRangeLabel(selectedMinute, durationMinutes)} 可预约`
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'free' })
|
||||
return { ok: true, tip }
|
||||
} catch (error) {
|
||||
@@ -1276,6 +1428,9 @@ Page({
|
||||
},
|
||||
|
||||
async submit() {
|
||||
if (this.data.loading || this.data.pageMaskVisible) {
|
||||
return
|
||||
}
|
||||
if (!this.data.canCreateAppointment) {
|
||||
wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' })
|
||||
return
|
||||
@@ -1299,9 +1454,16 @@ Page({
|
||||
wx.showToast({ title: '请填写预约时长', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const availability = await this.checkAvailability()
|
||||
this.showPageMask('正在校验预约信息')
|
||||
const availability = await this.checkAvailability(this.data.form.appointmentTime)
|
||||
this.hidePageMask()
|
||||
if (!availability.ok) {
|
||||
wx.showToast({ title: availability.tip || '该时段已被预约', icon: 'none' })
|
||||
wx.showModal({
|
||||
title: '当前时间不可预约',
|
||||
content: availability.tip || '当前时间不可预约,请重新选择可约时间',
|
||||
showCancel: false,
|
||||
confirmText: '知道了'
|
||||
})
|
||||
return
|
||||
}
|
||||
let confirmed
|
||||
@@ -1315,6 +1477,7 @@ Page({
|
||||
return
|
||||
}
|
||||
this.setData({ loading: true })
|
||||
this.showPageMask('正在提交预约')
|
||||
try {
|
||||
const payload = {
|
||||
...form,
|
||||
@@ -1350,14 +1513,19 @@ Page({
|
||||
orderItemId: result.orderItemId || result.id || ''
|
||||
})
|
||||
markPlanningRefresh()
|
||||
this.showPageMask('正在返回规划页')
|
||||
wx.switchTab({
|
||||
url: '/pages/planning/index',
|
||||
fail: error => wx.showToast({ title: `跳转规划页失败:${error.errMsg || error.message || error}`, icon: 'none' })
|
||||
fail: error => {
|
||||
this.setData({ loading: false })
|
||||
this.hidePageMask()
|
||||
wx.showToast({ title: `跳转规划页失败:${error.errMsg || error.message || error}`, icon: 'none' })
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '提交失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
this.hidePageMask()
|
||||
wx.showToast({ title: error.message || '提交失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<view class="page no-tab">
|
||||
<view class="page no-tab appointment-page">
|
||||
<view class="card form-card">
|
||||
<view class="customer-select">
|
||||
<view class="field {{customerNameFocused ? 'is-focused' : ''}}">
|
||||
@@ -230,27 +230,40 @@
|
||||
</view>
|
||||
<view class="modal-close" bindtap="closeTimeSheet">×</view>
|
||||
</view>
|
||||
<view wx:if="{{timeLoading}}" class="time-empty">正在计算可约时间...</view>
|
||||
<view wx:elif="{{timeError}}" class="time-empty">{{timeError}}</view>
|
||||
<view wx:elif="{{availableTimeGroups.length === 0}}" class="time-empty">当前美甲师当天暂无可约时间</view>
|
||||
<scroll-view wx:else class="time-list" scroll-y>
|
||||
<view wx:for="{{availableTimeGroups}}" wx:key="key" class="time-group">
|
||||
<text class="time-group-title">{{item.title}}</text>
|
||||
<view class="time-grid">
|
||||
<view wx:for="{{item.times}}" wx:for-item="time" wx:key="value" class="time-chip {{form.appointmentTime === time.value ? 'active' : ''}}" data-value="{{time.value}}" bindtap="selectAvailableTime">
|
||||
<text>{{time.value}}</text>
|
||||
<text>{{time.rangeText}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="time-picker-panel">
|
||||
<view class="time-picker-summary">
|
||||
<text class="time-picker-label">开始时间</text>
|
||||
<text class="time-picker-value">{{timePickerValue || '--:--'}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="time-picker-head">
|
||||
<text>时</text>
|
||||
<text>分</text>
|
||||
</view>
|
||||
<picker-view class="time-picker-view" value="{{timePickerIndices}}" bindchange="onTimePickerChange" indicator-class="time-picker-indicator" mask-class="time-picker-mask">
|
||||
<picker-view-column>
|
||||
<view wx:for="{{timePickerHours}}" wx:key="*this" class="time-picker-item">{{item}}</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view wx:for="{{timePickerMinutes}}" wx:key="*this" class="time-picker-item">{{item}}</view>
|
||||
</picker-view-column>
|
||||
</picker-view>
|
||||
<view class="time-picker-actions">
|
||||
<button class="time-confirm-btn" loading="{{timePickerConfirming}}" disabled="{{timePickerConfirming || !timePickerValue || pageMaskVisible}}" bindtap="confirmTimeSelection">确认时间</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="fixed-bottom">
|
||||
<view wx:if="{{canCreateAppointment}}" class="action-row">
|
||||
<button class="secondary-btn draft-btn" bindtap="saveDraft">保存草稿</button>
|
||||
<button class="primary-btn submit-btn" loading="{{loading}}" bindtap="submit">提交预约</button>
|
||||
<button class="secondary-btn draft-btn" disabled="{{pageMaskVisible || loading}}" bindtap="saveDraft">保存草稿</button>
|
||||
<button class="primary-btn submit-btn" loading="{{loading}}" disabled="{{pageMaskVisible || loading}}" bindtap="submit">提交预约</button>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{pageMaskVisible}}" class="page-loading-mask" catchtap="stopTap">
|
||||
<view class="page-loading-card" catchtap="stopTap">
|
||||
<view class="page-loading-spinner"></view>
|
||||
<text>{{pageMaskText || '正在处理'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -1,3 +1,51 @@
|
||||
.appointment-page {
|
||||
animation: appointment-page-enter 0.22s ease-out both;
|
||||
}
|
||||
|
||||
@keyframes appointment-page-enter {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(12rpx);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes appointment-mask-enter {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes appointment-sheet-enter {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(36rpx);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes appointment-spinner-rotate {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.form-card {
|
||||
padding: 8rpx 0;
|
||||
overflow: visible;
|
||||
@@ -392,6 +440,7 @@
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
background: rgba(18, 15, 12, 0.48);
|
||||
animation: appointment-mask-enter 0.18s ease-out both;
|
||||
}
|
||||
|
||||
.product-modal {
|
||||
@@ -433,6 +482,13 @@
|
||||
box-shadow: 0 -18rpx 40rpx rgba(41, 31, 23, 0.16);
|
||||
}
|
||||
|
||||
.product-modal,
|
||||
.template-modal,
|
||||
.artist-modal,
|
||||
.time-modal {
|
||||
animation: appointment-sheet-enter 0.22s ease-out both;
|
||||
}
|
||||
|
||||
.modal-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -781,72 +837,106 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.time-list {
|
||||
max-height: 620rpx;
|
||||
padding-right: 2rpx;
|
||||
.time-picker-panel {
|
||||
padding-top: 4rpx;
|
||||
}
|
||||
|
||||
.time-group {
|
||||
margin-bottom: 28rpx;
|
||||
.time-picker-summary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 18rpx;
|
||||
padding: 18rpx 22rpx;
|
||||
border: 1rpx solid #eadfd2;
|
||||
border-radius: 18rpx;
|
||||
background: #fffdf8;
|
||||
}
|
||||
|
||||
.time-group:last-child {
|
||||
margin-bottom: 0;
|
||||
.time-picker-label {
|
||||
display: block;
|
||||
color: #8c8177;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.time-group-title {
|
||||
.time-picker-value {
|
||||
display: block;
|
||||
margin-bottom: 14rpx;
|
||||
color: #4d453e;
|
||||
font-size: 26rpx;
|
||||
min-width: 160rpx;
|
||||
color: #2f2923;
|
||||
font-size: 42rpx;
|
||||
font-weight: 900;
|
||||
line-height: 1.1;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.time-grid {
|
||||
.time-picker-head {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 14rpx;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
margin: 20rpx 0 10rpx;
|
||||
color: #8c8177;
|
||||
font-size: 22rpx;
|
||||
font-weight: 800;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.time-picker-view {
|
||||
width: 100%;
|
||||
height: 370rpx;
|
||||
overflow: hidden;
|
||||
border: 1rpx solid #eadfd2;
|
||||
border-radius: 18rpx;
|
||||
background: #fffaf4;
|
||||
}
|
||||
|
||||
.time-chip {
|
||||
.time-picker-item {
|
||||
display: flex;
|
||||
min-height: 88rpx;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4rpx;
|
||||
border: 2rpx solid #eadfd2;
|
||||
height: 92rpx;
|
||||
color: #312a24;
|
||||
font-size: 34rpx;
|
||||
font-weight: 900;
|
||||
line-height: 92rpx;
|
||||
}
|
||||
|
||||
.time-picker-indicator {
|
||||
height: 92rpx;
|
||||
border-top: 1rpx solid #e1d4c5;
|
||||
border-bottom: 1rpx solid #e1d4c5;
|
||||
background: rgba(255, 242, 223, 0.82);
|
||||
}
|
||||
|
||||
.time-picker-mask {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.time-picker-actions {
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
|
||||
.time-confirm-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border-radius: 18rpx;
|
||||
background: #fff;
|
||||
color: #302923;
|
||||
box-shadow: 0 8rpx 18rpx rgba(92, 66, 43, 0.06);
|
||||
transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
|
||||
}
|
||||
|
||||
.time-chip:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.time-chip.active {
|
||||
border-color: #c9874d;
|
||||
background: #fff2df;
|
||||
color: #9f5f2d;
|
||||
}
|
||||
|
||||
.time-chip text:first-child {
|
||||
background: #6f8f83;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
line-height: 1.2;
|
||||
line-height: 88rpx;
|
||||
}
|
||||
|
||||
.time-chip text:last-child {
|
||||
color: #8c8177;
|
||||
font-size: 20rpx;
|
||||
line-height: 1.2;
|
||||
.time-confirm-btn::after {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.time-chip.active text:last-child {
|
||||
color: #a26428;
|
||||
.time-confirm-btn[disabled] {
|
||||
background: #d7d0c8;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.time-empty {
|
||||
@@ -919,6 +1009,7 @@
|
||||
justify-content: center;
|
||||
padding: 38rpx 28rpx;
|
||||
background: rgba(18, 15, 12, 0.48);
|
||||
animation: appointment-mask-enter 0.18s ease-out both;
|
||||
}
|
||||
|
||||
.manual-sheet {
|
||||
@@ -929,6 +1020,7 @@
|
||||
border-radius: 28rpx;
|
||||
background: #f7efe7;
|
||||
box-shadow: 0 24rpx 54rpx rgba(41, 31, 23, 0.22);
|
||||
animation: appointment-sheet-enter 0.22s ease-out both;
|
||||
}
|
||||
|
||||
.manual-sheet-head {
|
||||
@@ -1227,3 +1319,43 @@
|
||||
min-width: 0;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.page-loading-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 140;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40rpx;
|
||||
background: rgba(36, 30, 24, 0.34);
|
||||
animation: appointment-mask-enter 0.16s ease-out both;
|
||||
}
|
||||
|
||||
.page-loading-card {
|
||||
display: flex;
|
||||
min-width: 248rpx;
|
||||
min-height: 168rpx;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 22rpx;
|
||||
padding: 32rpx 36rpx;
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.78);
|
||||
border-radius: 20rpx;
|
||||
background: rgba(255, 253, 248, 0.96);
|
||||
color: #3d352f;
|
||||
font-size: 26rpx;
|
||||
font-weight: 900;
|
||||
box-shadow: 0 24rpx 54rpx rgba(41, 31, 23, 0.2);
|
||||
animation: appointment-sheet-enter 0.2s ease-out both;
|
||||
}
|
||||
|
||||
.page-loading-spinner {
|
||||
width: 54rpx;
|
||||
height: 54rpx;
|
||||
border: 6rpx solid #dfe8e2;
|
||||
border-top-color: #6f8f83;
|
||||
border-radius: 50%;
|
||||
animation: appointment-spinner-rotate 0.78s linear infinite;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user