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, ], ], ]);