From ffc6c7afcad41e034c81c4bf57dcc55251bcd145 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Thu, 23 Jul 2026 17:49:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=BA=97=E5=8A=A1=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=8E=9F=E7=94=9F=E6=97=B6=E9=97=B4=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/appointment-form/index.js | 95 +---------- .../pages/appointment-form/index.wxml | 53 +----- .../pages/appointment-form/index.wxss | 154 +----------------- docs/项目变更记录.md | 10 +- memory/bugs.md | 14 +- memory/progress.md | 18 +- 6 files changed, 53 insertions(+), 291 deletions(-) diff --git a/JY-Salon-WeChat/pages/appointment-form/index.js b/JY-Salon-WeChat/pages/appointment-form/index.js index d4eb4b2f..8113d25a 100644 --- a/JY-Salon-WeChat/pages/appointment-form/index.js +++ b/JY-Salon-WeChat/pages/appointment-form/index.js @@ -457,43 +457,11 @@ function canUseTimeMinute(form, minute) { return minute > getCurrentMinuteOfDay() } -function splitTimeValue(value) { - const parts = String(value || '').split(':') - return { - hour: parts[0] || '', - minute: parts[1] || '' - } -} - -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 + return normalizeTimeText(form.appointmentTime) } - if (!isToday(form.appointmentDate)) { - return '00:00' - } - return dateUtil.timeFromMinutes(Math.min(DAY_MINUTES - 1, getCurrentMinuteOfDay() + 1)) + return '00:00' } function resolveTimeConfirmTip(form) { @@ -795,11 +763,7 @@ Page({ canCreateAppointment: true, draftSavedAtText: '', manualImageUploading: false, - timeSheetVisible: false, timeSelectTip: '请选择预约时间', - timePickerHours: [], - timePickerMinutes: [], - timePickerIndices: [0, 0], timePickerValue: '', timePickerConfirming: false, pageMaskVisible: false, @@ -1341,76 +1305,31 @@ Page({ void this.checkAvailability(this.data.form.appointmentTime) }, - canOpenTimeSheet() { - const form = this.data.form - return Boolean(form.appointmentDate) - }, - refreshAvailableTimes() { const form = this.data.form if (!form.appointmentDate) { this.setData({ timeSelectTip: '请选择预约时间', - timePickerHours: [], - timePickerMinutes: [], - timePickerIndices: [0, 0], timePickerValue: '' }) return } - const timePickerState = buildTimePickerState(resolveInitialTimePickerValue(form)) this.setData({ timeSelectTip: '请选择预约时间', - timePickerHours: timePickerState.hourValues, - timePickerMinutes: timePickerState.minuteValues, - timePickerIndices: timePickerState.indices, - timePickerValue: timePickerState.value + timePickerValue: resolveInitialTimePickerValue(form) }) }, - async openTimeSheet() { - if (!this.canOpenTimeSheet()) { - wx.showToast({ title: '请先选择预约日期', icon: 'none' }) - return - } - this.setData({ - timeSheetVisible: true, - timePickerConfirming: false - }) - this.refreshAvailableTimes() - }, - - closeTimeSheet() { - this.setData({ - timeSheetVisible: false, - timePickerConfirming: false - }) - }, - - 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() { + async onNativeTimeChange(event) { if (this.data.timePickerConfirming) { return } - const selectedTime = this.data.timePickerValue + const selectedTime = normalizeTimeText(event.detail.value) if (!selectedTime) { wx.showToast({ title: '请先选择预约时间', icon: 'none' }) return } + this.setData({ timePickerValue: selectedTime }) const confirmTip = resolveTimeConfirmTip(this.data.form) if (confirmTip) { wx.showModal({ @@ -1438,7 +1357,7 @@ Page({ } this.setData({ 'form.appointmentTime': selectedTime, - timeSheetVisible: false + timePickerValue: selectedTime }) } catch (error) { this.hidePageMask() diff --git a/JY-Salon-WeChat/pages/appointment-form/index.wxml b/JY-Salon-WeChat/pages/appointment-form/index.wxml index 0ea97262..ac0b4ed7 100644 --- a/JY-Salon-WeChat/pages/appointment-form/index.wxml +++ b/JY-Salon-WeChat/pages/appointment-form/index.wxml @@ -59,13 +59,15 @@ 预约时间 - - - {{form.appointmentTime || timeSelectTip}} - {{form.appointmentDate}} · {{selectedArtist.name}} · {{form.durationMinutes}}分钟 + + + + {{form.appointmentTime || timeSelectTip}} + {{form.appointmentDate}} · {{selectedArtist.name}} · {{form.durationMinutes}}分钟 + + › - › - + @@ -221,45 +223,6 @@ - - - - - 选择预约时间 - {{form.appointmentDate}} · {{selectedArtist.name}} · {{form.durationMinutes}}分钟 - - × - - - - 开始时间 - {{timePickerValue || '--:--'}} - - - 时 - 分 - - - - - {{item}} - - - {{item}} - - - - - - - - - - - diff --git a/JY-Salon-WeChat/pages/appointment-form/index.wxss b/JY-Salon-WeChat/pages/appointment-form/index.wxss index 69db3cfb..2d40e6cd 100644 --- a/JY-Salon-WeChat/pages/appointment-form/index.wxss +++ b/JY-Salon-WeChat/pages/appointment-form/index.wxss @@ -283,6 +283,11 @@ color: #aaa096; } +.time-native-picker { + min-width: 0; + flex: 1; +} + .time-range { overflow: hidden; color: #9a9288; @@ -488,19 +493,9 @@ box-shadow: 0 -18rpx 40rpx rgba(41, 31, 23, 0.16); } -.time-modal { - width: 100%; - max-height: 82vh; - padding: 28rpx 28rpx calc(28rpx + env(safe-area-inset-bottom)); - border-radius: 28rpx 28rpx 0 0; - background: #fffaf4; - box-shadow: 0 -18rpx 40rpx rgba(41, 31, 23, 0.16); -} - .product-modal, .template-modal, -.artist-modal, -.time-modal { +.artist-modal { animation: appointment-sheet-enter 0.22s ease-out both; } @@ -852,143 +847,6 @@ text-align: center; } -.time-picker-panel { - padding-top: 4rpx; -} - -.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-picker-label { - display: block; - color: #8c8177; - font-size: 22rpx; - line-height: 1.25; -} - -.time-picker-value { - display: block; - min-width: 160rpx; - color: #2f2923; - font-size: 42rpx; - font-weight: 900; - line-height: 1.1; - text-align: right; -} - -.time-picker-head { - display: grid; - 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-picker-stage { - position: relative; -} - -.time-picker-item { - display: flex; - align-items: center; - justify-content: center; - height: 92rpx; - color: #c8beb2; - font-size: 34rpx; - font-weight: 800; - line-height: 92rpx; - transition: color 160ms ease, font-weight 160ms ease; -} - -.time-picker-item.selected { - color: #2f2923; - font-weight: 900; -} - -.time-picker-selected-overlay { - position: absolute; - top: 50%; - left: 0; - right: 0; - display: grid; - height: 92rpx; - grid-template-columns: repeat(2, minmax(0, 1fr)); - align-items: center; - margin-top: -46rpx; - background: #fff2df; - border-top: 1rpx solid #e1d4c5; - border-bottom: 1rpx solid #e1d4c5; - pointer-events: none; - z-index: 2; -} - -.time-picker-selected-overlay text { - color: #2f2923; - font-size: 34rpx; - font-weight: 900; - line-height: 92rpx; - text-align: center; -} - -.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: #6f8f83; - color: #fff; - font-size: 28rpx; - font-weight: 900; - line-height: 88rpx; -} - -.time-confirm-btn::after { - border: 0; -} - -.time-confirm-btn[disabled] { - background: #d7d0c8; - color: #fff; -} - .time-empty { min-height: 220rpx; display: flex; diff --git a/docs/项目变更记录.md b/docs/项目变更记录.md index 60601d3a..74623a67 100644 --- a/docs/项目变更记录.md +++ b/docs/项目变更记录.md @@ -369,4 +369,12 @@ - 处理方式:在 `picker-view` 外层增加与中间行对齐的深色文本叠层,按当前 `timePickerIndices` 渲染小时和分钟;底层滚轮继续负责滚动和交互,未选中项继续保留浅灰。 - 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。 - 影响范围:仅影响 `JY-Salon-WeChat/pages/appointment-form/` 时间选择弹窗的中间选中态视觉;不影响时间候选数据、确认时间校验、预约提交和后端接口。 -- 验证方式:微信开发者工具自动化确认 `.time-picker-selected-overlay` 存在且 `.time-picker-item.selected` 仍有 2 个;截图通道仍可能超时,视觉验证以元素和数据断言为准。 \ No newline at end of file +- 验证方式:微信开发者工具自动化确认 `.time-picker-selected-overlay` 存在且 `.time-picker-item.selected` 仍有 2 个;截图通道仍可能超时,视觉验证以元素和数据断言为准。 + +## 2026-07-23 店务小程序预约时间改为原生时间选择器 + +- 变更原因:自定义 `picker-view` 时间滚轮的选中态颜色在微信原生渲染层下仍可能显示为灰色,用户要求改成和预约日期一样的系统选择器效果。 +- 处理方式:预约时间字段改为原生 `picker mode="time"`,固定 `start="00:00"`、`end="23:59"`,不再构造小时/分钟自定义滚轮和底部弹窗;用户在系统时间选择器点确认后,继续复用 `checkAvailability` 校验过去时间、门店营业时间、员工排班和预约冲突,不可预约时弹窗展示具体原因。 +- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。 +- 影响范围:仅影响 `JY-Salon-WeChat/pages/appointment-form/` 的预约时间选择交互;不影响后端、接口契约、SQL 和预约提交 payload。 +- 验证方式:已执行预约表单 JS 语法检查、旧 `picker-view/time-picker` 引用检索、`git diff --check` 和 GitNexus staged `detect-changes`;微信开发者工具连接与当前路由验证通过,元素查询通道超时且 `mp_healthCheck` 显示 `needsRecovery=false`,运行态元素断言以工具通道缺口记录。 diff --git a/memory/bugs.md b/memory/bugs.md index 69fe58fd..6d9b9b3d 100644 --- a/memory/bugs.md +++ b/memory/bugs.md @@ -462,4 +462,16 @@ 以后避免:修改 `picker-view` 视觉时不要只改条目颜色,先确认中间选中态是否需要独立叠层或遮罩;截图校验优先看最终像素,而不是只看 class 是否挂上。 -验证方式:自动化断言叠层存在且选中项数量正确;若截图通道超时,继续用元素数量和 page.data 兜底。 \ No newline at end of file +验证方式:自动化断言叠层存在且选中项数量正确;若截图通道超时,继续用元素数量和 page.data 兜底。 + +## 2026-07-23 小程序时间选择要优先用原生 picker mode=time + +问题:店务小程序预约时间选择器连续修补自定义 `picker-view` 的选中态颜色后,用户仍觉得效果不像预约日期选择器。 + +原因:用户期望的是系统选择器的交互和视觉,而不是页面内自定义底部滚轮;继续修补 `picker-view` 的 item、indicator 或叠层只能局部缓解,无法稳定复刻系统选择器。 + +处理方式:预约时间字段改为原生 `picker mode="time"`,设置 `start="00:00"`、`end="23:59"`,选择器确认后再执行预约可用性校验并展示不可预约原因。 + +以后避免:当需求明确要求“和日期选择一样”“系统选择器效果”时,优先使用小程序原生 `picker` 对应 mode;只有用户明确要求页面内自定义滚轮时,才使用 `picker-view`。 + +验证方式:源码检索不再存在旧 `timeSheetVisible`、`picker-view`、`time-picker` 自定义滚轮引用;JS 语法检查、运行态元素断言和 `git diff --check` 通过。 diff --git a/memory/progress.md b/memory/progress.md index ce6ad2c2..94b4c16b 100644 --- a/memory/progress.md +++ b/memory/progress.md @@ -2,26 +2,28 @@ ## 当前任务 -店务小程序预约时间滚轮中间态叠层修复。 +店务小程序预约时间改为原生时间选择器。 ## 已完成 -- 已读取项目规则、轻量记忆、文档索引、版本基线规则和错误记忆相关条目。 -- 已按截图反馈将预约时间滚轮未选中项改为浅灰。 -- 已将当前选中的小时和分钟项按 `timePickerIndices` 加上选中类,并额外叠加深色文本层覆盖原生中间态灰色。 +- 已读取项目规则、轻量记忆和错误记忆相关条目。 +- 已按用户最新反馈放弃继续修补自定义 `picker-view` 视觉。 +- 已将预约时间字段改为原生 `picker mode="time"`,范围 `00:00-23:59`,确认后再复用原可约性校验。 +- 已删除旧时间底部弹窗、自定义小时/分钟滚轮模板和相关样式。 +- 已完成 JS 语法检查、旧引用检索、`git diff --check` 和 GitNexus staged 检测,检测结果为低风险、影响流程 0。 - 已补充 `docs/项目变更记录.md`。 ## 下一步 -- 运行最终检查、GitNexus staged 变更检测并提交本次相关改动。 +- 提交本次相关改动。 ## 当前阻塞点 -- 截图通道仍会超时,视觉验证依赖元素和数据断言。 +- 微信开发者工具当前路由断言通过,但元素查询通道超时;`mp_healthCheck` 显示连接正常、`needsRecovery=false`,不建议重连。 ## 最近一次重要操作结果 -2026-07-23 预约时间滚轮叠层方案已验证:微信开发者工具自动化构造 `21:04` 时间弹窗状态后,`.time-picker-selected-overlay` 存在且 `.time-picker-item.selected` 为 2 个;截图通道仍超时,元素断言兜底。 +2026-07-23 已完成源码层和静态验证:旧 `timeSheetVisible`、`picker-view`、`time-picker` 样式和旧确认方法引用检索为空;微信开发者工具可确认路由在 `pages/appointment-form/index`,但元素查询通道超时。 ## 2026-07-23 预约图片链路检查 - 已完成:梳理新建预约手工作品上传、预约详情上传/删除、后端 `PlanningServiceImpl` 回显链路,并修复详情页旧字段回退隐患。 - 下一步:无,等待用户验收预约图片链路。 @@ -34,4 +36,4 @@ - 已在 `picker-view` 外层增加与中间行对齐的深色文本层,底层滚轮继续提供交互,未选中项保留浅灰。 - 已补充 `docs/项目变更记录.md` 和 `memory/bugs.md`。 - 下一步:运行最终检查、GitNexus staged 变更检测并提交。 -- 当前结果:微信开发者工具自动化确认 `.time-picker-selected-overlay` 存在,`.time-picker-item.selected` 为 2 个。 \ No newline at end of file +- 当前结果:微信开发者工具自动化确认 `.time-picker-selected-overlay` 存在,`.time-picker-item.selected` 为 2 个。