ui(dashboard): 平台定位运营版补齐风险预警与更多异常 mini bar
This commit is contained in:
@@ -596,6 +596,73 @@
|
||||
|
||||
<div class="muted muted-xs mt-6">分母:平台订单总量 {{ $poTotalForOps }}(用于规模感,不作为经营口径)。</div>
|
||||
</div>
|
||||
|
||||
@php
|
||||
// 平台健康预警:原因型风险(点进去有明确动作:补回执/对账/核对退款)。
|
||||
$riskNoReceipt = (int) ($stats['platform_orders_paid_no_receipt'] ?? 0);
|
||||
$riskReconcileMismatch = (int) ($stats['platform_orders_reconcile_mismatch'] ?? 0);
|
||||
$riskRefundInconsistent = (int) ($stats['platform_orders_refund_inconsistent'] ?? 0);
|
||||
|
||||
$pctRiskNoReceipt = $poTotalForOps > 0 ? min(100, max(0, round(($riskNoReceipt / $denOps) * 100, 1))) : 0;
|
||||
$pctRiskReconcileMismatch = $poTotalForOps > 0 ? min(100, max(0, round(($riskReconcileMismatch / $denOps) * 100, 1))) : 0;
|
||||
$pctRiskRefundInconsistent = $poTotalForOps > 0 ? min(100, max(0, round(($riskRefundInconsistent / $denOps) * 100, 1))) : 0;
|
||||
|
||||
// 异常积压:点进去要做“治理修复/补关联/重试”。
|
||||
$exBmpaFailed = (int) ($stats['platform_orders_bmpa_failed'] ?? 0);
|
||||
$exRenewalMissing = (int) ($stats['platform_orders_renewal_missing_subscription'] ?? 0);
|
||||
$pctExBmpaFailed = $poTotalForOps > 0 ? min(100, max(0, round(($exBmpaFailed / $denOps) * 100, 1))) : 0;
|
||||
$pctExRenewalMissing = $poTotalForOps > 0 ? min(100, max(0, round(($exRenewalMissing / $denOps) * 100, 1))) : 0;
|
||||
@endphp
|
||||
|
||||
<div class="mt-10" data-role="platform-ops-risk-bars">
|
||||
<div class="muted"><strong>平台健康预警(Top3)</strong></div>
|
||||
<div class="muted muted-xs mt-6">原因型风险:补回执 / 对账 / 核对退款。</div>
|
||||
|
||||
<a class="adm-mini-bar-row adm-mini-bar-row-link mt-6" data-role="ops-risk-no-receipt-row" href="{!! $platformOrdersQuickLinks['paid_no_receipt'] !!}" aria-label="进入无回执订单集合">
|
||||
<div class="adm-mini-bar-label">无回执</div>
|
||||
<div class="adm-mini-bar" data-role="ops-risk-no-receipt-bar" title="{{ $riskNoReceipt }} / {{ $poTotalForOps }}({{ $pctRiskNoReceipt }}%)">
|
||||
<span class="adm-mini-bar-fill" style="width: {{ $pctRiskNoReceipt }}%"></span>
|
||||
</div>
|
||||
<div class="adm-mini-bar-value">{{ $pctRiskNoReceipt }}%({{ $riskNoReceipt }})</div>
|
||||
</a>
|
||||
|
||||
<a class="adm-mini-bar-row adm-mini-bar-row-link mt-6" data-role="ops-risk-reconcile-mismatch-row" href="{!! $platformOrdersQuickLinks['reconcile_mismatch'] !!}" aria-label="进入对账不一致订单集合">
|
||||
<div class="adm-mini-bar-label">对账不一致</div>
|
||||
<div class="adm-mini-bar" data-role="ops-risk-reconcile-mismatch-bar" title="{{ $riskReconcileMismatch }} / {{ $poTotalForOps }}({{ $pctRiskReconcileMismatch }}%)">
|
||||
<span class="adm-mini-bar-fill" style="width: {{ $pctRiskReconcileMismatch }}%"></span>
|
||||
</div>
|
||||
<div class="adm-mini-bar-value">{{ $pctRiskReconcileMismatch }}%({{ $riskReconcileMismatch }})</div>
|
||||
</a>
|
||||
|
||||
<a class="adm-mini-bar-row adm-mini-bar-row-link mt-6" data-role="ops-risk-refund-inconsistent-row" href="{!! $platformOrdersQuickLinks['refund_inconsistent'] !!}" aria-label="进入退款不一致订单集合">
|
||||
<div class="adm-mini-bar-label">退款不一致</div>
|
||||
<div class="adm-mini-bar" data-role="ops-risk-refund-inconsistent-bar" title="{{ $riskRefundInconsistent }} / {{ $poTotalForOps }}({{ $pctRiskRefundInconsistent }}%)">
|
||||
<span class="adm-mini-bar-fill" style="width: {{ $pctRiskRefundInconsistent }}%"></span>
|
||||
</div>
|
||||
<div class="adm-mini-bar-value">{{ $pctRiskRefundInconsistent }}%({{ $riskRefundInconsistent }})</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<details class="mt-10" data-role="platform-ops-exception-bars">
|
||||
<summary class="muted"><strong>更多异常积压(少用)</strong></summary>
|
||||
<div class="muted muted-xs mt-6">异常型治理:批量失败 / 续费缺订阅等。</div>
|
||||
|
||||
<a class="adm-mini-bar-row adm-mini-bar-row-link mt-6" data-role="ops-exception-bmpa-failed-row" href="{!! $platformOrdersQuickLinks['bmpa_failed'] !!}" aria-label="进入BMPA失败订单集合">
|
||||
<div class="adm-mini-bar-label">BMPA失败</div>
|
||||
<div class="adm-mini-bar" data-role="ops-exception-bmpa-failed-bar" title="{{ $exBmpaFailed }} / {{ $poTotalForOps }}({{ $pctExBmpaFailed }}%)">
|
||||
<span class="adm-mini-bar-fill" style="width: {{ $pctExBmpaFailed }}%"></span>
|
||||
</div>
|
||||
<div class="adm-mini-bar-value">{{ $pctExBmpaFailed }}%({{ $exBmpaFailed }})</div>
|
||||
</a>
|
||||
|
||||
<a class="adm-mini-bar-row adm-mini-bar-row-link mt-6" data-role="ops-exception-renewal-missing-row" href="{!! $platformOrdersQuickLinks['renewal_missing_subscription'] !!}" aria-label="进入续费缺订阅订单集合">
|
||||
<div class="adm-mini-bar-label">续费缺订阅</div>
|
||||
<div class="adm-mini-bar" data-role="ops-exception-renewal-missing-bar" title="{{ $exRenewalMissing }} / {{ $poTotalForOps }}({{ $pctExRenewalMissing }}%)">
|
||||
<span class="adm-mini-bar-fill" style="width: {{ $pctExRenewalMissing }}%"></span>
|
||||
</div>
|
||||
<div class="adm-mini-bar-value">{{ $pctExRenewalMissing }}%({{ $exRenewalMissing }})</div>
|
||||
</a>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminDashboardPlatformOpsOverviewExtraMiniBarsShouldRenderTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function loginAsPlatformAdmin(): void
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
$this->post('/admin/login', [
|
||||
'email' => 'platform.admin@demo.local',
|
||||
'password' => 'Platform@123456',
|
||||
])->assertRedirect('/admin');
|
||||
}
|
||||
|
||||
public function test_dashboard_platform_ops_overview_should_render_extra_mini_bars(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$res = $this->get('/admin');
|
||||
$res->assertOk();
|
||||
|
||||
$html = (string) $res->getContent();
|
||||
|
||||
$this->assertStringContainsString('data-role="platform-ops-risk-bars"', $html);
|
||||
$this->assertStringContainsString('data-role="ops-risk-no-receipt-bar"', $html);
|
||||
$this->assertStringContainsString('data-role="ops-risk-reconcile-mismatch-bar"', $html);
|
||||
$this->assertStringContainsString('data-role="ops-risk-refund-inconsistent-bar"', $html);
|
||||
|
||||
$this->assertStringContainsString('data-role="platform-ops-exception-bars"', $html);
|
||||
$this->assertStringContainsString('data-role="ops-exception-bmpa-failed-bar"', $html);
|
||||
$this->assertStringContainsString('data-role="ops-exception-renewal-missing-bar"', $html);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user