feat(admin): 仪表盘接入最近平台订单列表(收费闭环入口)

This commit is contained in:
萝卜
2026-03-15 18:51:59 +08:00
parent 68c9df40a4
commit 257b532757
2 changed files with 60 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ use App\Models\Admin;
use App\Models\Order;
use App\Models\Product;
use App\Models\Merchant;
use App\Models\PlatformOrder;
use App\Models\User;
use App\Support\CacheKeys;
use Illuminate\Http\Request;
@@ -31,14 +32,37 @@ class DashboardController extends Controller
'users' => User::count(),
'products' => Product::count(),
'orders' => Order::count(),
// 收费中心(平台侧)
'platform_orders' => PlatformOrder::count(),
'platform_orders_unpaid_pending' => PlatformOrder::query()
->where('payment_status', 'unpaid')
->where('status', 'pending')
->count(),
'platform_orders_paid_pending' => PlatformOrder::query()
->where('payment_status', 'paid')
->where('status', 'pending')
->count(),
// 同步失败沿用平台订单列表口径meta.subscription_activation_error.message 存在即失败)
'platform_orders_sync_failed' => PlatformOrder::query()
->whereRaw("JSON_EXTRACT(meta, '$.subscription_activation_error.message') IS NOT NULL")
->count(),
// 站点治理
'active_merchants' => Merchant::query()->where('status', 'active')->count(),
'pending_orders' => Order::query()->where('status', 'pending')->count(),
]
);
$recentPlatformOrders = PlatformOrder::query()
->orderByDesc('id')
->limit(5)
->get();
return view('admin.dashboard', [
'adminName' => $admin->name,
'stats' => $stats,
'recentPlatformOrders' => $recentPlatformOrders,
'platformAdmin' => $admin,
'cacheMeta' => [
'store' => config('cache.default'),

View File

@@ -112,9 +112,42 @@
<div class="two-col mb-20" data-role="analysis-skeleton-row2">
<div class="card">
<h3 class="mt-0">最近平台订单(占位)</h3>
<div class="muted">后续接入:最近 N 笔平台订单列表(订单号/站点/套餐/金额/状态/同步状态)。</div>
<div class="muted muted-xs mt-10">说明:先保证“看板位”稳定,避免后续接数据时反复改版。</div>
<div class="flex-between">
<h3 class="mt-0">最近平台订单</h3>
<a class="muted" href="/admin/platform-orders">查看全部</a>
</div>
<table>
<thead>
<tr>
<th>订单号</th>
<th>类型</th>
<th>金额</th>
<th>支付</th>
<th>状态</th>
</tr>
</thead>
<tbody>
@forelse(($recentPlatformOrders ?? []) as $po)
@php
$poShowUrl = '/admin/platform-orders/' . $po->id;
@endphp
<tr>
<td><a class="link" href="{{ $poShowUrl }}">{{ $po->order_no }}</a></td>
<td>{{ $po->orderTypeLabel() }}</td>
<td>¥{{ number_format((float) $po->payable_amount, 2) }}</td>
<td>{{ $po->payment_status }}</td>
<td>{{ $po->status }}</td>
</tr>
@empty
<tr>
<td colspan="5" class="muted">暂无数据</td>
</tr>
@endforelse
</tbody>
</table>
<div class="muted muted-xs mt-10">说明:当前先接入最近订单列表;后续补“同步状态/站点/套餐/治理入口”。</div>
</div>
<div class="card">