feat(platform-orders): 新增退款轨迹筛选 refund_status(含UI/导出/批量透传/测试)
This commit is contained in:
@@ -140,6 +140,8 @@ class PlatformOrderController extends Controller
|
||||
'reconcile_mismatch' => (string) $request->query('reconcile_mismatch', ''),
|
||||
// 支付回执筛选:has(有回执)/none(无回执)
|
||||
'receipt_status' => trim((string) $request->query('receipt_status', '')),
|
||||
// 退款轨迹筛选:has(有退款)/none(无退款)
|
||||
'refund_status' => trim((string) $request->query('refund_status', '')),
|
||||
];
|
||||
|
||||
|
||||
@@ -591,6 +593,8 @@ class PlatformOrderController extends Controller
|
||||
'reconcile_mismatch' => (string) $request->query('reconcile_mismatch', ''),
|
||||
// 支付回执筛选:has(有回执)/none(无回执)
|
||||
'receipt_status' => trim((string) $request->query('receipt_status', '')),
|
||||
// 退款轨迹筛选:has(有退款)/none(无退款)
|
||||
'refund_status' => trim((string) $request->query('refund_status', '')),
|
||||
];
|
||||
|
||||
|
||||
@@ -771,6 +775,7 @@ class PlatformOrderController extends Controller
|
||||
'batch_mark_activated_24h' => (string) $request->input('batch_mark_activated_24h', ''),
|
||||
'reconcile_mismatch' => (string) $request->input('reconcile_mismatch', ''),
|
||||
'receipt_status' => trim((string) $request->input('receipt_status', '')),
|
||||
'refund_status' => trim((string) $request->input('refund_status', '')),
|
||||
];
|
||||
|
||||
// 防误操作:批量同步默认要求先勾选“只看可同步”,避免无意识扩大处理范围
|
||||
@@ -901,6 +906,7 @@ class PlatformOrderController extends Controller
|
||||
'batch_mark_activated_24h' => (string) $request->input('batch_mark_activated_24h', ''),
|
||||
'reconcile_mismatch' => (string) $request->input('reconcile_mismatch', ''),
|
||||
'receipt_status' => trim((string) $request->input('receipt_status', '')),
|
||||
'refund_status' => trim((string) $request->input('refund_status', '')),
|
||||
];
|
||||
|
||||
// 防误操作:批量“仅标记为已生效”默认要求当前筛选口径为「已支付 + 待处理(pending)」
|
||||
@@ -1009,6 +1015,7 @@ class PlatformOrderController extends Controller
|
||||
'batch_mark_activated_24h' => (string) $request->input('batch_mark_activated_24h', ''),
|
||||
'reconcile_mismatch' => (string) $request->input('reconcile_mismatch', ''),
|
||||
'receipt_status' => trim((string) $request->input('receipt_status', '')),
|
||||
'refund_status' => trim((string) $request->input('refund_status', '')),
|
||||
];
|
||||
|
||||
$query = PlatformOrder::query()
|
||||
@@ -1168,6 +1175,22 @@ class PlatformOrderController extends Controller
|
||||
$builder->whereRaw("JSON_EXTRACT(meta, '$.payment_summary.total_amount') IS NULL")
|
||||
->whereRaw("JSON_EXTRACT(meta, '$.payment_receipts[0].amount') IS NULL");
|
||||
}
|
||||
})
|
||||
->when(($filters['refund_status'] ?? '') !== '', function (Builder $builder) use ($filters) {
|
||||
// 退款轨迹筛选:
|
||||
// - has:有退款(refund_summary.total_amount 存在 或 refund_receipts[0].amount 存在)
|
||||
// - none:无退款(两者都不存在)
|
||||
$status = (string) ($filters['refund_status'] ?? '');
|
||||
|
||||
if ($status === 'has') {
|
||||
$builder->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");
|
||||
});
|
||||
} elseif ($status === 'none') {
|
||||
$builder->whereRaw("JSON_EXTRACT(meta, '$.refund_summary.total_amount') IS NULL")
|
||||
->whereRaw("JSON_EXTRACT(meta, '$.refund_receipts[0].amount') IS NULL");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user