Dashboard: add platform order governance mini bars for persuasion
This commit is contained in:
@@ -271,6 +271,45 @@
|
|||||||
<a class="btn btn-secondary btn-sm" href="{!! \App\Support\BackUrl::withBack('/admin/platform-orders?reconcile_mismatch=1', $selfWithoutBack) !!}">对账不一致({{ (int) ($stats['platform_orders_reconcile_mismatch'] ?? 0) }})</a>
|
<a class="btn btn-secondary btn-sm" href="{!! \App\Support\BackUrl::withBack('/admin/platform-orders?reconcile_mismatch=1', $selfWithoutBack) !!}">对账不一致({{ (int) ($stats['platform_orders_reconcile_mismatch'] ?? 0) }})</a>
|
||||||
<a class="btn btn-secondary btn-sm" href="{!! \App\Support\BackUrl::withBack('/admin/platform-orders?refund_inconsistent=1', $selfWithoutBack) !!}">退款不一致({{ (int) ($stats['platform_orders_refund_inconsistent'] ?? 0) }})</a>
|
<a class="btn btn-secondary btn-sm" href="{!! \App\Support\BackUrl::withBack('/admin/platform-orders?refund_inconsistent=1', $selfWithoutBack) !!}">退款不一致({{ (int) ($stats['platform_orders_refund_inconsistent'] ?? 0) }})</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
|
<div class="mt-10" data-role="dashboard-po-governance-bars">
|
||||||
|
<div class="muted muted-xs">治理风险占比(相对平台订单总量 {{ $poTotal }})</div>
|
||||||
|
|
||||||
|
<div class="adm-mini-bar-row mt-6" data-role="dashboard-po-sync-failed-row">
|
||||||
|
<div class="adm-mini-bar-label">同步失败</div>
|
||||||
|
<div class="adm-mini-bar" data-role="dashboard-po-sync-failed-bar" title="{{ $poSyncFailed }} / {{ $poTotal }}({{ $poSyncFailedPct }}%)">
|
||||||
|
<span class="adm-mini-bar-fill" style="width: {{ $poSyncFailedPct }}%"></span>
|
||||||
|
</div>
|
||||||
|
<div class="adm-mini-bar-value">{{ $poSyncFailedPct }}%</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adm-mini-bar-row mt-6" data-role="dashboard-po-no-receipt-row">
|
||||||
|
<div class="adm-mini-bar-label">无回执</div>
|
||||||
|
<div class="adm-mini-bar" data-role="dashboard-po-no-receipt-bar" title="{{ $poNoReceipt }} / {{ $poTotal }}({{ $poNoReceiptPct }}%)">
|
||||||
|
<span class="adm-mini-bar-fill" style="width: {{ $poNoReceiptPct }}%"></span>
|
||||||
|
</div>
|
||||||
|
<div class="adm-mini-bar-value">{{ $poNoReceiptPct }}%</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adm-mini-bar-row mt-6" data-role="dashboard-po-renewal-missing-row">
|
||||||
|
<div class="adm-mini-bar-label">续费缺订阅</div>
|
||||||
|
<div class="adm-mini-bar" data-role="dashboard-po-renewal-missing-bar" title="{{ $poRenewalMissing }} / {{ $poTotal }}({{ $poRenewalMissingPct }}%)">
|
||||||
|
<span class="adm-mini-bar-fill" style="width: {{ $poRenewalMissingPct }}%"></span>
|
||||||
|
</div>
|
||||||
|
<div class="adm-mini-bar-value">{{ $poRenewalMissingPct }}%</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-12">
|
<div class="mt-12">
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AdminDashboardPlatformOrderGovernanceMiniBarsShouldRenderTest 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_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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user