From 8d3f092084dcb3abf6c6e0d4da20f18f760af7d7 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Tue, 20 Oct 2026 18:42:27 +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=8D=95=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-WeChat/pages/backfill-order/index.js | 6 +- .../pages/backfill-order/index.wxml | 105 ++++- .../pages/backfill-order/index.wxss | 410 +++++++++++++++++- .../backfill-order/product-selector.test.js | 4 +- 4 files changed, 504 insertions(+), 21 deletions(-) diff --git a/JC-Salon-WeChat/pages/backfill-order/index.js b/JC-Salon-WeChat/pages/backfill-order/index.js index 0695b884..2eb41853 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: '', 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: '' }, 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 }, onLoad(options = {}) { const serviceDate = options.serviceDate || this.data.form.serviceDate const artistId = options.artistId || '' @@ -56,7 +56,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, 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, productSelectorMode: 'list' }) }, 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 +69,7 @@ Page({ wx.showToast({ title: '请填写作品名称和价格', icon: 'none' }) return } - this.setData({ 'form.productId': '', 'form.manualProductTitle': title, 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, productSelectorMode: 'list' }) }, 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 39cc5d86..d508f4e7 100644 --- a/JC-Salon-WeChat/pages/backfill-order/index.wxml +++ b/JC-Salon-WeChat/pages/backfill-order/index.wxml @@ -1,19 +1,94 @@ - - - 历史补单不校验美甲师排班,也不会占用预约时段。 - 服务日期{{form.serviceDate}} - 项目 - 金额 - 美甲师{{selectedArtistName || '请选择美甲师'}} - 客户{{form.customerName || '请选择客户(可选)'}} - 手机号 - 服务时间{{form.serviceTime || '时间未记录'}} - 状态服务中已完成 - 备注