From a859f490d97527d66da76ee9af227d9952e27a7d Mon Sep 17 00:00:00 2001 From: wsb1224 Date: Fri, 3 Jul 2026 18:15:21 +0800 Subject: [PATCH] =?UTF-8?q?7-3=20=E4=BF=AE=E5=A4=8D=E8=80=81=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=88=90=E6=9C=AC=E6=A0=B8=E7=AE=97=E5=8F=8A=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E5=91=98=E5=B0=BA=E5=AF=B8=E4=BC=A0=E9=80=92=20-=20?= =?UTF-8?q?=E5=AE=9A=E4=BB=B7=E5=BC=95=E6=93=8E=E5=A7=8B=E7=BB=88=E9=87=8D?= =?UTF-8?q?=E7=AE=97cost=5Fprice=EF=BC=88=E7=A7=BB=E9=99=A4cost=3D=3D0?= =?UTF-8?q?=E9=99=90=E5=88=B6=EF=BC=89=20-=20=E4=B8=9A=E5=8A=A1=E5=91=98?= =?UTF-8?q?=E8=A1=A8=E5=8D=95calcDemandResult=E8=AE=BE=E7=BD=AElength=5Fm/?= =?UTF-8?q?width=5Fm=20-=20=E7=AE=A1=E7=90=86=E5=91=98=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E8=A1=A5=E4=B8=8A=E9=9C=80=E6=B1=82=E8=A7=84?= =?UTF-8?q?=E6=A0=BC=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- backend/app/services/order_service.py | 5 ++--- frontend/web-admin/src/views/OrdersPage.vue | 1 + frontend/web-sales/src/views/OrderFormPage.vue | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/app/services/order_service.py b/backend/app/services/order_service.py index 04c2563..5d6b918 100644 --- a/backend/app/services/order_service.py +++ b/backend/app/services/order_service.py @@ -237,8 +237,8 @@ class OrderService: "price_tier": getattr(item, "price_tier", None), } - # cost_price 为 0 且有定价规则时,尝试用引擎重算 - if item_dict["cost_price"] == 0 and item.product_id and item.product_id in rules_map: + # 有定价规则且有尺寸数据时,用定价引擎重算 cost_price + if item.product_id and item.product_id in rules_map: rule = rules_map[item.product_id] product = products_map.get(item.product_id) product_attrs = {} @@ -251,7 +251,6 @@ class OrderService: product_attrs["default_width_m"] = float(product.default_width_m) user_inputs = {} - # 优先使用已存储的 length_m/width_m,否则从 demand_specification 解析 lm = getattr(item, "length_m", None) wm = getattr(item, "width_m", None) if lm and wm: diff --git a/frontend/web-admin/src/views/OrdersPage.vue b/frontend/web-admin/src/views/OrdersPage.vue index ad8ae78..600d58b 100644 --- a/frontend/web-admin/src/views/OrdersPage.vue +++ b/frontend/web-admin/src/views/OrdersPage.vue @@ -350,6 +350,7 @@ style="margin-top: 4px;"/> + u === "m" ? v : u === "mm" ? v / 1000 : v / 100; const m1 = toM(v1, u1); const m2 = toM(v2, u2); + row.length_m = m2; + row.width_m = m1; const area = m1 * m2; row._demandResult = `${area.toFixed(4)} m²`; row._demandCalcHint = `${v1}${u1} × ${v2}${u2} = ${m1}m × ${m2}m = ${area.toFixed(4)}m²`;