diff --git a/app/Http/Controllers/Admin/PlatformOrderController.php b/app/Http/Controllers/Admin/PlatformOrderController.php index f071585..28daff7 100644 --- a/app/Http/Controllers/Admin/PlatformOrderController.php +++ b/app/Http/Controllers/Admin/PlatformOrderController.php @@ -1900,6 +1900,11 @@ class PlatformOrderController extends Controller return redirect()->back()->with('warning', '当前筛选为「有退款」订单集合。为避免带退款订单直接批量生效,请先完成退款治理(核对退款回执/修正状态)后再执行。'); } + // 治理优先:当筛选集合为「有退款」时,不允许直接批量生效 + if ((string) ($filters['refund_status'] ?? '') === 'has') { + return redirect()->back()->with('warning', '当前筛选为「有退款」订单集合。为避免带退款订单被批量推进,请先完成退款治理(核对退款回执/修正状态)后再执行批量仅标记为已生效。'); + } + // 治理优先:当筛选集合命中“对账不一致/退款不一致”时,不允许直接批量生效 if ((string) ($filters['reconcile_mismatch'] ?? '') === '1' || (string) ($filters['refund_inconsistent'] ?? '') === '1') { return redirect()->back()->with('warning', '当前筛选集合包含「对账不一致/退款不一致」订单,为避免带病推进,请先完成金额/状态治理(补回执/核对退款/修正状态)后再执行批量仅标记为已生效。'); diff --git a/app/Support/PlatformOrderToolsGuard.php b/app/Support/PlatformOrderToolsGuard.php index 13a033b..1cbf7f0 100644 --- a/app/Support/PlatformOrderToolsGuard.php +++ b/app/Support/PlatformOrderToolsGuard.php @@ -142,6 +142,9 @@ class PlatformOrderToolsGuard if ((string) ($filters['refund_status'] ?? '') === 'has') { return '当前集合为「有退款」:为避免带退款订单直接批量生效,请先完成退款治理(核对退款回执/修正状态)后再执行。'; } + if ((string) ($filters['refund_status'] ?? '') === 'has') { + return '当前集合为「有退款」:为避免带退款订单被批量推进,请先完成退款治理(核对退款回执/修正状态)后再批量生效。'; + } if (((string) ($filters['reconcile_mismatch'] ?? '') === '1') || ((string) ($filters['refund_inconsistent'] ?? '') === '1')) { return '当前集合包含「对账不一致/退款不一致」治理集合:建议先完成金额/状态治理(补回执/核对退款/修正状态)后再批量生效。'; } diff --git a/tests/Feature/AdminPlatformOrderBatchMarkActivatedShouldBlockWhenRefundStatusHasTest.php b/tests/Feature/AdminPlatformOrderBatchMarkActivatedShouldBlockWhenRefundStatusHasTest.php index 815eb1d..90db71f 100644 --- a/tests/Feature/AdminPlatformOrderBatchMarkActivatedShouldBlockWhenRefundStatusHasTest.php +++ b/tests/Feature/AdminPlatformOrderBatchMarkActivatedShouldBlockWhenRefundStatusHasTest.php @@ -19,7 +19,7 @@ class AdminPlatformOrderBatchMarkActivatedShouldBlockWhenRefundStatusHasTest ext ])->assertRedirect('/admin'); } - public function test_batch_mark_activated_should_block_when_refund_status_has_is_set(): void + public function test_batch_mark_activated_should_block_when_refund_status_has_present(): void { $this->loginAsPlatformAdmin();