优化店务小程序月视图展示

This commit is contained in:
2026-07-23 12:26:25 +08:00
parent b14a97578e
commit e443db55bb
6 changed files with 35 additions and 66 deletions
+6 -16
View File
@@ -233,13 +233,12 @@ Page({
{ value: 'week', label: '周' },
{ value: 'day', label: '日' }
],
monthDisplayMode: 'count',
monthDisplayMode: 'rows',
monthDisplayModes: [
{ value: 'count', label: '单量' },
{ value: 'blocks', label: '点阵' },
{ value: 'blocks', label: '点状' },
{ value: 'rows', label: '横条' }
],
monthRowLabelVisible: false,
monthRowLabelVisible: true,
weekLabels: ['一', '二', '三', '四', '五', '六', '日'],
currentDate: new Date(),
currentDateText: dateUtil.formatDate(new Date()),
@@ -716,6 +715,7 @@ Page({
return (appointments || []).map((item, index) => {
const artist = artistMap[String(item.artistId)] || {}
const artistName = item.artistName || artist.name || ''
const customerName = item.customerName || item.customerUserName || item.customerPhone || ''
const orderItemId = resolveAppointmentItemId(item)
return {
key: `${mode}-${orderItemId || item.artistId || 'appointment'}-${index}`,
@@ -725,6 +725,7 @@ Page({
color: item.color || artist.color || '#B8B0A6',
shortName: artist.shortName || String(artistName || '?').slice(0, 1),
artistName: artistName || '?',
customerName: customerName || '客户',
statusClass: completedOrCancelledClass(item.status)
}
})
@@ -813,6 +814,7 @@ Page({
color: count.color,
shortName: count.shortName,
artistName: count.artistName || count.shortName,
customerName: count.customerName || '客户',
statusClass: count.statusClass
})
}
@@ -891,18 +893,6 @@ Page({
},
openAppointment(event) {
const currentDataset = event && event.currentTarget && event.currentTarget.dataset ? event.currentTarget.dataset : {}
const count = Number(currentDataset.count || 1)
if (this.data.viewMode === 'month' && this.data.monthDisplayMode === 'count' && count > 1) {
const date = normalizeReturnTargetDate(currentDataset.date)
this.setData({
currentDate: toLocalDate(date),
currentDateText: date,
monthDisplayMode: 'blocks'
})
wx.showToast({ title: '请点击具体预约块查看详情', icon: 'none' })
return
}
const id = resolveAppointmentEventId(event)
if (!id) {
wx.showToast({ title: '缺少预约详情ID', icon: 'none' })
+2 -8
View File
@@ -128,20 +128,14 @@
<text wx:if="{{!item.isPast && item.shopRest}}" class="day-mark rest">休</text>
<text wx:elif="{{!item.isPast && item.dayStatus === 'full'}}" class="day-mark full">满</text>
</view>
<view wx:if="{{monthDisplayMode === 'count'}}" class="month-bars">
<view wx:for="{{item.artistCounts}}" wx:for-item="count" wx:key="key" wx:if="{{count.count > 0}}" class="month-artist-bar {{count.statusClass}}" style="background: {{count.color}};" data-id="{{count.orderItemId || count.id}}" data-order-item-id="{{count.orderItemId || count.id}}" data-count="{{count.count}}" data-date="{{item.date}}" catchtap="openAppointment">
<text data-id="{{count.orderItemId || count.id}}" data-order-item-id="{{count.orderItemId || count.id}}">{{count.shortName}}{{count.count}}</text>
</view>
<view wx:if="{{item.totalCount === 0}}" class="month-empty">空</view>
</view>
<view wx:else class="month-blocks">
<view class="month-blocks">
<block wx:if="{{monthDisplayMode === 'blocks'}}">
<view wx:for="{{item.expandedBlocks}}" wx:for-item="block" wx:key="key" class="month-order-block {{block.statusClass}}" style="background: {{block.color}};" data-id="{{block.orderItemId || block.id}}" data-order-item-id="{{block.orderItemId || block.id}}" catchtap="openAppointment"></view>
<view wx:if="{{item.totalCount === 0}}" class="month-empty">空</view>
</block>
<block wx:else>
<view wx:for="{{item.rowBlocks}}" wx:for-item="block" wx:key="key" class="month-row-block {{monthRowLabelVisible ? 'named' : ''}} {{block.statusClass}}" style="background: {{block.color}};" data-id="{{block.orderItemId || block.id}}" data-order-item-id="{{block.orderItemId || block.id}}" catchtap="openAppointment">
<text wx:if="{{monthRowLabelVisible}}" data-id="{{block.orderItemId || block.id}}" data-order-item-id="{{block.orderItemId || block.id}}">{{block.artistName}}</text>
<text wx:if="{{monthRowLabelVisible}}" data-id="{{block.orderItemId || block.id}}" data-order-item-id="{{block.orderItemId || block.id}}">{{block.customerName}}</text>
</view>
<view wx:if="{{item.totalCount === 0}}" class="month-empty">空</view>
</block>
+2 -31
View File
@@ -532,8 +532,6 @@
.week-bar.is-cancelled::after,
.week-count-bar.is-completed::after,
.week-count-bar.is-cancelled::after,
.month-artist-bar.is-completed::after,
.month-artist-bar.is-cancelled::after,
.month-order-block.is-completed::after,
.month-order-block.is-cancelled::after,
.month-row-block.is-completed::after,
@@ -554,8 +552,6 @@
.week-bar.is-cancelled::before,
.week-count-bar.is-completed::before,
.week-count-bar.is-cancelled::before,
.month-artist-bar.is-completed::before,
.month-artist-bar.is-cancelled::before,
.month-order-block.is-completed::before,
.month-order-block.is-cancelled::before,
.month-row-block.is-completed::before,
@@ -574,7 +570,6 @@
.week-bar.is-completed::before,
.week-count-bar.is-completed::before,
.month-artist-bar.is-completed::before,
.month-order-block.is-completed::before,
.month-row-block.is-completed::before {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none' viewBox='0 0 100 100'%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='%2345825b' stroke-opacity='.9' stroke-width='2' stroke-linecap='square' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
@@ -582,7 +577,6 @@
.week-bar.is-cancelled::before,
.week-count-bar.is-cancelled::before,
.month-artist-bar.is-cancelled::before,
.month-order-block.is-cancelled::before,
.month-row-block.is-cancelled::before {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none' viewBox='0 0 100 100'%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='%23c64e5b' stroke-opacity='.92' stroke-width='2' stroke-linecap='square' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
@@ -764,30 +758,6 @@
color: #8aaeca;
}
.month-bars {
display: flex;
flex-direction: column;
gap: 5rpx;
margin-top: 7rpx;
}
.month-artist-bar {
position: relative;
display: flex;
align-items: center;
justify-content: center;
height: 24rpx;
min-width: 0;
overflow: hidden;
border-radius: 6rpx;
color: #fff;
font-size: 17rpx;
font-weight: 800;
line-height: 1;
white-space: nowrap;
transition: transform 160ms ease;
}
.month-blocks {
display: flex;
flex-wrap: wrap;
@@ -823,7 +793,8 @@
}
.month-row-block.named {
height: 20rpx;
height: 28rpx;
font-size: 16rpx;
}
.month-blocks .month-empty {
+8
View File
@@ -330,3 +330,11 @@
- 处理方式:确认当前维护机到 `mysql02` 的源地址为 `192.168.5.163`,在 `mysql02` 的 INPUT 链追加 `192.168.5.163/32` 到 3306 allow 白名单,并把规则放在 3306 deny 规则之前;规则已写入持久化配置。
- 影响范围:仅影响 `mysql02` 的 MySQL 3306 访问控制,允许当前维护机做后续只读验证或经确认后的生产数据库维护;不修改 MySQL 数据、Nacos 配置、应用服务或 SQL 文件。
- 验证方式:本机到 `192.168.5.110:3306` 的 TCP 连接由失败变为成功;服务器侧确认 allow 规则位于 deny 规则之前且已持久化;使用私有凭据做 MySQL TCP 只读校验,返回 `hostname=centos7`、`port=3306`、`read_only=0`、`super_read_only=0`、`version=8.0.45`。
## 2026-07-23 店务小程序月视图展示优化与时间选择器预览
- 变更原因:店务端小程序新建预约时间选择后续需要改为上下滑动选择器;规划月视图需要去掉单量视图,只保留点状和横条,并默认使用横条+姓名展示。
- 处理方式:本次仅为时间选择器生成静态预览图,未修改预约时间选择代码;规划月视图默认模式改为横条,显示模式只保留点状和横条,横条姓名改为展示订单顾客姓名,并提高命名横条高度。
- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。
- 影响范围:影响 `JY-Salon-WeChat/pages/planning/` 月视图展示与预约详情点击入口;不影响后端、接口契约、预约创建提交和 SQL。
- 验证方式:执行店务小程序规划页 JS 语法检查、规划页三件套 `git diff --check`、单量入口检索和 GitNexus staged `detect_changes`。
+8
View File
@@ -419,3 +419,11 @@
原因:前端用真值判断而不是按字段是否存在判断,导致“显式清空”和“老接口兼容”混在一起。
预防方式:详情回显必须按当前 VO 契约读取;只有当前字段不存在时才兼容旧字段,不能让空串或空数组再回退到历史图片。
验证方式:删除最后一张图片后重新进入详情页仍应为空图;后端定向测试覆盖新建手工预约不传图片时返回空图片且不查询对象存储。
## 2026-07-23 PowerShell 生成 .NET 绘图预览要用 ArgumentList
问题:没有可用浏览器自动化工具时,用 PowerShell 调用 `System.Drawing` 生成小程序静态预览图,`New-Object System.Drawing.Font 'Microsoft YaHei', $size, $style, [System.Drawing.GraphicsUnit]::Pixel` 把枚举参数当字符串传入,导致字体构造失败,生成图片缺失文字。
原因:Windows PowerShell 的 `New-Object` 多参数构造函数解析容易把后续参数转成字符串或拆错类型,尤其是枚举、single 数值和中文字体名混用时。
处理方式:改用 `New-Object System.Drawing.Font -ArgumentList @('Microsoft YaHei', [single]$size, $style, [System.Drawing.GraphicsUnit]::Pixel)`,矩形、画笔等多参数构造也统一使用 `-ArgumentList`。
以后避免:用 PowerShell 调 .NET 构造函数生成截图、预览或图片资产时,不用裸位置参数;先检查命令 stderr,图片生成成功也要确认文字层实际绘制。
验证方式:重新生成 PNG 后文件大小增加且预览中能看到中文标题、字段和值。
+9 -11
View File
@@ -2,29 +2,27 @@
## 当前任务
生产 MySQL `mysql02` 维护机 3306 白名单追加与连接重试。
店务小程序月视图展示优化与新建预约时间选择器预览。
## 已完成
- 已读取项目规则、生产发布技能、轻量记忆和错误记忆相关条目。
- 已确认生产写库 `mysql02 / 192.168.5.110:3306` 的 3306 访问由服务器侧白名单控制,当前维护机需要单独放行。
- 已确认当前维护机访问 `mysql02` 时的源地址为 `192.168.5.163`。
- 已在 `mysql02` INPUT 链把 `192.168.5.163/32` 的 3306 allow 规则放在 3306 deny 规则之前,并写入持久化配置。
- 已从当前维护机验证 `192.168.5.110:3306` TCP 连接成功。
- 已通过私有凭据做 MySQL TCP 只读校验,确认目标为 `hostname=centos7`、`port=3306`、`version=8.0.45`。
- 已更新 `docs/生产环境服务器信息总表.md`、`docs/交接与当前状态.md`、`docs/运维配置与集成说明.md`、`docs/项目变更记录.md`、`memory/bugs.md` 和全局错误记忆。
- 已读取项目规则、轻量记忆、文档索引、版本基线规则和错误记忆相关条目。
- 已定位 `JY-Salon-WeChat/pages/appointment-form` 当前仍使用可约时间列表,本次只生成上下滑动时间选择器预览图,未改预约时间选择代码。
- 已定位 `JY-Salon-WeChat/pages/planning` 月视图渲染链路,并完成 GitNexus impact:`buildAppointmentBlocks`、`buildRowBlocks`、`openAppointment`、`switchMonthDisplay`、`toggleMonthRowLabel` 均为 LOW 风险。
- 已将规划月视图默认改为横条+姓名,显示模式只保留点状和横条;横条姓名改为顾客姓名,并提高命名横条高度。
- 已补充 `docs/项目变更记录.md`。
## 下一步
无,等待下一次生产操作或发布任务。
- 等待用户确认时间选择器预览图后,再实现新建预约的上下滑动时间选择器。
## 当前阻塞点
- 无。
- 时间选择器实现等待用户确认预览图样式后再做。
## 最近一次重要操作结果
2026-07-23 生产 MySQL `mysql02` 已放行当前维护机源地址 `192.168.5.163/32` 访问 3306;本机 `Test-NetConnection 192.168.5.110 -Port 3306` 返回 `TcpTestSucceeded=True`;`git diff --check --cached` 通过;GitNexus staged `detect-changes` 返回 low risk、0 affected processes。
2026-07-23 店务小程序规划页 JS 语法检查通过;规划页三件套 `git diff --check` 通过;检索确认规划页已无“单量”入口、`monthDisplayMode === 'count'` 和单量条样式;GitNexus staged `detect_changes` 为 low risk、0 affected processes;已提交本次月视图改动。
## 2026-07-23 预约图片链路检查
- 已完成:梳理新建预约手工作品上传、预约详情上传/删除、后端 `PlanningServiceImpl` 回显链路,并修复详情页旧字段回退隐患。
- 下一步:无,等待用户验收预约图片链路。