feat(platform-orders): 摘要卡增加有退款/无退款订单数(含测试)

This commit is contained in:
萝卜
2026-03-11 00:07:50 +00:00
parent 5a060131f6
commit b3676729ee
3 changed files with 108 additions and 0 deletions

View File

@@ -294,6 +294,16 @@ class PlatformOrderController extends Controller
->whereRaw("JSON_EXTRACT(meta, '$.payment_summary.total_amount') IS NULL")
->whereRaw("JSON_EXTRACT(meta, '$.payment_receipts[0].amount') IS NULL")
->count(),
'refund_orders' => (clone $baseQuery)
->where(function (Builder $q) {
$q->whereRaw("JSON_EXTRACT(meta, '$.refund_summary.total_amount') IS NOT NULL")
->orWhereRaw("JSON_EXTRACT(meta, '$.refund_receipts[0].amount') IS NOT NULL");
})
->count(),
'no_refund_orders' => (clone $baseQuery)
->whereRaw("JSON_EXTRACT(meta, '$.refund_summary.total_amount') IS NULL")
->whereRaw("JSON_EXTRACT(meta, '$.refund_receipts[0].amount') IS NULL")
->count(),
'total_receipt_amount' => $totalReceiptAmount,
// 对账差额:回执总额 - 订单已付总额(当前筛选范围)
'reconciliation_delta' => (float) ($totalReceiptAmount - $totalPaidAmount),