From 976ca68687e46cb70b3253fbe44e7a276f95ff2e Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 28 Oct 2026 17:55:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A2=84=E7=BA=A6=E6=AC=BE?= =?UTF-8?q?=E5=BC=8F=E5=BD=95=E5=85=A5=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 2 + CLAUDE.md | 5 + .../pages/appointment-form/index.js | 92 +++++- .../pages/appointment-form/index.wxml | 39 ++- .../pages/appointment-form/index.wxss | 304 +++++++----------- .../appointment-form/product-selector.test.js | 77 ++++- docs/项目变更记录.md | 7 + 7 files changed, 303 insertions(+), 223 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index e6d59a51..5164818f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -45,6 +45,8 @@ This project is indexed by GitNexus as **JayuCloud** (36096 symbols, 76216 relat ## Project Workflow Rules +- 用户未明确要求设计文档或方案确认时,实施类请求直接基于现有代码修改,不额外编写设计文档,也不以设计确认流程阻塞实现。 +- 修改前如工作区已有未提交改动,先创建中文 Git 回溯提交,再开始本次任务;提交后只暂存和提交本次任务涉及的文件,保留其他新产生或并行改动。 - 每次任务中发现的问题、原因和处理方式都需要记录下来,并在后续相关任务中回顾,避免重复发生。 - 后端修改如果涉及 SQL,默认新增版本变更 SQL;只有负责人明确要求重整初始化基线时,才将已存在的变更合并到初始化 SQL。 - 版本变更 SQL 文件名必须使用中文,体现功能和日期,并且 SQL 内容必须是完整可执行脚本。 diff --git a/CLAUDE.md b/CLAUDE.md index 5617663e..26eaebc7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -42,3 +42,8 @@ This project is indexed by GitNexus as **JayuCloud** (36096 symbols, 76216 relat | Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus-cli/SKILL.md` | + +## Project Workflow Rules + +- 用户未明确要求设计文档或方案确认时,实施类请求直接基于现有代码修改,不额外编写设计文档,也不以设计确认流程阻塞实现。 +- 修改前如工作区已有未提交改动,先创建中文 Git 回溯提交,再开始本次任务;提交后只暂存和提交本次任务涉及的文件,保留其他新产生或并行改动。 diff --git a/JC-Salon-WeChat/pages/appointment-form/index.js b/JC-Salon-WeChat/pages/appointment-form/index.js index b4076860..f9b69406 100644 --- a/JC-Salon-WeChat/pages/appointment-form/index.js +++ b/JC-Salon-WeChat/pages/appointment-form/index.js @@ -483,6 +483,7 @@ Page({ createCustomerRecord: false, remark: '' }, + unifiedStyleDescription: '', customerOptions: [], customerDirectory: [], customerSheetVisible: false, @@ -501,6 +502,7 @@ Page({ artistError: '', selectedProduct: {}, selectedProductPriceText: '', + manualProductTitleLength: 0, selectedArtist: {}, productModalVisible: false, manualProductSheetVisible: false, @@ -552,6 +554,8 @@ Page({ appointmentDate, artistId: options.artistId || baseForm.artistId || '' }, + manualProductTitleLength: String(baseForm.manualProductTitle || '').length, + unifiedStyleDescription: String(baseForm.remark || baseForm.manualProductDescription || ''), draftSavedAtText: draftForm ? '已恢复本机草稿' : '', appointmentDayLabel: dateLabels.day, appointmentDateBadge: dateLabels.badge, @@ -584,7 +588,11 @@ Page({ const selectedProduct = this.data.filteredProducts.find(item => String(item.id) === String(this.data.form.productId)) || {} const selectedProductPatch = { selectedProduct, - selectedProductPriceText: selectedProduct.priceText || '' + selectedProductPriceText: selectedProduct.priceText || '', + unifiedStyleDescription: this.data.unifiedStyleDescription || this.data.form.remark || this.data.form.manualProductDescription || '', + manualProductTitleLength: this.data.form.manualProductTitle + ? String(this.data.form.manualProductTitle).length + : String(selectedProduct.title || '').length } if (selectedProduct.id && (this.data.form.amount === '' || this.data.form.amount === undefined)) { selectedProductPatch['form.amount'] = selectedProduct.price === undefined || selectedProduct.price === null ? '' : String(selectedProduct.price) @@ -685,16 +693,32 @@ Page({ }, onStyleTitleInput(event) { - const patch = { 'form.manualProductTitle': event.detail.value } + const patch = { + 'form.manualProductTitle': event.detail.value, + manualProductTitleLength: String(event.detail.value || '').length + } if (this.data.form.productId) { patch['form.productId'] = '' patch.selectedProduct = {} patch.selectedProductPriceText = '' + patch['form.manualProductDescription'] = this.data.unifiedStyleDescription || '' Object.assign(patch, buildManualProductImagePatch([])) } this.setData(patch) }, + onUnifiedStyleDescriptionInput(event) { + const description = event.detail.value || '' + const patch = { + unifiedStyleDescription: description, + 'form.remark': description + } + if (!this.data.form.productId) { + patch['form.manualProductDescription'] = description + } + this.setData(patch) + }, + onCustomerInput(event) { const field = event.currentTarget.dataset.field const patch = { @@ -891,10 +915,33 @@ Page({ this.setData({ productModalVisible: false, manualProductSheetVisible: true, - manualProductMoreVisible: false + manualProductMoreVisible: false, + unifiedStyleDescription: this.data.form.remark || this.data.form.manualProductDescription || this.data.unifiedStyleDescription || '', + manualProductTitleLength: this.data.form.productId + ? String(this.data.selectedProduct.title || '').length + : String(this.data.form.manualProductTitle || '').length }) }, + openManualProductFromLibrary() { + const patch = { + 'form.productId': '', + selectedProduct: {}, + selectedProductPriceText: '', + unifiedStyleDescription: this.data.form.remark || this.data.form.manualProductDescription || this.data.unifiedStyleDescription || '', + manualProductTitleLength: String(this.data.form.manualProductTitle || '').length, + productModalVisible: false, + manualProductSheetVisible: true, + manualProductMoreVisible: false + } + if (this.data.form.productId) { + patch['form.manualProductTitle'] = '' + patch['form.manualProductDescription'] = this.data.unifiedStyleDescription || '' + patch.manualProductTitleLength = 0 + } + this.setData(patch) + }, + closeManualProduct() { this.setData({ manualProductSheetVisible: false }) }, @@ -904,23 +951,34 @@ Page({ }, confirmManualProduct() { - const hasTitle = Boolean(String(this.data.form.manualProductTitle || '').trim()) - const hasImage = (this.data.form.manualProductImages || []).length > 0 || Boolean(String(this.data.form.manualProductImageFileIds || '').trim()) - const hasFallbackName = Boolean(String(this.data.form.customerName || '').trim()) - if (this.data.form.productId && !hasTitle && !hasImage) { - this.closeManualProduct() + if (!this.data.form.productId) { + const hasTitle = Boolean(String(this.data.form.manualProductTitle || '').trim()) + const hasImage = (this.data.form.manualProductImages || []).length > 0 || Boolean(String(this.data.form.manualProductImageFileIds || '').trim()) + const hasFallbackName = Boolean(String(this.data.form.customerName || '').trim()) + if (!hasTitle && !hasImage && !hasFallbackName) { + wx.showToast({ title: '请填写款式名称或添加图片', icon: 'none' }) + return + } + } + const amountText = String(this.data.form.amount === undefined || this.data.form.amount === null ? '' : this.data.form.amount).trim() + const amount = Number(amountText) + if (!amountText || !Number.isFinite(amount) || amount < 0) { + wx.showToast({ title: '请输入不小于0的预约金额', icon: 'none' }) return } - if (!hasTitle && !hasImage && !hasFallbackName) { - wx.showToast({ title: '请填写款式名称或添加图片', icon: 'none' }) + if (!normalizeDuration(this.data.form.durationMinutes)) { + wx.showToast({ title: '请输入大于0分钟的预计时长', icon: 'none' }) return } - this.setData({ - 'form.productId': '', - selectedProduct: {}, - selectedProductPriceText: '', - manualProductSheetVisible: false - }) + if (this.data.form.productId) { + this.setData({ manualProductSheetVisible: false }) + this.refreshAvailableTimes() + this.checkAvailability() + return + } + this.setData({ 'form.productId': '', selectedProduct: {}, selectedProductPriceText: '', manualProductSheetVisible: false }) + this.refreshAvailableTimes() + this.checkAvailability() }, stopTap() { @@ -940,6 +998,8 @@ Page({ this.setData({ selectedProduct, selectedProductPriceText: selectedProduct.priceText || '', + unifiedStyleDescription: this.data.form.remark || '', + manualProductTitleLength: String(selectedProduct.title || '').length, 'form.productId': selectedProduct.id, 'form.manualProductTitle': '', 'form.manualProductPrice': '', diff --git a/JC-Salon-WeChat/pages/appointment-form/index.wxml b/JC-Salon-WeChat/pages/appointment-form/index.wxml index 0cb10936..1bb24c08 100644 --- a/JC-Salon-WeChat/pages/appointment-form/index.wxml +++ b/JC-Salon-WeChat/pages/appointment-form/index.wxml @@ -21,21 +21,17 @@ {{form.manualProductTitle}} 已添加 {{form.manualProductImages.length}} 张款式图片 填写款式名称或添加图片 + {{form.amount || '待填'}} 元 · 预计 {{form.durationMinutes || '60'}} 分钟 {{form.manualProductImages.length ? '已添加 ' + form.manualProductImages.length + ' 张图片 · 点击可编辑' : '点击可手动录入,提交预约后自动加入款式库'}} › - + ✦ - {{selectedProduct.title}}参考价 {{selectedProductPriceText || '待定'}} · {{selectedProduct.durationText || '时长待定'}} - + {{selectedProduct.title}}参考价 {{selectedProductPriceText || '待定'}} · 本次 {{form.amount || '待填'}} 元 · {{form.durationMinutes || '60'}} 分钟 + - - - - - 款式备注