平台订单:提供手动标记已退款治理动作
This commit is contained in:
@@ -580,6 +580,39 @@ class PlatformOrderController extends Controller
|
||||
return redirect()->back()->with('success', '已追加退款记录(用于退款轨迹留痕)。');
|
||||
}
|
||||
|
||||
public function markRefunded(Request $request, PlatformOrder $order): RedirectResponse
|
||||
{
|
||||
$admin = $this->ensurePlatformAdmin($request);
|
||||
|
||||
if ((float) ($order->paid_amount ?? 0) <= 0) {
|
||||
return redirect()->back()->with('warning', '当前订单已付金额为 0,无法标记为已退款。');
|
||||
}
|
||||
|
||||
if ((string) $order->payment_status === 'refunded') {
|
||||
return redirect()->back()->with('warning', '当前订单已是已退款状态,无需重复操作。');
|
||||
}
|
||||
|
||||
$now = now();
|
||||
$order->payment_status = 'refunded';
|
||||
$order->refunded_at = $order->refunded_at ?: $now;
|
||||
|
||||
$meta = (array) ($order->meta ?? []);
|
||||
$audit = (array) (data_get($meta, 'audit', []) ?? []);
|
||||
$audit[] = [
|
||||
'action' => 'mark_refunded',
|
||||
'scope' => 'single',
|
||||
'at' => $now->toDateTimeString(),
|
||||
'admin_id' => $admin->id,
|
||||
'note' => '手动标记为已退款(仅修正支付状态,不自动写退款回执)',
|
||||
];
|
||||
data_set($meta, 'audit', $audit);
|
||||
|
||||
$order->meta = $meta;
|
||||
$order->save();
|
||||
|
||||
return redirect()->back()->with('success', '已将订单支付状态标记为已退款(未自动写入退款回执)。');
|
||||
}
|
||||
|
||||
public function markActivated(Request $request, PlatformOrder $order): RedirectResponse
|
||||
{
|
||||
$admin = $this->ensurePlatformAdmin($request);
|
||||
|
||||
Reference in New Issue
Block a user