From 9925c7f83b1067e4b63217da6a79ecda6200d33d Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 21 Oct 2026 00:55:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E9=BD=90=E5=8E=86=E5=8F=B2=E8=A1=A5?= =?UTF-8?q?=E5=BD=95=E6=AC=BE=E5=BC=8F=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-WeChat/pages/backfill-order/index.js | 23 ++- .../pages/backfill-order/index.wxml | 27 ++- .../pages/backfill-order/index.wxss | 174 +++++++++++++++++- .../backfill-order/product-selector.test.js | 27 ++- ...2026-10-21-salon补录款式弹窗对齐-design.md | 20 ++ docs/项目变更记录.md | 7 + 6 files changed, 258 insertions(+), 20 deletions(-) create mode 100644 docs/superpowers/specs/2026-10-21-salon补录款式弹窗对齐-design.md diff --git a/JC-Salon-WeChat/pages/backfill-order/index.js b/JC-Salon-WeChat/pages/backfill-order/index.js index 2eb41853..b0ec1273 100644 --- a/JC-Salon-WeChat/pages/backfill-order/index.js +++ b/JC-Salon-WeChat/pages/backfill-order/index.js @@ -5,7 +5,7 @@ const customersApi = require('../../api/customers') const dateUtil = require('../../utils/date') Page({ - data: { form: { serviceDate: dateUtil.formatDate(new Date()), manualProductTitle: '', amount: '', customerName: '', phone: '', serviceTime: '', status: 4, remark: '', artistId: '', productId: '', customerUserId: '' }, manualProductDraft: { title: '', price: '' }, manualMoreExpanded: false, productSelectorMode: 'list', artists: [], artistOptions: [], allProductOptions: [], productOptions: [], customerOptions: [], allCustomerOptions: [], productSelectorVisible: false, artistSelectorVisible: false, customerSelectorVisible: false, loadingProducts: false, loadingArtists: false, loadingCustomers: false, productKeyword: '', artistKeyword: '', customerKeyword: '', productError: '', artistError: '', customerError: '', selectedArtistName: '', selectedProduct: {}, selectedProductTitle: '', selectedProductPriceText: '', submitting: false }, + data: { form: { serviceDate: dateUtil.formatDate(new Date()), manualProductTitle: '', amount: '', customerName: '', phone: '', serviceTime: '', status: 4, remark: '', artistId: '', productId: '', customerUserId: '' }, manualProductDraft: { title: '', price: '' }, artists: [], artistOptions: [], allProductOptions: [], productOptions: [], customerOptions: [], allCustomerOptions: [], productSelectorVisible: false, manualProductSheetVisible: false, artistSelectorVisible: false, customerSelectorVisible: false, loadingProducts: false, loadingArtists: false, loadingCustomers: false, productKeyword: '', artistKeyword: '', customerKeyword: '', productError: '', artistError: '', customerError: '', selectedArtistName: '', selectedProduct: {}, selectedProductTitle: '', selectedProductPriceText: '', submitting: false }, onLoad(options = {}) { const serviceDate = options.serviceDate || this.data.form.serviceDate const artistId = options.artistId || '' @@ -43,12 +43,17 @@ Page({ this.setData({ allProductOptions: options, productOptions: options.filter(item => !keyword || `${item.title} ${item.artistText} ${item.tagList.join(' ')}`.toLowerCase().includes(keyword)) }) }, async loadCustomers() { this.setData({ loadingCustomers: true }); try { const result = await customersApi.list({ page: 1, size: 30 }); const list = result.list || result || []; const options = list.map(item => ({ id: item.id, title: item.nickname || item.name || item.account, subtitle: item.phone || item.contactPhone || '' })); this.setData({ allCustomerOptions: options, customerOptions: options, customerError: '' }) } catch (error) { this.setData({ customerError: error.message || '客户加载失败' }) } finally { this.setData({ loadingCustomers: false }) } }, - openProductSelector() { this.setData({ productSelectorVisible: true, productSelectorMode: 'list' }) }, - closeProductSelector() { this.setData({ productSelectorVisible: false, productSelectorMode: 'list' }) }, - openManualProduct() { this.setData({ productSelectorMode: 'manual', manualMoreExpanded: false }) }, - backToProductList() { this.setData({ productSelectorMode: 'list' }) }, - onManualProductInput(e) { this.setData({ [`manualProductDraft.${e.detail.field}`]: e.detail.value }) }, - toggleManualProductMore() { this.setData({ manualMoreExpanded: !this.data.manualMoreExpanded }) }, + openProductSelector() { this.setData({ manualProductSheetVisible: true }) }, + openProductLibrary() { this.setData({ manualProductSheetVisible: false, productSelectorVisible: true }) }, + closeProductSelector() { this.setData({ productSelectorVisible: false }) }, + closeManualProduct() { this.setData({ manualProductSheetVisible: false }) }, + openManualProduct() { this.setData({ productSelectorVisible: false, manualProductSheetVisible: true }) }, + onManualProductInput(e) { + const field = e.currentTarget && e.currentTarget.dataset.field || e.detail.field + this.setData({ [`manualProductDraft.${field}`]: e.detail.value }) + }, + stopTap() {}, + stopTouchMove() {}, openArtistSelector() { this.setData({ artistSelectorVisible: true }) }, closeArtistSelector() { this.setData({ artistSelectorVisible: false }) }, openCustomerSelector() { this.setData({ customerSelectorVisible: true }) }, @@ -56,7 +61,7 @@ Page({ searchProducts(e) { const keyword = String(e.detail.value || '').trim().toLowerCase(); this.setData({ productKeyword: keyword, productOptions: this.data.allProductOptions.filter(item => !keyword || `${item.title} ${item.artistText} ${item.tagList.join(' ')}`.toLowerCase().includes(keyword)) }) }, searchArtists(e) { const keyword = String(e.detail.value || '').toLowerCase(); this.setData({ artistKeyword: keyword, artistOptions: this.data.artists.map(item => ({ id: item.id, title: item.name, subtitle: item.phone || '' })).filter(item => !keyword || item.title.toLowerCase().includes(keyword)) }) }, searchCustomers(e) { const keyword = String(e.detail.value || '').toLowerCase(); this.setData({ customerKeyword: keyword, customerOptions: this.data.allCustomerOptions.filter(item => !keyword || String(item.title).toLowerCase().includes(keyword) || String(item.subtitle).includes(keyword)) }) }, - selectProduct(e) { const item = e.detail.item; this.setData({ 'form.productId': item.id, selectedProduct: item, selectedProductTitle: item.title, selectedProductPriceText: item.priceText || (item.price == null ? '价格待定' : `¥${item.price}`), 'form.manualProductTitle': '', manualProductDraft: { title: '', price: '' }, 'form.amount': item.price == null ? this.data.form.amount : String(item.price), productSelectorVisible: false, productSelectorMode: 'list' }) }, + selectProduct(e) { const item = e.detail.item; this.setData({ 'form.productId': item.id, selectedProduct: item, selectedProductTitle: item.title, selectedProductPriceText: item.priceText || (item.price == null ? '价格待定' : `¥${item.price}`), 'form.manualProductTitle': '', manualProductDraft: { title: '', price: '' }, 'form.amount': item.price == null ? this.data.form.amount : String(item.price), productSelectorVisible: false, manualProductSheetVisible: false }) }, selectArtist(e) { const item = e.detail.item; this.setData({ 'form.artistId': item.id, selectedArtistName: item.title, artistSelectorVisible: false }) }, selectCustomer(e) { const item = e.detail.item; this.setData({ 'form.customerUserId': item.id, 'form.customerName': item.title, 'form.phone': item.subtitle, customerSelectorVisible: false }) }, useWalkIn() { this.setData({ 'form.customerUserId': '', 'form.customerName': '', 'form.phone': '', customerSelectorVisible: false }) }, @@ -69,7 +74,7 @@ Page({ wx.showToast({ title: '请填写作品名称和价格', icon: 'none' }) return } - this.setData({ 'form.productId': '', 'form.manualProductTitle': title, selectedProduct: {}, selectedProductTitle: '', selectedProductPriceText: `¥${price}`, 'form.amount': String(price), productSelectorVisible: false, productSelectorMode: 'list' }) + this.setData({ 'form.productId': '', 'form.manualProductTitle': title, selectedProduct: {}, selectedProductTitle: '', selectedProductPriceText: `¥${price}`, 'form.amount': String(price), productSelectorVisible: false, manualProductSheetVisible: false }) }, onInput(e) { this.setData({ [`form.${e.currentTarget.dataset.field}`]: e.detail.value }) }, onDateChange(e) { this.setData({ 'form.serviceDate': e.detail.value }) }, diff --git a/JC-Salon-WeChat/pages/backfill-order/index.wxml b/JC-Salon-WeChat/pages/backfill-order/index.wxml index d508f4e7..406b5fad 100644 --- a/JC-Salon-WeChat/pages/backfill-order/index.wxml +++ b/JC-Salon-WeChat/pages/backfill-order/index.wxml @@ -10,16 +10,16 @@ 美甲款式* - 选择款式或手动录入 + 手动录入为主,也可从款式库快速选择 - @@ -88,7 +88,26 @@ - + + + + + 录入本次美甲款式款式名称和价格必填 + + + + + + + + 参考价会自动带入实际成交金额,保存前仍可按本次服务情况调整。 + + + + + + + diff --git a/JC-Salon-WeChat/pages/backfill-order/index.wxss b/JC-Salon-WeChat/pages/backfill-order/index.wxss index b9404833..2d4f9616 100644 --- a/JC-Salon-WeChat/pages/backfill-order/index.wxss +++ b/JC-Salon-WeChat/pages/backfill-order/index.wxss @@ -101,6 +101,26 @@ font-weight: 800; } +.field-card { + display: flex; + width: 100%; + min-height: 124rpx; + align-items: center; + gap: 22rpx; + padding: 20rpx 22rpx; + border: 2rpx dashed #cbdcd5; + border-radius: 30rpx; + background: #fbfdfc; + text-align: left; + line-height: 1.35; + box-sizing: border-box; +} + +button.full{ + width: 100%; + box-sizing: border-box; + margin: 0; /* 清除小程序button自带左右margin */ +} .backfill-field-card { display: flex; width: 100%; @@ -115,7 +135,11 @@ text-align: left; line-height: 1.35; } - +button.full{ + width: 100%; + box-sizing: border-box; + margin: 0; /* 清除小程序button自带左右margin */ +} .backfill-page .field-icon { display: flex; width: 76rpx; @@ -384,6 +408,154 @@ box-shadow: 0 10rpx 22rpx rgba(23, 33, 31, 0.16); } +.backfill-manual-product-mask { + position: fixed; + inset: 0; + z-index: 140; + display: flex; + align-items: flex-end; + justify-content: center; + background: rgba(16, 29, 25, 0.44); +} + +.backfill-manual-style-sheet { + display: flex; + width: 100%; + height: 70vh; + max-height: 82vh; + flex-direction: column; + overflow: hidden; + padding: 28rpx 28rpx calc(24rpx + env(safe-area-inset-bottom)); + border-radius: 34rpx 34rpx 0 0; + background: #fff; + box-shadow: 0 -20rpx 48rpx rgba(24, 48, 40, 0.14); +} + +.backfill-manual-style-sheet .modal-head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 20rpx; + margin-bottom: 20rpx; +} + +.backfill-manual-style-sheet .modal-title, +.backfill-manual-style-sheet .modal-subtitle { + display: block; +} + +.backfill-manual-style-sheet .modal-title { + color: #17211f; + font-size: 34rpx; + font-weight: 900; +} + +.backfill-manual-style-sheet .modal-subtitle { + margin-top: 8rpx; + color: #71807a; + font-size: 24rpx; +} + +.backfill-manual-style-sheet .modal-close { + position: relative; + display: flex; + width: 48rpx; + min-width: 48rpx; + height: 48rpx; + align-items: center; + justify-content: center; + border: 1rpx solid #e7ece9; + border-radius: 50%; + background: #fff; +} + +.backfill-manual-style-sheet .modal-close::before, +.backfill-manual-style-sheet .modal-close::after { + position: absolute; + width: 22rpx; + height: 3rpx; + border-radius: 999rpx; + background: #247b63; + content: ""; +} + +.backfill-manual-style-sheet .modal-close::before { + transform: rotate(45deg); +} + +.backfill-manual-style-sheet .modal-close::after { + transform: rotate(-45deg); +} + +.backfill-manual-style-sheet .manual-style-content { + height: 0; + min-height: 0; + flex: 1; + padding: 8rpx 0 20rpx; +} + +.backfill-manual-fields { + display: flex; + align-items: center; + gap: 14rpx; +} + +.backfill-manual-fields .style-name-input { + box-sizing: border-box; + width: 100%; + height: 82rpx; + padding: 0 18rpx; + border: 1rpx solid #dce6e1; + border-radius: 24rpx; + background: #fbfdfc; + color: #17211f; + font-size: 24rpx; +} + +.backfill-manual-fields .backfill-manual-product-name { + min-width: 0; + flex: 1; +} + +.backfill-manual-fields .backfill-manual-product-price { + min-width: 0; + flex: 0 0 220rpx; +} + +.backfill-manual-style-sheet .manual-style-hint { + display: block; + margin-top: 18rpx; + color: #71807a; + font-size: 21rpx; + line-height: 1.5; +} + +.backfill-manual-style-sheet .manual-style-footer { + flex: 0 0 auto; + padding-top: 16rpx; + border-top: 2rpx solid #e7ece9; +} + +.backfill-manual-style-sheet .manual-style-confirm { + width: 100%; + height: 84rpx; + margin: 0; + border-radius: 24rpx; + background: #17211f; + color: #fff; + font-size: 26rpx; + font-weight: 800; + line-height: 84rpx; +} + +.backfill-manual-style-sheet .manual-style-library-link { + height: 64rpx; + margin: 10rpx auto 0; + color: #247b63; + font-size: 22rpx; + line-height: 64rpx; +} + @media (max-width: 360px) { .backfill-title { font-size: 44rpx; diff --git a/JC-Salon-WeChat/pages/backfill-order/product-selector.test.js b/JC-Salon-WeChat/pages/backfill-order/product-selector.test.js index 73cbb3cf..4239c3a8 100644 --- a/JC-Salon-WeChat/pages/backfill-order/product-selector.test.js +++ b/JC-Salon-WeChat/pages/backfill-order/product-selector.test.js @@ -1,4 +1,6 @@ const assert = require('assert') +const fs = require('fs') +const path = require('path') let definition global.Page = value => { definition = value } @@ -22,25 +24,38 @@ function createPage() { const page = createPage() page.openProductSelector() +assert.strictEqual(page.data.manualProductSheetVisible, true) +assert.strictEqual(page.data.productSelectorVisible, false) + +page.openProductLibrary() +assert.strictEqual(page.data.manualProductSheetVisible, false) assert.strictEqual(page.data.productSelectorVisible, true) -assert.strictEqual(page.data.productSelectorMode, 'list') +page.openManualProduct() +assert.strictEqual(page.data.productSelectorVisible, false) +assert.strictEqual(page.data.manualProductSheetVisible, true) + page.selectProduct({ detail: { item: { id: 12, title: '轻奢款', price: 168, priceText: '¥168', coverImage: '/cover.jpg' } } }) assert.strictEqual(page.data.form.productId, 12) assert.strictEqual(page.data.form.amount, '168') assert.strictEqual(page.data.selectedProductPriceText, '¥168') assert.strictEqual(page.data.selectedProduct.coverImage, '/cover.jpg') assert.strictEqual(page.data.form.manualProductTitle, '') +assert.strictEqual(page.data.manualProductSheetVisible, false) -page.data.manualProductDraft = { title: '临时款', price: '199' } +page.onManualProductInput({ currentTarget: { dataset: { field: 'title' } }, detail: { value: '临时款' } }) +page.onManualProductInput({ currentTarget: { dataset: { field: 'price' } }, detail: { value: '199' } }) page.useManualProduct() assert.strictEqual(page.data.form.productId, '') assert.strictEqual(page.data.form.manualProductTitle, '临时款') assert.strictEqual(page.data.form.amount, '199') assert.strictEqual(page.data.selectedProductPriceText, '¥199') assert.deepStrictEqual(page.data.selectedProduct, {}) +assert.strictEqual(page.data.manualProductSheetVisible, false) -page.openManualProduct() -assert.strictEqual(page.data.productSelectorMode, 'manual') -page.toggleManualProductMore() -assert.strictEqual(page.data.manualMoreExpanded, true) +const wxml = fs.readFileSync(path.join(__dirname, 'index.wxml'), 'utf8') +const wxss = fs.readFileSync(path.join(__dirname, 'index.wxss'), 'utf8') +assert.match(wxml, /class="manual-style-sheet backfill-manual-style-sheet"/) +assert.match(wxml, /class="modal-close" bindtap="closeManualProduct"/) +assert.match(wxml, /bindtap="openProductLibrary">从款式库中选择<\/button>/) +assert.match(wxss, /\.backfill-manual-style-sheet\s*\{[^}]*height:\s*70vh/s) diff --git a/docs/superpowers/specs/2026-10-21-salon补录款式弹窗对齐-design.md b/docs/superpowers/specs/2026-10-21-salon补录款式弹窗对齐-design.md new file mode 100644 index 00000000..20769141 --- /dev/null +++ b/docs/superpowers/specs/2026-10-21-salon补录款式弹窗对齐-design.md @@ -0,0 +1,20 @@ +# Salon 补录款式弹窗与新增页对齐 + +## 目标 + +补录页面的款式录入交互和新增预约保持一致,让手动录入作为默认入口,同时保留从已有款式库快速选择的能力。 + +## 交互 + +- 点击补录表单中的美甲款式卡片,打开底部款式录入弹层。 +- 弹层沿用新增预约的标题区、圆形关闭按钮、独立滚动内容、底部主按钮和款式库入口。 +- 补录特有的款式价格与名称并列录入,二者都必填;确认后款式名称回填表单,参考价带入实际成交金额。 +- 实际成交金额仍可在补录表单中单独修改。 +- 选择款式库入口后显示已有款式列表;选择款式时按既有逻辑回填项目和参考价。 +- 从款式库触发手动录入时也打开同一个录入弹层。 + +## 边界与验证 + +- 不修改后端接口、数据库和订单协议。 +- 不改变普通预约作品选择流程。 +- 使用页面状态测试覆盖录入/款式库切换、作品回填和价格回填,并检查小程序 JavaScript 语法及差异格式。 diff --git a/docs/项目变更记录.md b/docs/项目变更记录.md index eaaa5bd5..13ef17dc 100644 --- a/docs/项目变更记录.md +++ b/docs/项目变更记录.md @@ -1,5 +1,12 @@ # 项目变更记录 +## 2026-10-21 Salon 补录款式弹窗对齐新增页 + +- 问题:补录页面打开后直接进入款式列表,手动录入弹层与新增预约页样式和入口不一致。 +- 处理:补录款式卡改为直接打开与新增页同结构的底部录入弹层;弹层保留款式名称、必填参考价、圆形关闭、确认按钮和款式库入口。 +- 兼容:款式库选择、参考价带入实际成交金额及金额二次调整行为保持不变。 +- 验证:补录作品选择状态测试、新增预约弹层及作品测试、JS 语法检查和 `git diff --check` 通过。 + ## 2026-10-20 Salon 新增预约页面对齐演示稿 - 问题:新增预约页虽然保留了确认的字段和业务规则,但实际呈现与 demo 差异明显。