diff --git a/resources/views/admin/platform_orders/show.blade.php b/resources/views/admin/platform_orders/show.blade.php index 9f1d62c..e4a522a 100644 --- a/resources/views/admin/platform_orders/show.blade.php +++ b/resources/views/admin/platform_orders/show.blade.php @@ -44,16 +44,36 @@ 生效时间{{ optional($order->activated_at)->format('Y-m-d H:i:s') ?: '-' }} 退款时间{{ optional($order->refunded_at)->format('Y-m-d H:i:s') ?: '-' }} @php - // 退款总额口径:优先读扁平字段 meta.refund_summary.total_amount(与列表/导出口径一致);缺省回退汇总 refund_receipts[].amount + // 统一口径:优先读扁平字段 payment_summary/refund_summary(与列表/导出口径一致);缺省回退遍历 receipts + $paymentReceiptsRaw = (array) (data_get($order->meta, 'payment_receipts', []) ?? []); + $refundReceiptsRaw = (array) (data_get($order->meta, 'refund_receipts', []) ?? []); + + $receiptCount = (int) (data_get($order->meta, 'payment_summary.count') ?? 0); + $receiptTotal = (float) (data_get($order->meta, 'payment_summary.total_amount') ?? 0); + if ($receiptCount <= 0) { + $receiptCount = count($paymentReceiptsRaw); + } + if ($receiptTotal <= 0) { + $receiptTotal = 0.0; + foreach ($paymentReceiptsRaw as $r) { + $receiptTotal += (float) (data_get($r, 'amount') ?? 0); + } + } + + $refundCount = (int) (data_get($order->meta, 'refund_summary.count') ?? 0); $refundTotal = (float) (data_get($order->meta, 'refund_summary.total_amount') ?? 0); + if ($refundCount <= 0) { + $refundCount = count($refundReceiptsRaw); + } if ($refundTotal <= 0) { $refundTotal = 0.0; - foreach ((array) (data_get($order->meta, 'refund_receipts', []) ?? []) as $r) { + foreach ($refundReceiptsRaw as $r) { $refundTotal += (float) (data_get($r, 'amount') ?? 0); } } @endphp - 退款总额¥{{ number_format($refundTotal, 2) }} + 回执数 / 回执总额{{ $receiptCount }} / ¥{{ number_format($receiptTotal, 2) }} + 退款笔数 / 退款总额{{ $refundCount }} / ¥{{ number_format($refundTotal, 2) }}