diff --git a/app/Http/Controllers/Admin/PlatformOrderController.php b/app/Http/Controllers/Admin/PlatformOrderController.php index ca25f0b..cabaffa 100644 --- a/app/Http/Controllers/Admin/PlatformOrderController.php +++ b/app/Http/Controllers/Admin/PlatformOrderController.php @@ -611,6 +611,8 @@ class PlatformOrderController extends Controller '最近退款金额', '最近退款渠道', '退款总额', + '回执总额', + '对账差额', ]; if ($includeMeta) { @@ -677,6 +679,28 @@ class PlatformOrderController extends Controller } return $total; })(), + (function () use ($order, $receipts) { + // 回执总额:优先读 payment_summary.total_amount;缺省回退遍历 payment_receipts[].amount + $t = (float) (data_get($order->meta, 'payment_summary.total_amount') ?? 0); + if ($t > 0) { + return $t; + } + + $sum = 0.0; + foreach ($receipts as $r) { + $sum += (float) (data_get($r, 'amount') ?? 0); + } + return $sum; + })(), + (function () use ($order, $receipts) { + $receiptTotal = (float) (data_get($order->meta, 'payment_summary.total_amount') ?? 0); + if ($receiptTotal <= 0) { + foreach ($receipts as $r) { + $receiptTotal += (float) (data_get($r, 'amount') ?? 0); + } + } + return (float) $receiptTotal - (float) ($order->paid_amount ?? 0); + })(), ]; if ($includeMeta) {