From 9fafba95cc5d0c6654f1c602f5d4f1819f3b6c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Mon, 20 Jul 2026 14:30:36 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=96=B0=E5=A2=9E=E8=8D=AF=E5=93=81?= =?UTF-8?q?=E7=9A=84ERP=E6=8A=93=E5=8F=96=E6=95=B0=E9=87=8F=E5=80=8D?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/modules/v1/controllers/ErpController.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/platform/modules/v1/controllers/ErpController.php b/platform/modules/v1/controllers/ErpController.php index 7c4b780..228ef53 100644 --- a/platform/modules/v1/controllers/ErpController.php +++ b/platform/modules/v1/controllers/ErpController.php @@ -219,11 +219,18 @@ class ErpController extends Controller $factor = $drugFactorMap[$drugId] ?? 1; $originQty = (int) ($item['number'] ?? 0); $erpQty = (int) round($originQty * $factor); + $scale = 2; // 金额一般保留 2 位小数 + $buyPrice = $item['buy_price']; + if (bccomp($factor, '1', $scale) === 1) { + $erpPaymentPrice = bcdiv($buyPrice, $factor, $scale); + } else { + $erpPaymentPrice = $buyPrice; + } return [ 'detailId' => $item['id'], 'productSku' => $item['drug_no'], 'quantity' => $erpQty, - 'paymentPrice' => $item['buy_price'], + 'paymentPrice' => $erpPaymentPrice, 'price' => round($originQty * $item['buy_price'], 2), ]; }