平台订单导出:回执/退款总额与对账差额复用模型口径
This commit is contained in:
@@ -890,40 +890,9 @@ class PlatformOrderController extends Controller
|
||||
(string) (data_get($latestRefund, 'refunded_at') ?? ''),
|
||||
(float) (data_get($latestRefund, 'amount') ?? 0),
|
||||
(string) (data_get($latestRefund, 'channel') ?? ''),
|
||||
(function () use ($order, $refunds) {
|
||||
$summaryTotal = data_get($order->meta, 'refund_summary.total_amount');
|
||||
if ($summaryTotal !== null) {
|
||||
return (float) $summaryTotal;
|
||||
}
|
||||
|
||||
$total = 0.0;
|
||||
foreach ($refunds as $r) {
|
||||
$total += (float) (data_get($r, 'amount') ?? 0);
|
||||
}
|
||||
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);
|
||||
})(),
|
||||
(float) $order->refundTotal(),
|
||||
(float) $order->receiptTotal(),
|
||||
(float) $order->receiptTotal() - (float) ($order->paid_amount ?? 0),
|
||||
];
|
||||
|
||||
if ($includeMeta) {
|
||||
|
||||
Reference in New Issue
Block a user