admin: 平台订单列表行级BMPA按钮命中治理阻断时禁用(对账/退款/续费缺订阅)

This commit is contained in:
萝卜
2026-03-17 23:25:28 +08:00
parent 80fc06302e
commit a4040749aa

View File

@@ -1780,11 +1780,19 @@
$syncErrorAt = data_get($order->meta, 'subscription_activation_error.at');
@endphp
@php
$canMarkPaid = ($order->payment_status !== 'paid') || ($order->status !== 'activated');
// 精简视图也要可达的“治理入口”不要只依赖可选列col-optional里的提示
$needReconcileFix = (bool) $order->isReconcileMismatch();
$needRefundFix = (bool) $order->isRefundInconsistent();
// 行级 BMPA 安全阀(列表页也应禁用,避免运营误触):
// - 对账不一致/退款不一致:需先治理
// - 续费缺订阅:需先绑定订阅
$blockedByMissingSubscriptionOnRenewal = ((string) ($order->order_type ?? '') === 'renewal') && ((int) ($order->site_subscription_id ?? 0) <= 0);
$markPaidBlockedByGovernance = $needReconcileFix || $needRefundFix || $blockedByMissingSubscriptionOnRenewal;
// 仅当订单尚未处于 paid+activated 时,且未命中治理阻断时,才允许点击
$canMarkPaid = ((($order->payment_status !== 'paid') || ($order->status !== 'activated')) && (! $markPaidBlockedByGovernance));
// 精简视图也要可达的“治理入口”不要只依赖可选列col-optional里的提示
$reconcileFixUrlCompact = \App\Support\BackUrl::withBackAndFragment('/admin/platform-orders/' . $order->id, $selfWithoutBack, 'add-payment-receipt');
$refundFixUrlCompact = \App\Support\BackUrl::withBackAndFragment('/admin/platform-orders/' . $order->id, $selfWithoutBack, 'add-refund-receipt');
@endphp