改造店务小程序预约时间选择器

This commit is contained in:
2026-07-23 14:50:37 +08:00
parent e443db55bb
commit 7d6929bcf6
6 changed files with 513 additions and 179 deletions
+281 -113
View File
@@ -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>
+175 -43
View File
@@ -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;
}
+8
View File
@@ -338,3 +338,11 @@
- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。
- 影响范围:影响 `JY-Salon-WeChat/pages/planning/` 月视图展示与预约详情点击入口;不影响后端、接口契约、预约创建提交和 SQL。
- 验证方式:执行店务小程序规划页 JS 语法检查、规划页三件套 `git diff --check`、单量入口检索和 GitNexus staged `detect_changes`。
## 2026-07-23 店务小程序预约时间选择器改造
- 变更原因:新建预约时间选择需要从可约时间格子改为上下滑动时间选择器,并按用户修正要求正常展示 24 小时、1 分钟间隔,确认时间时再校验是否可约。
- 处理方式:预约表单时间弹窗改为 `picker-view` 双列时分滚轮,小时为 `00-23`、分钟为 `00-59`;打开选择器不再按排班或占用筛选候选时间;点击“确认时间”和提交预约前再校验日期、员工、时长、过去时间、门店休息日、门店营业时间、员工排班覆盖和预约冲突,不可用时弹窗展示具体原因;初始加载、切换日期、校验时间、提交预约和返回规划页时增加全屏加载遮罩,页面和弹窗增加进入动画,降低卡顿时重复点击风险。
- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。
- 影响范围:影响 `JY-Salon-WeChat/pages/appointment-form/` 新建预约时间选择交互;不影响后端、接口契约、SQL 和月视图已提交改动。
- 验证方式:执行店务小程序预约表单 JS 语法检查、预约表单三件套 `git diff --check`、旧时间格子引用检索;微信开发者工具自动化验证 `picker-view` 可见、旧 `.time-chip` 数量为 0、小时数组 `00-23` 共 24 项、分钟数组 `00-59` 共 60 项、滚轮切到 `[23,59]` 后显示 `23:59`,并验证页面加载遮罩可见且展示当前加载文案。截图通道本次返回 `SCREENSHOT_TIMEOUT` 且健康检查显示无需恢复,已用数据和元素断言兜底。
+12
View File
@@ -427,3 +427,15 @@
处理方式:改用 `New-Object System.Drawing.Font -ArgumentList @('Microsoft YaHei', [single]$size, $style, [System.Drawing.GraphicsUnit]::Pixel)`,矩形、画笔等多参数构造也统一使用 `-ArgumentList`。
以后避免:用 PowerShell 调 .NET 构造函数生成截图、预览或图片资产时,不用裸位置参数;先检查命令 stderr,图片生成成功也要确认文字层实际绘制。
验证方式:重新生成 PNG 后文件大小增加且预览中能看到中文标题、字段和值。
## 2026-07-23 小程序自动化验证前要重进页面刷新 AppService
问题:店务小程序预约表单 JS 已改成 24 小时、1 分钟时间选择器后,直接在当前页面调用方法时,自动化连接一度仍读到旧逻辑:未选员工或未填时长时 `timePickerHours/timePickerMinutes` 为空。
原因:微信开发者工具当前页面的 AppService 有时还在用旧页面实例,源码保存后不一定立刻热更新到自动化会话。
处理方式:完成小程序页面改动后,自动化验证前先用 `redirectTo` 或 `reLaunch` 重进目标页面,再调用页面方法和读取 page.data。
以后避免:不要把当前页面 `page_callMethod` 的结果直接当作新代码是否生效的唯一依据;如果结果像旧逻辑,先重进页面再复测。
验证方式:重进 `pages/appointment-form/index` 后,未选员工和时长时调用 `refreshAvailableTimes` 仍能得到 `timePickerHours.length=24`、`timePickerMinutes.length=60`,并且滚轮切到 `[23,59]` 后 `timePickerValue=23:59`。
+8 -7
View File
@@ -2,27 +2,28 @@
## 当前任务
店务小程序月视图展示优化与新建预约时间选择器预览。
店务小程序新建预约时间选择器改造。
## 已完成
- 已读取项目规则、轻量记忆、文档索引、版本基线规则和错误记忆相关条目。
- 已定位 `JY-Salon-WeChat/pages/appointment-form` 当前仍使用可约时间列表,本次只生成上下滑动时间选择器预览图,未改预约时间选择代码。
- 已定位 `JY-Salon-WeChat/pages/planning` 月视图渲染链路,并完成 GitNexus impact:`buildAppointmentBlocks`、`buildRowBlocks`、`openAppointment`、`switchMonthDisplay`、`toggleMonthRowLabel` 均为 LOW 风险。
- 已将规划月视图默认改为横条+姓名,显示模式只保留点状和横条;横条姓名改为顾客姓名,并提高命名横条高度。
- 已按用户确认后的修正要求,将 `JY-Salon-WeChat/pages/appointment-form` 的预约时间弹窗从可约时间格子改为上下滑动 `picker-view`。
- 时间选择器已改为纯 24 小时、1 分钟间隔:小时 `00-23`,分钟 `00-59`;打开选择器不再按可约时间筛选。
- 点击“确认时间”时再校验日期、员工、时长、过去时间、门店休息日、营业时间、员工排班和预约冲突,不可用时弹窗提示具体原因。
- 已为初始加载、切换日期、时间校验、提交预约和返回规划页增加全屏加载遮罩,并补充页面/弹窗进入动画,避免卡顿时重复点击。
- 已补充 `docs/项目变更记录.md`。
## 下一步
- 等待用户确认时间选择器预览图后,再实现新建预约的上下滑动时间选择器。
- 暂无,等待用户验收店务小程序新建预约时间选择器。
## 当前阻塞点
- 时间选择器实现等待用户确认预览图样式后再做。
- 暂无。
## 最近一次重要操作结果
2026-07-23 店务小程序规划页 JS 语法检查通过;规划页三件套 `git diff --check` 通过;检索确认规划页已无“单量”入口、`monthDisplayMode === 'count'` 和单量条样式;GitNexus staged `detect_changes` 为 low risk、0 affected processes;已提交本次月视图改动。
2026-07-23 店务小程序预约表单 JS 语法检查通过;预约表单三件套 `git diff --check` 通过;微信开发者工具自动化确认 `picker-view` 可见、旧 `.time-chip` 数量为 0、小时 24 项、分钟 60 项,滚轮切到 `[23,59]` 后显示 `23:59`,页面加载遮罩可见且展示当前加载文案;截图通道返回 `SCREENSHOT_TIMEOUT` 且健康检查无需恢复,已用数据和元素断言兜底。
## 2026-07-23 预约图片链路检查
- 已完成:梳理新建预约手工作品上传、预约详情上传/删除、后端 `PlanningServiceImpl` 回显链路,并修复详情页旧字段回退隐患。
- 下一步:无,等待用户验收预约图片链路。