feat(platform-orders): 列表/导出退款统计优先读 refund_summary(含测试)

This commit is contained in:
萝卜
2026-03-11 00:27:58 +00:00
parent 9b136e6df8
commit 80b218bbfb
3 changed files with 91 additions and 7 deletions

View File

@@ -585,7 +585,8 @@
<td>
@php
$refunds = (array) (data_get($order->meta, 'refund_receipts', []) ?? []);
$refundCount = count($refunds);
$refundSummaryCount = data_get($order->meta, 'refund_summary.count');
$refundCount = $refundSummaryCount !== null ? (int) $refundSummaryCount : count($refunds);
@endphp
@if($refundCount > 0)
<a href="/admin/platform-orders/{{ $order->id }}" class="muted">{{ $refundCount }}</a>
@@ -595,9 +596,14 @@
</td>
<td>
@php
$refundTotal = 0.0;
foreach ($refunds as $r) {
$refundTotal += (float) (data_get($r, 'amount') ?? 0);
$refundSummaryTotal = data_get($order->meta, 'refund_summary.total_amount');
if ($refundSummaryTotal !== null) {
$refundTotal = (float) $refundSummaryTotal;
} else {
$refundTotal = 0.0;
foreach ($refunds as $r) {
$refundTotal += (float) (data_get($r, 'amount') ?? 0);
}
}
@endphp
@if($refundTotal > 0)