feat(platform-orders): 导出CSV增加回执总额与对账差额
This commit is contained in:
@@ -611,6 +611,8 @@ class PlatformOrderController extends Controller
|
|||||||
'最近退款金额',
|
'最近退款金额',
|
||||||
'最近退款渠道',
|
'最近退款渠道',
|
||||||
'退款总额',
|
'退款总额',
|
||||||
|
'回执总额',
|
||||||
|
'对账差额',
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($includeMeta) {
|
if ($includeMeta) {
|
||||||
@@ -677,6 +679,28 @@ class PlatformOrderController extends Controller
|
|||||||
}
|
}
|
||||||
return $total;
|
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) {
|
if ($includeMeta) {
|
||||||
|
|||||||
Reference in New Issue
Block a user