refactor: platform order show uses model refundTotal/isRefundInconsistent
This commit is contained in:
@@ -61,16 +61,10 @@
|
||||
}
|
||||
|
||||
$refundCount = (int) (data_get($order->meta, 'refund_summary.count') ?? 0);
|
||||
$refundTotal = (float) (data_get($order->meta, 'refund_summary.total_amount') ?? 0);
|
||||
$refundTotal = (float) $order->refundTotal();
|
||||
if ($refundCount <= 0) {
|
||||
$refundCount = count($refundReceiptsRaw);
|
||||
}
|
||||
if ($refundTotal <= 0) {
|
||||
$refundTotal = 0.0;
|
||||
foreach ($refundReceiptsRaw as $r) {
|
||||
$refundTotal += (float) (data_get($r, 'amount') ?? 0);
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<tr><th>回执数 / 回执总额</th><td>{{ $receiptCount }} / ¥{{ number_format($receiptTotal, 2) }}</td></tr>
|
||||
<tr><th>退款笔数 / 退款总额</th><td>{{ $refundCount }} / ¥{{ number_format($refundTotal, 2) }}</td></tr>
|
||||
@@ -90,6 +84,9 @@
|
||||
$canFixRefundedButNotEnough = $paidAmountFloat > 0
|
||||
&& $order->payment_status === 'refunded'
|
||||
&& (round($refundTotal * 100) + 1) < round($paidAmountFloat * 100);
|
||||
|
||||
// 统一口径:与 refund_inconsistent 筛选一致(模型方法)
|
||||
$isRefundInconsistent = (bool) $order->isRefundInconsistent();
|
||||
@endphp
|
||||
@if($canMarkRefunded || $canFixRefundedButNotEnough)
|
||||
<div class="card refund-governance-block">
|
||||
@@ -124,11 +121,13 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($order->payment_status === 'refunded' && ($refundTotal + 0.01) < $paidAmountFloat)
|
||||
@if($isRefundInconsistent)
|
||||
@if($order->payment_status === 'refunded')
|
||||
<div class="muted text-danger" style="margin-top:10px;">提示:当前订单状态为「已退款」,但退款总额小于已付金额,可能存在数据不一致,请核对退款轨迹与订单金额。</div>
|
||||
@elseif($order->payment_status !== 'refunded' && $paidAmountFloat > 0 && $refundTotal >= $paidAmountFloat)
|
||||
@else
|
||||
<div class="muted text-danger" style="margin-top:10px;">提示:退款总额已达到/超过已付金额,建议核对是否应将支付状态调整为「已退款」。</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@php
|
||||
$canActivate = ($order->payment_status === 'paid') && ($order->status === 'activated');
|
||||
|
||||
Reference in New Issue
Block a user