From 3fad02087e1bab46ebfb4886d3fbb5ed3006ba75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sat, 14 Mar 2026 12:26:32 +0000 Subject: [PATCH] platform_orders index: compact view keeps governance fix links reachable --- public/css/admin-components.css | 4 + .../admin/platform_orders/index.blade.php | 25 +++++ ...tViewGovernanceHintsStillReachableTest.php | 101 ++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 tests/Feature/AdminPlatformOrderIndexCompactViewGovernanceHintsStillReachableTest.php diff --git a/public/css/admin-components.css b/public/css/admin-components.css index 4f65a35..fd2ac7b 100644 --- a/public/css/admin-components.css +++ b/public/css/admin-components.css @@ -85,3 +85,7 @@ /* 平台订单列表:精简视图(默认隐藏部分列,避免列表过长) */ .platform-orders-table .col-optional{display:none;} .platform-orders-table.is-full .col-optional{display:table-cell;} + +/* 平台订单列表:精简视图也要可达的治理提示(对账/退款不一致) */ +.platform-orders-table .governance-hints{margin-bottom:6px;} +.platform-orders-table .governance-hint{line-height:1.4;} diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index 1c96fe6..abe813c 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -1296,8 +1296,33 @@ @endphp @php $canMarkPaid = ($order->payment_status !== 'paid') || ($order->status !== 'activated'); + + // 精简视图也要可达的“治理入口”:不要只依赖可选列(col-optional)里的提示 + $needReconcileFix = (bool) $order->isReconcileMismatch(); + $needRefundFix = (bool) $order->isRefundInconsistent(); + $reconcileFixUrlCompact = '/admin/platform-orders/' . $order->id . '?' . \Illuminate\Support\Arr::query(['back' => $selfWithoutBack]) . '#add-payment-receipt'; + $refundFixUrlCompact = '/admin/platform-orders/' . $order->id . '?' . \Illuminate\Support\Arr::query(['back' => $selfWithoutBack]) . '#refund-receipts'; @endphp + @if($needReconcileFix || $needRefundFix) +
+ @if($needReconcileFix) +
+ 对账不一致 + + 去补回执 +
+ @endif + @if($needRefundFix) +
+ 退款不一致 + + 去核对退款 +
+ @endif +
+ @endif +
@csrf diff --git a/tests/Feature/AdminPlatformOrderIndexCompactViewGovernanceHintsStillReachableTest.php b/tests/Feature/AdminPlatformOrderIndexCompactViewGovernanceHintsStillReachableTest.php new file mode 100644 index 0000000..27a262b --- /dev/null +++ b/tests/Feature/AdminPlatformOrderIndexCompactViewGovernanceHintsStillReachableTest.php @@ -0,0 +1,101 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_compact_view_still_shows_fix_links_for_reconcile_and_refund_inconsistent_orders(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + + $plan = Plan::query()->create([ + 'code' => 'compact_view_governance_hints_test', + 'name' => '精简视图治理入口测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $reconcileOrder = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_COMPACT_GOV_RECON_0001', + 'order_type' => 'new_purchase', + 'status' => 'activated', + 'payment_status' => 'paid', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 10, + 'paid_amount' => 10, + 'placed_at' => now(), + 'paid_at' => now(), + 'activated_at' => now(), + 'meta' => [ + 'payment_summary' => [ + 'count' => 1, + 'total_amount' => 9.98, + ], + ], + ]); + + $refundOrder = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_COMPACT_GOV_REFUND_0001', + 'order_type' => 'new_purchase', + 'status' => 'activated', + 'payment_status' => 'refunded', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 10, + 'paid_amount' => 10, + 'placed_at' => now(), + 'paid_at' => now(), + 'activated_at' => now(), + 'refunded_at' => now(), + 'meta' => [ + 'refund_summary' => [ + 'count' => 1, + 'total_amount' => 9.98, + ], + ], + ]); + + // 默认即为精简视图:确保治理入口不依赖 col-optional 列依然可达 + $backEncoded = rawurlencode('/admin/platform-orders'); + + $this->get('/admin/platform-orders') + ->assertOk() + ->assertSee('/admin/platform-orders/' . $reconcileOrder->id . '?back=' . $backEncoded . '#add-payment-receipt', false) + ->assertSee('去补回执') + ->assertSee('/admin/platform-orders/' . $refundOrder->id . '?back=' . $backEncoded . '#refund-receipts', false) + ->assertSee('去核对退款'); + } +}