From 485b69857e472e6a32f63dbf2c452a6e68c218f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Fri, 13 Mar 2026 16:15:16 +0000 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=AE=A2=E5=8D=95=E8=AF=A6?= =?UTF-8?q?=E6=83=85=EF=BC=9A=E9=80=80=E6=AC=BE=E6=B2=BB=E7=90=86=E5=8C=BA?= =?UTF-8?q?=E5=9D=97=E6=8C=89=20amounts.tolerance=20=E5=8F=A3=E5=BE=84?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E5=B9=B6=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/admin/platform_orders/show.blade.php | 12 ++++++++---- ...latformOrderShowRefundGovernanceBlockLinkTest.php | 2 +- ...latformOrderShowRefundGovernanceBlockNoteTest.php | 2 +- ...minPlatformOrderShowRefundGovernanceBlockTest.php | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/resources/views/admin/platform_orders/show.blade.php b/resources/views/admin/platform_orders/show.blade.php index a5bc474..1c57d22 100644 --- a/resources/views/admin/platform_orders/show.blade.php +++ b/resources/views/admin/platform_orders/show.blade.php @@ -68,16 +68,20 @@ @php $paidAmountFloat = (float) ($order->paid_amount ?? 0); + $tol = (float) config('saasshop.amounts.tolerance', 0.01); + $tolCents = (int) round($tol * 100); + $tolCents = max(1, $tolCents); + // 若订单疑似退款不一致: - // - 非 refunded 但退款总额已达/超已付 => 给出“可一键标记为已退款”的治理动作(不自动写回执) + // - 非 refunded 但退款总额已达/超已付 + 容差 => 给出“可一键标记为已退款”的治理动作(不自动写回执) $canMarkRefunded = $paidAmountFloat > 0 && $order->payment_status !== 'refunded' - && round($refundTotal * 100) >= round($paidAmountFloat * 100); + && round($refundTotal * 100) >= (round($paidAmountFloat * 100) + $tolCents); - // - refunded 但退款总额不足 => 提供降级动作:标记为部分退款/已支付(仍不自动写回执) + // - refunded 但退款总额 + 容差 < 已付 => 提供降级动作:标记为部分退款/已支付(仍不自动写回执) $canFixRefundedButNotEnough = $paidAmountFloat > 0 && $order->payment_status === 'refunded' - && (round($refundTotal * 100) + 1) < round($paidAmountFloat * 100); + && (round($refundTotal * 100) + $tolCents) < round($paidAmountFloat * 100); // 统一口径:与 refund_inconsistent 筛选一致(模型方法) $isRefundInconsistent = (bool) $order->isRefundInconsistent(); diff --git a/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockLinkTest.php b/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockLinkTest.php index 2c5a8ba..a0ce0ab 100644 --- a/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockLinkTest.php +++ b/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockLinkTest.php @@ -57,7 +57,7 @@ class AdminPlatformOrderShowRefundGovernanceBlockLinkTest extends TestCase 'meta' => [ 'refund_summary' => [ 'count' => 1, - 'total_amount' => 10.00, + 'total_amount' => 10.01, ], ], ]); diff --git a/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockNoteTest.php b/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockNoteTest.php index d6012fd..07c04fd 100644 --- a/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockNoteTest.php +++ b/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockNoteTest.php @@ -57,7 +57,7 @@ class AdminPlatformOrderShowRefundGovernanceBlockNoteTest extends TestCase 'meta' => [ 'refund_summary' => [ 'count' => 1, - 'total_amount' => 10.00, + 'total_amount' => 10.01, ], ], ]); diff --git a/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockTest.php b/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockTest.php index 7c8611f..a802bb3 100644 --- a/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockTest.php +++ b/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockTest.php @@ -57,7 +57,7 @@ class AdminPlatformOrderShowRefundGovernanceBlockTest extends TestCase 'meta' => [ 'refund_summary' => [ 'count' => 1, - 'total_amount' => 10.00, + 'total_amount' => 10.01, ], ], ]);