From 002fe59e1dfaa9166aec0e817832a3050fa58944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Tue, 17 Mar 2026 02:09:30 +0800 Subject: [PATCH] Dashboard: add platform order governance mini bars for persuasion --- resources/views/admin/dashboard.blade.php | 39 +++++++++++++++++++ ...rderGovernanceMiniBarsShouldRenderTest.php | 36 +++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 tests/Feature/AdminDashboardPlatformOrderGovernanceMiniBarsShouldRenderTest.php diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index db8fa58..9b3b8c8 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -271,6 +271,45 @@ 对账不一致({{ (int) ($stats['platform_orders_reconcile_mismatch'] ?? 0) }}) 退款不一致({{ (int) ($stats['platform_orders_refund_inconsistent'] ?? 0) }}) + + @php + $poTotal = (int) ($stats['platform_orders'] ?? 0); + $poSyncFailed = (int) ($stats['platform_orders_sync_failed'] ?? 0); + $poNoReceipt = (int) ($stats['platform_orders_paid_no_receipt'] ?? 0); + $poRenewalMissing = (int) ($stats['platform_orders_renewal_missing_subscription'] ?? 0); + + $poSyncFailedPct = $poTotal > 0 ? min(100, max(0, round(($poSyncFailed / $poTotal) * 100, 1))) : 0; + $poNoReceiptPct = $poTotal > 0 ? min(100, max(0, round(($poNoReceipt / $poTotal) * 100, 1))) : 0; + $poRenewalMissingPct = $poTotal > 0 ? min(100, max(0, round(($poRenewalMissing / $poTotal) * 100, 1))) : 0; + @endphp + +
+
治理风险占比(相对平台订单总量 {{ $poTotal }})
+ +
+
同步失败
+
+ +
+
{{ $poSyncFailedPct }}%
+
+ +
+
无回执
+
+ +
+
{{ $poNoReceiptPct }}%
+
+ +
+
续费缺订阅
+
+ +
+
{{ $poRenewalMissingPct }}%
+
+
diff --git a/tests/Feature/AdminDashboardPlatformOrderGovernanceMiniBarsShouldRenderTest.php b/tests/Feature/AdminDashboardPlatformOrderGovernanceMiniBarsShouldRenderTest.php new file mode 100644 index 0000000..37742d1 --- /dev/null +++ b/tests/Feature/AdminDashboardPlatformOrderGovernanceMiniBarsShouldRenderTest.php @@ -0,0 +1,36 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_dashboard_should_render_platform_order_governance_mini_bars(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + $this->assertStringContainsString('data-role="dashboard-po-governance-bars"', $html); + $this->assertStringContainsString('data-role="dashboard-po-sync-failed-bar"', $html); + $this->assertStringContainsString('data-role="dashboard-po-no-receipt-bar"', $html); + $this->assertStringContainsString('data-role="dashboard-po-renewal-missing-bar"', $html); + } +}