diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php
index 3309cb3..61a879a 100644
--- a/app/Http/Controllers/Admin/DashboardController.php
+++ b/app/Http/Controllers/Admin/DashboardController.php
@@ -192,6 +192,7 @@ class DashboardController extends Controller
}
$recentPlatformOrders = PlatformOrder::query()
+ ->with(['merchant', 'plan'])
->orderByDesc('id')
->limit(5)
->get();
diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php
index efee177..9488e89 100644
--- a/resources/views/admin/dashboard.blade.php
+++ b/resources/views/admin/dashboard.blade.php
@@ -339,7 +339,14 @@
@endphp
| {{ $po->order_no }} |
- {{ $po->orderTypeLabel() }} |
+
+ {{ $po->orderTypeLabel() }}
+
+ {{ (string) (optional($po->merchant)->name ?: ('站点#' . (int) ($po->merchant_id ?? 0))) }}
+ |
+ {{ (string) (optional($po->plan)->name ?: ((int) ($po->plan_id ?? 0) > 0 ? ('套餐#' . (int) $po->plan_id) : '-')) }}
+
+ |
¥{{ number_format((float) $po->payable_amount, 2) }} |
{{ $po->payment_status }}
diff --git a/tests/Feature/AdminDashboardRecentPlatformOrdersShouldShowMerchantAndPlanMetaTest.php b/tests/Feature/AdminDashboardRecentPlatformOrdersShouldShowMerchantAndPlanMetaTest.php
new file mode 100644
index 0000000..147d9b5
--- /dev/null
+++ b/tests/Feature/AdminDashboardRecentPlatformOrdersShouldShowMerchantAndPlanMetaTest.php
@@ -0,0 +1,66 @@
+seed();
+
+ $this->post('/admin/login', [
+ 'email' => 'platform.admin@demo.local',
+ 'password' => 'Platform@123456',
+ ])->assertRedirect('/admin');
+ }
+
+ public function test_dashboard_recent_platform_orders_should_show_merchant_and_plan_meta(): void
+ {
+ $this->loginAsPlatformAdmin();
+
+ $merchant = Merchant::query()->firstOrFail();
+ $platformAdminId = (int) Admin::query()->where('email', 'platform.admin@demo.local')->value('id');
+
+ $plan = Plan::query()->create([
+ 'code' => 'dash_recent_order_meta_plan',
+ 'name' => '仪表盘最近订单元信息测试套餐',
+ 'billing_cycle' => 'monthly',
+ 'price' => 10,
+ 'list_price' => 10,
+ 'status' => 'active',
+ 'sort' => 10,
+ 'published_at' => now(),
+ ]);
+
+ PlatformOrder::query()->create([
+ 'merchant_id' => $merchant->id,
+ 'plan_id' => $plan->id,
+ 'site_subscription_id' => null,
+ 'created_by_admin_id' => $platformAdminId ?: null,
+ 'order_no' => 'PO_DASH_RECENT_META_0001',
+ 'order_type' => 'new_purchase',
+ 'status' => 'pending',
+ 'payment_status' => 'paid',
+ 'payable_amount' => 10,
+ 'paid_amount' => 10,
+ 'placed_at' => now(),
+ 'meta' => [],
+ ]);
+
+ $res = $this->get('/admin');
+ $res->assertOk();
+
+ $res->assertSee('PO_DASH_RECENT_META_0001');
+ $res->assertSee($merchant->name, false);
+ $res->assertSee($plan->name, false);
+ }
+}
|