订单详情:标记支付并生效的治理安全阀提示

This commit is contained in:
萝卜
2026-03-11 08:43:22 +00:00
parent 87df857d4d
commit f9b3af82b3
2 changed files with 125 additions and 0 deletions

View File

@@ -129,6 +129,15 @@
$canMarkPaid = ($order->payment_status !== 'paid') || ($order->status !== 'activated');
$syncError = data_get($order->meta, 'subscription_activation_error.message');
$syncErrorAt = data_get($order->meta, 'subscription_activation_error.at');
// 治理提示:标记支付并生效的安全阀(后端也会阻断)
$refundTotal = (float) $order->refundTotal();
$receiptTotal = (float) $order->receiptTotal();
$expectedPaid = (float) (((float) ($order->paid_amount ?? 0)) > 0 ? (float) $order->paid_amount : (float) ($order->payable_amount ?? 0));
$receiptCents = (int) round($receiptTotal * 100);
$expectedCents = (int) round($expectedPaid * 100);
$markPaidBlockedByRefund = $refundTotal > 0;
$markPaidBlockedByReceiptMismatch = $receiptCents > 0 && abs($receiptCents - $expectedCents) >= 1;
@endphp
<div style="margin-top:16px; display:flex; gap:12px; flex-wrap:wrap; align-items:center;">
@@ -137,6 +146,12 @@
<button type="submit" @disabled(! $canMarkPaid)>标记支付并生效</button>
</form>
@if($markPaidBlockedByRefund)
<div class="muted text-danger" style="margin-top:6px; width:100%;">提示:当前订单已存在退款记录/退款汇总,建议先核对退款轨迹与状态后再进行「标记支付并生效」。</div>
@elseif($markPaidBlockedByReceiptMismatch)
<div class="muted text-danger" style="margin-top:6px; width:100%;">提示:当前订单已存在支付回执,但回执总额与订单金额不一致,建议先补齐/修正回执后再进行「标记支付并生效」。</div>
@endif
<form method="post" action="/admin/platform-orders/{{ $order->id }}/activate-subscription" onsubmit="return confirm('确认同步订阅?将根据该订单创建/续期订阅');">
@csrf
<button type="submit" @disabled(! $canActivate || $alreadySynced)>{{ $alreadySynced ? '已同步' : '同步订阅' }}</button>