337 lines
12 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@php
$kpis = [
['key' => 'income', 'label' => '本月收入'],
['key' => 'expense', 'label' => '本月支出'],
['key' => 'gross_profit', 'label' => '本月毛利'],
['key' => 'gross_margin', 'label' => '毛利率'],
['key' => 'receivable', 'label' => '应收余额'],
['key' => 'payable', 'label' => '应付余额'],
];
@endphp
<x-layouts.admin>
<x-slot name="title">财务驾驶舱</x-slot>
<x-slot name="content">
<style>
#main-body > .container {
max-width: none;
width: auto;
margin-left: 1.5rem;
margin-right: 1.5rem;
}
.cockpit {
display: grid;
gap: 1rem;
margin: 1rem 0 2rem;
font-size: 0.8125rem;
line-height: 1.5;
color: var(--vip-content-ink, #171717);
}
.cockpit__head {
display: grid;
gap: 0.25rem;
padding: 0.25rem 0 0.5rem;
}
.cockpit__eyebrow {
color: var(--vip-content-accent-dark, #856632);
font-size: 0.6875rem;
font-weight: 600;
letter-spacing: 0.32em;
}
.cockpit__title {
font-size: 1.125rem;
font-weight: 600;
line-height: 1.3;
}
.cockpit__hint {
color: var(--vip-content-muted, #595959);
font-size: 0.75rem;
}
.cockpit__kpis {
display: grid;
gap: 0.75rem;
grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
}
.cockpit__kpi {
display: grid;
gap: 0.375rem;
padding: 1rem;
border: 1px solid var(--vip-border, #D8D2C7);
border-radius: 0.75rem;
background: var(--vip-surface, #fff);
}
.cockpit__kpi-label {
color: var(--vip-content-muted, #595959);
font-size: 0.75rem;
}
.cockpit__kpi-value {
font-size: 1.5rem;
font-weight: 600;
line-height: 1.2;
font-variant-numeric: tabular-nums;
}
.cockpit__kpi-note {
color: var(--vip-content-muted, #595959);
font-size: 0.6875rem;
}
.cockpit__grid {
display: grid;
gap: 1rem;
grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}
.cockpit__panel {
display: grid;
gap: 0.75rem;
align-content: start;
padding: 1rem;
border: 1px solid var(--vip-border, #D8D2C7);
border-radius: 0.75rem;
background: var(--vip-surface, #fff);
}
.cockpit__panel-title {
display: flex;
align-items: center;
gap: 0.375rem;
font-size: 0.75rem;
font-weight: 600;
}
.cockpit__panel-title .material-icons-outlined {
color: var(--vip-content-accent-dark, #856632);
font-size: 1rem;
}
.cockpit__placeholder {
display: grid;
place-items: center;
min-height: 11rem;
border: 1px dashed var(--vip-border, #D8D2C7);
border-radius: 0.5rem;
color: var(--vip-content-muted, #595959);
font-size: 0.75rem;
text-align: center;
}
.cockpit__risk-list {
display: grid;
gap: 0.5rem;
}
.cockpit__risk-content {
display: grid;
gap: 0.65rem;
}
.cockpit__risk-summary {
display: grid;
gap: 0.2rem;
margin-bottom: 0.6rem;
}
.cockpit__risk-summary strong {
color: var(--vip-content-ink, #171717);
font-size: 0.75rem;
font-weight: 600;
}
.cockpit__risk-summary span {
color: var(--vip-content-muted, #595959);
font-size: 0.6875rem;
line-height: 1.6;
}
.cockpit__risk-item {
display: flex;
align-items: flex-start;
gap: 0.55rem;
padding: 0.75rem;
border: 1px solid var(--vip-border, #D8D2C7);
border-radius: 0.5rem;
background: var(--vip-surface, #fff);
}
.cockpit__risk-item.is-failed {
border-color: rgba(184, 0, 0, 0.3);
background: rgba(184, 0, 0, 0.04);
}
.cockpit__risk-item.is-warning {
border-color: rgba(147, 95, 7, 0.3);
background: rgba(147, 95, 7, 0.05);
}
.cockpit__risk-item.is-failed .material-icons-outlined {
color: var(--vip-danger, #B80000);
}
.cockpit__risk-item.is-warning .material-icons-outlined {
color: var(--vip-warning, #935F07);
}
.cockpit__risk-item .material-icons-outlined {
flex: 0 0 auto;
margin-top: 0.1rem;
font-size: 1.1rem;
}
.cockpit__risk-copy {
display: grid;
gap: 0.2rem;
min-width: 0;
}
.cockpit__risk-copy strong {
font-size: 0.75rem;
font-weight: 600;
}
.cockpit__risk-copy span,
.cockpit__risk-meta {
color: var(--vip-content-muted, #595959);
font-size: 0.6875rem;
line-height: 1.6;
}
.cockpit__risk-normal {
display: flex;
align-items: flex-start;
gap: 0.55rem;
padding: 0.85rem;
border: 1px dashed var(--vip-border, #D8D2C7);
border-radius: 0.5rem;
color: var(--vip-content-muted, #595959);
}
.cockpit__risk-normal .material-icons-outlined {
color: var(--vip-success, #53793E);
font-size: 1.1rem;
}
.cockpit__risk-normal.is-syncing .material-icons-outlined {
color: var(--vip-content-accent-dark, #856632);
}
.cockpit__risk-meta {
display: grid;
gap: 0.1rem;
}
.cockpit__risk-link {
color: var(--vip-content-accent-dark, #856632);
font-size: 0.75rem;
font-weight: 600;
text-decoration: none;
}
.cockpit__risk-link:hover {
text-decoration: underline;
text-underline-offset: 3px;
}
@media (max-width: 1100px) {
.cockpit__grid {
grid-template-columns: minmax(0, 1fr);
}
}
</style>
<div class="cockpit" data-cockpit>
<header class="cockpit__head">
<p class="cockpit__eyebrow">FINANCE COCKPIT</p>
<h1 class="cockpit__title">财务驾驶舱</h1>
<p class="cockpit__hint">指标口径和数据源待确认,下面先留出位置;确认后接入真实数据。</p>
</header>
<div class="cockpit__kpis">
@foreach ($kpis as $kpi)
<section class="cockpit__kpi" data-cockpit-kpi="{{ $kpi['key'] }}">
<span class="cockpit__kpi-label">{{ $kpi['label'] }}</span>
<span class="cockpit__kpi-value">—</span>
<span class="cockpit__kpi-note">待接入</span>
</section>
@endforeach
</div>
<div class="cockpit__grid">
<section class="cockpit__panel" aria-label="趋势">
<h2 class="cockpit__panel-title">
<span class="material-icons-outlined" aria-hidden="true">show_chart</span>
近 12 个月收入 / 支出
</h2>
<div class="cockpit__placeholder">图表位置(接入数据后显示趋势)</div>
</section>
<section class="cockpit__panel" aria-label="风险预警">
<h2 class="cockpit__panel-title">
<span class="material-icons-outlined" aria-hidden="true">notification_important</span>
风险预警
</h2>
<div class="cockpit__risk-content" data-refund-sync-status="{{ $refundSyncStatus['state'] }}">
@if (!empty($refundSyncStatus['issues']))
<div class="cockpit__risk-summary">
<strong>{{ $refundSyncStatus['title'] }}</strong>
<span>{{ $refundSyncStatus['message'] }}</span>
</div>
<div class="cockpit__risk-list">
@foreach ($refundSyncStatus['issues'] as $issue)
<div @class([
'cockpit__risk-item',
'is-failed' => $refundSyncStatus['state'] === 'failed',
'is-warning' => $refundSyncStatus['state'] === 'warning',
])>
<span class="material-icons-outlined" aria-hidden="true">error_outline</span>
<div class="cockpit__risk-copy">
<strong>{{ $issue['label'] }}</strong>
<span>
{{ $issue['message'] }}
@if (!empty($issue['error_code']))
({{ $issue['error_code'] }})
@endif
</span>
</div>
</div>
@endforeach
</div>
@else
<div @class(['cockpit__risk-normal', 'is-syncing' => $refundSyncStatus['state'] === 'syncing'])>
<span class="material-icons-outlined" aria-hidden="true">
{{ $refundSyncStatus['state'] === 'syncing' ? 'sync' : 'check_circle' }}
</span>
<div class="cockpit__risk-copy">
<strong>{{ $refundSyncStatus['title'] }}</strong>
<span>{{ $refundSyncStatus['message'] }}</span>
</div>
</div>
@endif
<div class="cockpit__risk-meta">
@if (!empty($refundSyncStatus['last_succeeded_at']))
<span>最近成功:{{ $refundSyncStatus['last_succeeded_at'] }}</span>
@endif
@if (!empty($refundSyncStatus['last_attempted_at']))
<span>最近尝试:{{ $refundSyncStatus['last_attempted_at'] }}</span>
@endif
</div>
<a class="cockpit__risk-link" href="{{ route('business.pages.show', [
'section' => 'fee-ratio-monitoring',
'page' => 'refund-pending',
]) }}">查看退款待确认</a>
</div>
</section>
</div>
</div>
</x-slot>
</x-layouts.admin>