From f7c5b34f8b94b479eec0ca9adcd9be611b22ab93 Mon Sep 17 00:00:00 2001
From: xiaowang <2161656029@qq.com>
Date: Thu, 23 Jul 2026 19:15:55 +0800
Subject: [PATCH] =?UTF-8?q?=E5=BA=97=E5=8A=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F?=
=?UTF-8?q?=E6=94=AF=E6=8C=81=E9=A2=84=E7=BA=A6=E6=A0=87=E7=AD=BE=E8=AE=BE?=
=?UTF-8?q?=E7=BD=AE=E4=B8=8E=E5=B1=95=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
JY-Salon-WeChat/api/tags.js | 23 +++
.../pages/appointment-form/index.js | 186 ++++++++++++++++--
.../pages/appointment-form/index.wxml | 19 +-
.../pages/appointment-form/index.wxss | 69 +++++++
JY-Salon-WeChat/pages/shop-settings/index.js | 182 ++++++++++++++++-
.../pages/shop-settings/index.wxml | 25 +++
.../pages/shop-settings/index.wxss | 88 +++++++++
docs/项目变更记录.md | 8 +
memory/bugs.md | 12 ++
memory/progress.md | 6 +
10 files changed, 590 insertions(+), 28 deletions(-)
diff --git a/JY-Salon-WeChat/api/tags.js b/JY-Salon-WeChat/api/tags.js
index 34d78fe7..86cf8a2d 100644
--- a/JY-Salon-WeChat/api/tags.js
+++ b/JY-Salon-WeChat/api/tags.js
@@ -5,5 +5,28 @@ module.exports = {
return request({
url: '/tag/list/all'
})
+ },
+
+ create(data) {
+ return request({
+ url: '/tag/create',
+ method: 'POST',
+ data
+ })
+ },
+
+ update(id, data) {
+ return request({
+ url: `/tag/update/${id}`,
+ method: 'PUT',
+ data
+ })
+ },
+
+ delete(id) {
+ return request({
+ url: `/tag/delete/${id}`,
+ method: 'DELETE'
+ })
}
}
diff --git a/JY-Salon-WeChat/pages/appointment-form/index.js b/JY-Salon-WeChat/pages/appointment-form/index.js
index 8113d25a..ef6614c4 100644
--- a/JY-Salon-WeChat/pages/appointment-form/index.js
+++ b/JY-Salon-WeChat/pages/appointment-form/index.js
@@ -21,6 +21,14 @@ const ARTIST_PRESET_LABELS = {
LATE_SHIFT: '晚班',
CUSTOM: '自定义'
}
+const DEFAULT_TAG_STYLE = {
+ textColor: '#333333',
+ bgColor: '#FFFFFF',
+ borderColor: '#E5E5E5',
+ sortOrder: 100,
+ frontVisible: 1
+}
+const TAG_SPLIT_PATTERN = /[;,,、]/
function buildClientRequestId(prefix) {
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`
@@ -555,6 +563,7 @@ function normalizeProduct(product, artists) {
return {
...product,
coverImage: imageUrls[0] || '',
+ allTags: parseProductTags(product),
tagList: parseProductTags(product).slice(0, 4),
artistText: artistNames.length > 0 ? artistNames.join('、') : '全部美甲师',
priceText: productPriceText,
@@ -569,7 +578,12 @@ function normalizeTagOption(tag) {
}
return {
id: (tag && tag.id) || name,
- name
+ name,
+ tagName: (tag && tag.tagName) || name,
+ displayName: (tag && tag.displayName) || name,
+ textColor: (tag && tag.textColor) || DEFAULT_TAG_STYLE.textColor,
+ bgColor: (tag && tag.bgColor) || DEFAULT_TAG_STYLE.bgColor,
+ borderColor: (tag && tag.borderColor) || DEFAULT_TAG_STYLE.borderColor
}
}
@@ -588,8 +602,52 @@ function normalizeTagOptions(tags) {
})
}
+function splitTagValues(value) {
+ return String(value || '')
+ .split(TAG_SPLIT_PATTERN)
+ .map(item => item.trim())
+ .filter(Boolean)
+}
+
+function encodeTagValues(tags) {
+ const names = new Set()
+ return (Array.isArray(tags) ? tags : [])
+ .map(item => String(item || '').trim())
+ .filter(Boolean)
+ .filter(item => {
+ if (names.has(item)) {
+ return false
+ }
+ names.add(item)
+ return true
+ })
+ .join(';')
+}
+
+function buildSelectableTagOptions(tagOptions, value) {
+ const selected = new Set(splitTagValues(value))
+ return (Array.isArray(tagOptions) ? tagOptions : [])
+ .map(normalizeTagOption)
+ .filter(Boolean)
+ .map(item => ({
+ ...item,
+ selected: selected.has(item.name)
+ }))
+}
+
+function findTagOptionByName(tagOptions, value) {
+ const tagName = String(value || '').trim()
+ if (!tagName) {
+ return null
+ }
+ return (Array.isArray(tagOptions) ? tagOptions : [])
+ .map(normalizeTagOption)
+ .filter(Boolean)
+ .find(item => item.name === tagName) || null
+}
+
function resolveTagPickerIndex(tagOptions, value) {
- const firstTag = String(value || '').split(/[;,,、]/)[0].trim()
+ const firstTag = splitTagValues(value)[0] || ''
if (!firstTag) {
return 0
}
@@ -598,20 +656,41 @@ function resolveTagPickerIndex(tagOptions, value) {
}
function resolveTagValue(tagOptions, value) {
- const tokens = String(value || '')
- .split(/[;,,、]/)
- .map(item => item.trim())
- .filter(Boolean)
- if (tokens.length === 0) {
- return ''
+ return encodeTagValues(splitTagValues(value))
+}
+
+function toggleTagValue(value, tagName) {
+ const current = splitTagValues(value)
+ if (current.includes(tagName)) {
+ return encodeTagValues(current.filter(item => item !== tagName))
}
- if (!Array.isArray(tagOptions) || tagOptions.length === 0) {
- return ''
+ return encodeTagValues(current.concat(tagName))
+}
+
+function appendTagValue(value, tagName) {
+ return encodeTagValues(splitTagValues(value).concat(tagName))
+}
+
+function resolveCurrentShopId() {
+ const app = getApp()
+ const userInfo = (app && app.globalData && app.globalData.userInfo) || {}
+ return userInfo.shopId || (app && app.globalData && app.globalData.shopId) || ''
+}
+
+function buildTagCreatePayload(tagName) {
+ const shopId = resolveCurrentShopId()
+ const payload = {
+ tagName,
+ textColor: DEFAULT_TAG_STYLE.textColor,
+ bgColor: DEFAULT_TAG_STYLE.bgColor,
+ borderColor: DEFAULT_TAG_STYLE.borderColor,
+ sortOrder: DEFAULT_TAG_STYLE.sortOrder,
+ frontVisible: DEFAULT_TAG_STYLE.frontVisible
}
- const matched = tokens
- .map(token => tagOptions.find(item => item.name === token))
- .find(Boolean)
- return matched ? matched.name : ''
+ if (shopId) {
+ payload.shopId = shopId
+ }
+ return payload
}
function splitManualImageValues(value) {
@@ -758,6 +837,8 @@ Page({
tagsLoading: false,
tagPickerIndex: 0,
tagError: '',
+ tagCreating: false,
+ manualTagInput: '',
conflictTip: '',
conflictLevel: 'free',
canCreateAppointment: true,
@@ -871,7 +952,7 @@ Page({
const tagOptions = normalizeTagOptions(tagsData.list || tagsData || [])
const selectedTag = resolveTagValue(tagOptions, this.data.form.manualProductTags)
this.setData({
- tagOptions,
+ tagOptions: buildSelectableTagOptions(tagOptions, selectedTag),
tagsLoaded: true,
tagPickerIndex: resolveTagPickerIndex(tagOptions, selectedTag),
'form.manualProductTags': selectedTag,
@@ -1105,6 +1186,8 @@ Page({
manualProductPanelVisible: true,
productModalVisible: false,
manualProductImageUrls: imageUrls,
+ manualTagInput: '',
+ tagOptions: buildSelectableTagOptions(this.data.tagOptions, this.data.form.manualProductTags),
tagPickerIndex: resolveTagPickerIndex(this.data.tagOptions, this.data.form.manualProductTags)
}
if (!productTitle) {
@@ -1137,7 +1220,7 @@ Page({
const selectedProduct = this.data.filteredProducts.find(item => String(item.id) === String(event.currentTarget.dataset.id)) || {}
const price = formatProductPrice(selectedProduct.price)
const priceUndetermined = price === '' || price === '0'
- const productTag = resolveTagValue(this.data.tagOptions, parseProductTags(selectedProduct).join(','))
+ const productTag = resolveTagValue(this.data.tagOptions, (selectedProduct.allTags || parseProductTags(selectedProduct)).join(','))
const imageUrls = Array.isArray(selectedProduct.imageUrls) ? selectedProduct.imageUrls : []
this.setData({
selectedProduct,
@@ -1152,6 +1235,7 @@ Page({
'form.manualProductImageUrl': imageUrls.join(','),
manualProductImageUrls: imageUrls,
productModalVisible: false,
+ tagOptions: buildSelectableTagOptions(this.data.tagOptions, productTag),
tagPickerIndex: resolveTagPickerIndex(this.data.tagOptions, productTag),
'form.durationMinutes': String(parseInt(selectedProduct.approximateDuration, 10) || this.data.form.durationMinutes || '')
})
@@ -1159,14 +1243,80 @@ Page({
this.checkAvailability()
},
+ toggleManualTag(event) {
+ const tagName = String(event.currentTarget.dataset.name || '').trim()
+ if (!tagName) {
+ return
+ }
+ const nextValue = toggleTagValue(this.data.form.manualProductTags, tagName)
+ this.setData({
+ 'form.manualProductTags': nextValue,
+ tagOptions: buildSelectableTagOptions(this.data.tagOptions, nextValue),
+ tagPickerIndex: resolveTagPickerIndex(this.data.tagOptions, nextValue)
+ })
+ },
+
+ onManualTagInput(event) {
+ this.setData({ manualTagInput: event.detail.value })
+ },
+
+ async createManualTag() {
+ if (this.data.tagCreating || this.data.tagsLoading) {
+ return
+ }
+ const tagName = String(this.data.manualTagInput || '').trim()
+ if (!tagName) {
+ wx.showToast({ title: '请输入标签名称', icon: 'none' })
+ return
+ }
+ const existingTag = findTagOptionByName(this.data.tagOptions, tagName)
+ if (existingTag) {
+ const nextValue = appendTagValue(this.data.form.manualProductTags, existingTag.name)
+ this.setData({
+ manualTagInput: '',
+ 'form.manualProductTags': nextValue,
+ tagOptions: buildSelectableTagOptions(this.data.tagOptions, nextValue),
+ tagPickerIndex: resolveTagPickerIndex(this.data.tagOptions, nextValue),
+ tagError: ''
+ })
+ return
+ }
+ this.setData({ tagCreating: true })
+ try {
+ const createdId = await tagsApi.create(buildTagCreatePayload(tagName))
+ const nextOptions = normalizeTagOptions(this.data.tagOptions.concat({
+ id: createdId || tagName,
+ tagName,
+ displayName: tagName
+ }))
+ const nextValue = appendTagValue(this.data.form.manualProductTags, tagName)
+ this.setData({
+ manualTagInput: '',
+ tagOptions: buildSelectableTagOptions(nextOptions, nextValue),
+ tagPickerIndex: resolveTagPickerIndex(nextOptions, nextValue),
+ 'form.manualProductTags': nextValue,
+ tagsLoaded: true,
+ tagError: ''
+ })
+ wx.showToast({ title: '标签已新增', icon: 'success' })
+ } catch (error) {
+ this.setData({ tagError: error.message || '标签新增失败' })
+ wx.showToast({ title: error.message || '标签新增失败', icon: 'none' })
+ } finally {
+ this.setData({ tagCreating: false })
+ }
+ },
+
onManualTagChange(event) {
const tag = this.data.tagOptions[Number(event.detail.value)]
if (!tag) {
return
}
+ const nextValue = toggleTagValue(this.data.form.manualProductTags, tag.name)
this.setData({
tagPickerIndex: Number(event.detail.value),
- 'form.manualProductTags': tag.name
+ 'form.manualProductTags': nextValue,
+ tagOptions: buildSelectableTagOptions(this.data.tagOptions, nextValue)
})
},
@@ -1483,7 +1633,7 @@ Page({
payload.manualProductTitle = String(form.manualProductTitle || '').trim()
payload.manualProductPrice = appointmentPrice
payload.manualProductDescription = String(form.manualProductDescription || '').trim() || undefined
- payload.manualProductTags = String(form.manualProductTags || '').trim() || undefined
+ payload.manualProductTags = resolveTagValue(this.data.tagOptions, form.manualProductTags) || undefined
payload.manualProductPrecautions = String(form.manualProductPrecautions || '').trim() || undefined
payload.manualProductImageFileIds = String(form.manualProductImageFileIds || '').trim() || undefined
}
diff --git a/JY-Salon-WeChat/pages/appointment-form/index.wxml b/JY-Salon-WeChat/pages/appointment-form/index.wxml
index ce8e3cb5..f3ac2701 100644
--- a/JY-Salon-WeChat/pages/appointment-form/index.wxml
+++ b/JY-Salon-WeChat/pages/appointment-form/index.wxml
@@ -142,13 +142,18 @@
- 标签
-
-
- {{form.manualProductTags || (tagOptions.length ? '请选择标签' : '暂无标签')}}
- ›
-
-
+
+ 标签
+ 加载中
+
+
+ {{item.name}}
+
+ 暂无标签,可手动新增
+
+
+
+
{{tagError}}
+
+ 标签设置
+
+
+
+
+
+
+ 正在编辑“{{tagForm.name}}”
+ 取消
+
+ 标签加载中
+
+
+ {{item.name}}
+
+ 编辑
+ 删除
+
+
+
+ 暂无标签,可用于新建预约时快速选择
+
+
+
店铺排班
diff --git a/JY-Salon-WeChat/pages/shop-settings/index.wxss b/JY-Salon-WeChat/pages/shop-settings/index.wxss
index 945d3f36..457a19cf 100644
--- a/JY-Salon-WeChat/pages/shop-settings/index.wxss
+++ b/JY-Salon-WeChat/pages/shop-settings/index.wxss
@@ -278,6 +278,94 @@
font-weight: 800;
}
+.tag-setting-card {
+ display: flex;
+ flex-direction: column;
+ gap: 18rpx;
+ padding: 20rpx 24rpx;
+}
+
+.tag-form-row {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 150rpx;
+ gap: 12rpx;
+}
+
+.tag-input {
+ min-width: 0;
+ height: 70rpx;
+ padding: 0 18rpx;
+ border: 1rpx solid #eadfd2;
+ border-radius: 14rpx;
+ background: #fff8f2;
+ color: #3d3128;
+ font-size: 26rpx;
+}
+
+.tag-save-btn {
+ width: 100%;
+ min-width: 0;
+}
+
+.tag-edit-tip {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12rpx;
+ color: #7b7167;
+ font-size: 22rpx;
+}
+
+.tag-clear {
+ color: #2f6b55;
+}
+
+.tag-list {
+ display: grid;
+ gap: 12rpx;
+}
+
+.tag-item {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12rpx;
+}
+
+.tag-preview {
+ display: inline-flex;
+ align-items: center;
+ min-width: 0;
+ max-width: 100%;
+ min-height: 54rpx;
+ padding: 0 16rpx;
+ overflow: hidden;
+ border: 1rpx solid;
+ border-radius: 999rpx;
+ font-size: 24rpx;
+ font-weight: 800;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.tag-actions {
+ display: flex;
+ flex: 0 0 auto;
+ gap: 16rpx;
+ color: #2f6b55;
+ font-size: 22rpx;
+ font-weight: 800;
+}
+
+.tag-actions .danger {
+ color: #c36a6a;
+}
+
+.tag-empty {
+ color: #8c8177;
+ font-size: 24rpx;
+}
+
.rule-card {
display: flex;
flex-direction: column;
diff --git a/docs/项目变更记录.md b/docs/项目变更记录.md
index 85b643b7..d6659d16 100644
--- a/docs/项目变更记录.md
+++ b/docs/项目变更记录.md
@@ -404,3 +404,11 @@
- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移;生产库已在上一轮执行过预约作品快照和员工全周全天排班相关迁移。
- 影响范围:更新 `JY-Core` 预约状态、预约详情、预约图片快照回显/删除、预约价格维护和手工预约日历兜底相关能力;不更新 Gateway、Web 静态资源、Nacos、Nginx 和数据库结构。
- 验证方式:发布前 `PlanningServiceImplTest` 20 个用例通过、`JayuCloudSqlSchemaTest` 9 个用例通过,店务小程序相关 JS 语法检查通过;发布后三台 Core 均为 `active`,本机 `/health/check` 正常,公网 `https://yunail.art/health/check` 与 `https://yunail.art/api/shop/list` 均返回 200。生产执行与验证时间为 `2026-07-23 18:43-18:50 +08:00`。
+
+## 2026-07-23 店务小程序新增预约标签设置与展示
+
+- 变更原因:店务端需要在店铺设置里维护预约标签,并在新建预约时支持复用标签、手动输入即建标签,同时在预约详情展示这些标签。
+- 处理方式:仅改动 `JY-Salon-WeChat`。在店铺设置页新增标签管理区,复用现有 `/admin/tag` 接口完成列表、创建、编辑、删除;在预约表单手工项目面板改为标签多选 + 手动新增标签;保留预约详情页现有 `productTags` 展示链路,不新增后端或 SQL 改动。
+- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。
+- 影响范围:影响 `JY-Salon-WeChat/pages/shop-settings/`、`JY-Salon-WeChat/pages/appointment-form/` 与标签 API 封装;预约详情页继续通过既有 `appointment.productTags` 渲染标签。
+- 验证方式:`JY-Salon-WeChat/api/tags.js`、预约表单页、店铺设置页 JS 语法检查通过;相关文件 `git diff --check` 通过;微信开发者工具运行态验证 `pages/shop-settings/index` 可见“标签设置”区,`pages/appointment-form/index` 可打开手工预约面板并展示标签输入/添加控件;GitNexus staged `detect-changes` 结果为 low risk、0 affected processes。
diff --git a/memory/bugs.md b/memory/bugs.md
index 37dee969..49802720 100644
--- a/memory/bugs.md
+++ b/memory/bugs.md
@@ -487,3 +487,15 @@
以后避免:小程序自动化验证前必须同时确认项目路径和端口,不只看路由;多项目并行时优先使用固定端口映射。
验证方式:发现 `sourceProjectPath` 不匹配时停止截图验证,改用静态样式检查、`git diff --check` 和 GitNexus 变更检测兜底。
+
+## 2026-07-23 GitNexus / pnpm 在 Windows PowerShell 下被微信开发者工具 Node 抢占 PATH
+
+问题:在 `D:\code\JayuCloud` 目录直接运行 GitNexus、`pnpm`、`npx` 或依赖较新 Node 版本的命令时,默认 `node` 会先命中微信开发者工具自带的 Node 16,导致命令报错或行为异常。
+
+原因:当前环境的 PATH 顺序里,微信开发者工具内置 Node 排在前面;PowerShell 直接执行时不会自动切回项目常用的 Node 24。
+
+处理方式:执行这类命令前,改用 `cmd /c "set PATH=E:\Development\Node\node-v24;E:\Development\Node\npm-global;%PATH%&& ..."` 临时把 Node 24 放到当前命令 PATH 最前面;必要时先跑 `node -v` 确认版本。
+
+以后避免:凡是在 JayuCloud 里运行 GitNexus、`pnpm`、`npx`、`.gitnexus/run.cjs` 之类命令,先检查 `Get-Command node` 和 `node -v`;如果命中微信开发者工具 Node,立刻切换到带 PATH 前缀的 `cmd /c` 写法。
+
+验证方式:切换前后分别执行 `node -v`,应从 `16.x` 变成 `24.x`;之后 GitNexus `impact` / `detect_changes` 与 `pnpm` 命令可正常完成。
diff --git a/memory/progress.md b/memory/progress.md
index b9023ec6..c7fdf89d 100644
--- a/memory/progress.md
+++ b/memory/progress.md
@@ -49,3 +49,9 @@
- 下一步:提交本次生产发布记录;店务小程序由用户发布。
- 当前阻塞点:无。
- 最近一次重要操作结果:三台 Core 均为 `active/enabled`,本机 `/health/check` 正常,公网 `https://yunail.art/health/check` 与 `https://yunail.art/api/shop/list` 均返回 200。
+
+## 2026-07-23 店务小程序预约标签设置与展示
+- 已完成:店铺设置页新增标签管理区,预约表单手工项目面板支持标签多选和手动输入新建标签,预约详情展示链路已确认复用既有 `productTags`。
+- 下一步:保持当前暂存范围,提交本次中文 commit。
+- 当前阻塞点:无。
+- 最近一次重要操作结果:微信开发者工具运行态验证已通过,`pages/shop-settings/index` 可见“标签设置”区,`pages/appointment-form/index` 可打开手工预约面板并显示标签输入/添加控件;GitNexus staged `detect-changes` 结果为 low risk、0 affected processes。