From 4e0cf2e217a67b1e64454f57b08602cff024a8a0 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 28 Oct 2026 21:38:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=B0=8F=E7=A8=8B=E5=BA=8F):=20=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E9=9D=A2=E6=9D=BF=E4=B8=8E=E5=95=86=E5=93=81=E6=BA=AF?= =?UTF-8?q?=E6=BA=90=E6=A8=A1=E5=9D=97=E9=A1=BA=E5=BA=8F=E5=AF=B9=E9=BD=90?= =?UTF-8?q?=E9=85=8D=E9=80=81=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniprogram/components/mall-panel/index.js | 29 ++++++++++++---- miniprogram/components/mall-panel/index.wxml | 15 +++++++-- miniprogram/components/mall-panel/index.wxss | 35 +++++++++++++++----- miniprogram/modules/registry.js | 2 ++ 4 files changed, 63 insertions(+), 18 deletions(-) diff --git a/miniprogram/components/mall-panel/index.js b/miniprogram/components/mall-panel/index.js index ff34cb7..240a399 100644 --- a/miniprogram/components/mall-panel/index.js +++ b/miniprogram/components/mall-panel/index.js @@ -267,11 +267,8 @@ Component({ } }, - /** 逐行加工方式(只改方式;仓内/供应商加工由管理员配置) */ - onItemMethodChange(e) { - const index = Number(e.currentTarget.dataset.index); - const pickIndex = Number(e.detail && e.detail.value) || 0; - const method = this.data.processingMethods[pickIndex] || '原材料'; + /** 写入加工方式:列表点选或手输自定义均可。 */ + writeItemMethod(index, method) { const checkoutItem = this.data.checkoutItems[index]; if (!checkoutItem) return; const cart = { ...(this.data.cart || {}) }; @@ -284,10 +281,30 @@ Component({ this.setData({ cart, [`checkoutItems[${index}].processing_method`]: method, - [`checkoutItems[${index}].methodIndex`]: pickIndex, + [`checkoutItems[${index}].methodIndex`]: Math.max( + 0, + this.data.processingMethods.indexOf(method) + ), }); }, + onItemMethodInput(e) { + const index = Number(e.currentTarget.dataset.index); + this.writeItemMethod(index, String((e.detail && e.detail.value) || '').slice(0, 50)); + }, + + onItemMethodBlur(e) { + const index = Number(e.currentTarget.dataset.index); + const method = String((e.detail && e.detail.value) || '').trim().slice(0, 50) || '原材料'; + this.writeItemMethod(index, method); + }, + + onItemMethodChange(e) { + const index = Number(e.currentTarget.dataset.index); + const pickIndex = Number(e.detail && e.detail.value) || 0; + this.writeItemMethod(index, this.data.processingMethods[pickIndex] || '原材料'); + }, + /** 逐行备注 */ onItemRemarkInput(e) { const index = Number(e.currentTarget.dataset.index); diff --git a/miniprogram/components/mall-panel/index.wxml b/miniprogram/components/mall-panel/index.wxml index e00ea54..5aaca84 100644 --- a/miniprogram/components/mall-panel/index.wxml +++ b/miniprogram/components/mall-panel/index.wxml @@ -81,19 +81,28 @@ {{item.name}} - ×{{item.quantity}} + ×{{item.quantity}}{{item.unit}} + ¥{{item.amount}} + - {{item.processing_method}} + ▾ - ¥{{item.amount}}