Dashboard: expand governance mini bars to include reconcile mismatch and refund inconsistent
This commit is contained in:
@@ -277,10 +277,14 @@
|
|||||||
$poSyncFailed = (int) ($stats['platform_orders_sync_failed'] ?? 0);
|
$poSyncFailed = (int) ($stats['platform_orders_sync_failed'] ?? 0);
|
||||||
$poNoReceipt = (int) ($stats['platform_orders_paid_no_receipt'] ?? 0);
|
$poNoReceipt = (int) ($stats['platform_orders_paid_no_receipt'] ?? 0);
|
||||||
$poRenewalMissing = (int) ($stats['platform_orders_renewal_missing_subscription'] ?? 0);
|
$poRenewalMissing = (int) ($stats['platform_orders_renewal_missing_subscription'] ?? 0);
|
||||||
|
$poReconcileMismatch = (int) ($stats['platform_orders_reconcile_mismatch'] ?? 0);
|
||||||
|
$poRefundInconsistent = (int) ($stats['platform_orders_refund_inconsistent'] ?? 0);
|
||||||
|
|
||||||
$poSyncFailedPct = $poTotal > 0 ? min(100, max(0, round(($poSyncFailed / $poTotal) * 100, 1))) : 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;
|
$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;
|
$poRenewalMissingPct = $poTotal > 0 ? min(100, max(0, round(($poRenewalMissing / $poTotal) * 100, 1))) : 0;
|
||||||
|
$poReconcileMismatchPct = $poTotal > 0 ? min(100, max(0, round(($poReconcileMismatch / $poTotal) * 100, 1))) : 0;
|
||||||
|
$poRefundInconsistentPct = $poTotal > 0 ? min(100, max(0, round(($poRefundInconsistent / $poTotal) * 100, 1))) : 0;
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@php
|
@php
|
||||||
@@ -347,6 +351,22 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="adm-mini-bar-value">{{ $poRenewalMissingPct }}%({{ $poRenewalMissing }})</div>
|
<div class="adm-mini-bar-value">{{ $poRenewalMissingPct }}%({{ $poRenewalMissing }})</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<a class="adm-mini-bar-row adm-mini-bar-row-link mt-6" data-role="dashboard-po-reconcile-mismatch-row" href="{!! \App\Support\BackUrl::withBack('/admin/platform-orders?reconcile_mismatch=1', $selfWithoutBack) !!}" aria-label="进入对账不一致订单集合">
|
||||||
|
<div class="adm-mini-bar-label">对账不一致</div>
|
||||||
|
<div class="adm-mini-bar" data-role="dashboard-po-reconcile-mismatch-bar" title="{{ $poReconcileMismatch }} / {{ $poTotal }}({{ $poReconcileMismatchPct }}%)">
|
||||||
|
<span class="adm-mini-bar-fill" style="width: {{ $poReconcileMismatchPct }}%"></span>
|
||||||
|
</div>
|
||||||
|
<div class="adm-mini-bar-value">{{ $poReconcileMismatchPct }}%({{ $poReconcileMismatch }})</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="adm-mini-bar-row adm-mini-bar-row-link mt-6" data-role="dashboard-po-refund-inconsistent-row" href="{!! \App\Support\BackUrl::withBack('/admin/platform-orders?refund_inconsistent=1', $selfWithoutBack) !!}" aria-label="进入退款不一致订单集合">
|
||||||
|
<div class="adm-mini-bar-label">退款不一致</div>
|
||||||
|
<div class="adm-mini-bar" data-role="dashboard-po-refund-inconsistent-bar" title="{{ $poRefundInconsistent }} / {{ $poTotal }}({{ $poRefundInconsistentPct }}%)">
|
||||||
|
<span class="adm-mini-bar-fill" style="width: {{ $poRefundInconsistentPct }}%"></span>
|
||||||
|
</div>
|
||||||
|
<div class="adm-mini-bar-value">{{ $poRefundInconsistentPct }}%({{ $poRefundInconsistent }})</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class AdminDashboardMiniBarRowsShouldLinkToGovernanceScopesTest extends TestCase
|
|||||||
|
|
||||||
$html = (string) $res->getContent();
|
$html = (string) $res->getContent();
|
||||||
|
|
||||||
// 行可点击(漏斗 + 治理)
|
// 行可点击(漏斗 + 治理 + 订阅到期)
|
||||||
$this->assertStringContainsString('adm-mini-bar-row-link', $html);
|
$this->assertStringContainsString('adm-mini-bar-row-link', $html);
|
||||||
|
|
||||||
// 漏斗:待支付 / 待生效 / 可同步
|
// 漏斗:待支付 / 待生效 / 可同步
|
||||||
@@ -36,12 +36,18 @@ class AdminDashboardMiniBarRowsShouldLinkToGovernanceScopesTest extends TestCase
|
|||||||
$this->assertStringContainsString('href="/admin/platform-orders?payment_status=paid&status=pending&sync_status=unsynced&back=%2Fadmin"', $html);
|
$this->assertStringContainsString('href="/admin/platform-orders?payment_status=paid&status=pending&sync_status=unsynced&back=%2Fadmin"', $html);
|
||||||
$this->assertStringContainsString('href="/admin/platform-orders?syncable_only=1&sync_status=unsynced&back=%2Fadmin"', $html);
|
$this->assertStringContainsString('href="/admin/platform-orders?syncable_only=1&sync_status=unsynced&back=%2Fadmin"', $html);
|
||||||
|
|
||||||
// 治理:同步失败 / 无回执 / 续费缺订阅
|
// 治理:同步失败 / 无回执 / 续费缺订阅 / 对账不一致 / 退款不一致
|
||||||
$this->assertStringContainsString('href="/admin/platform-orders?sync_status=failed&back=%2Fadmin"', $html);
|
$this->assertStringContainsString('href="/admin/platform-orders?sync_status=failed&back=%2Fadmin"', $html);
|
||||||
$this->assertStringContainsString('href="/admin/platform-orders?payment_status=paid&receipt_status=none&back=%2Fadmin"', $html);
|
$this->assertStringContainsString('href="/admin/platform-orders?payment_status=paid&receipt_status=none&back=%2Fadmin"', $html);
|
||||||
$this->assertStringContainsString('href="/admin/platform-orders?renewal_missing_subscription=1&back=%2Fadmin"', $html);
|
$this->assertStringContainsString('href="/admin/platform-orders?renewal_missing_subscription=1&back=%2Fadmin"', $html);
|
||||||
|
$this->assertStringContainsString('href="/admin/platform-orders?reconcile_mismatch=1&back=%2Fadmin"', $html);
|
||||||
|
$this->assertStringContainsString('href="/admin/platform-orders?refund_inconsistent=1&back=%2Fadmin"', $html);
|
||||||
|
|
||||||
// back 参数不得被 Blade escape 成 &back(避免 nested back/可读性问题)
|
// 订阅到期治理
|
||||||
|
$this->assertStringContainsString('href="/admin/site-subscriptions?expiry=expiring_7d&back=%2Fadmin"', $html);
|
||||||
|
$this->assertStringContainsString('href="/admin/site-subscriptions?expiry=expired&back=%2Fadmin"', $html);
|
||||||
|
|
||||||
|
// back 参数不得被 Blade escape 成 &back
|
||||||
$this->assertStringNotContainsString('&back=', $html);
|
$this->assertStringNotContainsString('&back=', $html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,5 +32,7 @@ class AdminDashboardPlatformOrderGovernanceMiniBarsShouldRenderTest extends Test
|
|||||||
$this->assertStringContainsString('data-role="dashboard-po-sync-failed-bar"', $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-no-receipt-bar"', $html);
|
||||||
$this->assertStringContainsString('data-role="dashboard-po-renewal-missing-bar"', $html);
|
$this->assertStringContainsString('data-role="dashboard-po-renewal-missing-bar"', $html);
|
||||||
|
$this->assertStringContainsString('data-role="dashboard-po-reconcile-mismatch-bar"', $html);
|
||||||
|
$this->assertStringContainsString('data-role="dashboard-po-refund-inconsistent-bar"', $html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user