diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index 3a3bded..59b11d8 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -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'), diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index aed2809..7e6abcb 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -112,9 +112,42 @@
-

最近平台订单(占位)

-
后续接入:最近 N 笔平台订单列表(订单号/站点/套餐/金额/状态/同步状态)。
-
说明:先保证“看板位”稳定,避免后续接数据时反复改版。
+
+

最近平台订单

+ 查看全部 +
+ + + + + + + + + + + + + @forelse(($recentPlatformOrders ?? []) as $po) + @php + $poShowUrl = '/admin/platform-orders/' . $po->id; + @endphp + + + + + + + + @empty + + + + @endforelse + +
订单号类型金额支付状态
{{ $po->order_no }}{{ $po->orderTypeLabel() }}¥{{ number_format((float) $po->payable_amount, 2) }}{{ $po->payment_status }}{{ $po->status }}
暂无数据
+ +
说明:当前先接入最近订单列表;后续补“同步状态/站点/套餐/治理入口”。