diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index 26cd2a9..743dbd5 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -521,6 +521,34 @@ + @php + // 北极星指标图形化:给运营“规模感/健康感”,但不引入额外分类维度。 + $merchantsTotal = (int) ($stats['merchants'] ?? 0); + $pctActivePaidMerchants = $merchantsTotal > 0 ? min(100, max(0, round(($activePaidMerchants / $merchantsTotal) * 100, 1))) : 0; + @endphp + +
+
北极星指标(图形化)
+ + +
付费渗透
+
+ +
+
{{ $pctActivePaidMerchants }}%({{ $activePaidMerchants }})
+
+ + +
续费成功率
+
+ +
+
{{ $renewalRate30d }}%
+
+ +
说明:付费渗透 = 活跃付费站点 / 站点总数;续费成功率按近30天续费单计算。
+
+ @php $den = max(1, $ordersTotal7d); $pctUnpaidPending = $den > 0 ? min(100, max(0, round(($funnelUnpaidPending7d / $den) * 100, 1))) : 0; diff --git a/tests/Feature/AdminDashboardPlatformOpsOverviewNorthStarMiniBarsShouldRenderTest.php b/tests/Feature/AdminDashboardPlatformOpsOverviewNorthStarMiniBarsShouldRenderTest.php new file mode 100644 index 0000000..04bf9e9 --- /dev/null +++ b/tests/Feature/AdminDashboardPlatformOpsOverviewNorthStarMiniBarsShouldRenderTest.php @@ -0,0 +1,35 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_dashboard_platform_ops_overview_should_render_northstar_mini_bars(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + $this->assertStringContainsString('data-role="platform-ops-northstar-bars"', $html); + $this->assertStringContainsString('data-role="ops-northstar-active-paid-merchants-bar"', $html); + $this->assertStringContainsString('data-role="ops-northstar-renewal-rate-bar"', $html); + } +}