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