diff --git a/resources/views/admin/site_subscriptions/show.blade.php b/resources/views/admin/site_subscriptions/show.blade.php
index 5f13031..bc5ec12 100644
--- a/resources/views/admin/site_subscriptions/show.blade.php
+++ b/resources/views/admin/site_subscriptions/show.blade.php
@@ -466,6 +466,8 @@
同步状态 |
同步时间 |
失败原因 |
+ BAS run_id |
+ BMPA run_id |
操作 |
@@ -486,6 +488,23 @@
{{ $order->id }} |
@php
$orderShowUrl = \App\Support\BackUrl::withBack('/admin/platform-orders/' . $order->id, $selfWithoutBack);
+
+ $basRunId = (string) (data_get($order->meta, 'batch_activation.run_id') ?? '');
+ $bmpaRunId = (string) (data_get($order->meta, 'batch_mark_paid_and_activate.run_id') ?? '');
+
+ $basBatchUrl = $basRunId !== ''
+ ? \App\Support\BackUrl::withBack('/admin/platform-batches/show?' . \Illuminate\Support\Arr::query([
+ 'type' => 'bas',
+ 'run_id' => $basRunId,
+ ]), $selfWithoutBack)
+ : '';
+
+ $bmpaBatchUrl = $bmpaRunId !== ''
+ ? \App\Support\BackUrl::withBack('/admin/platform-batches/show?' . \Illuminate\Support\Arr::query([
+ 'type' => 'bmpa',
+ 'run_id' => $bmpaRunId,
+ ]), $selfWithoutBack)
+ : '';
@endphp
{{ $order->order_no }} |
{{ $order->status }} |
@@ -504,13 +523,27 @@
-
@endif
+
+ @if($basBatchUrl !== '')
+ {{ $basRunId }}
+ @else
+ -
+ @endif
+ |
+
+ @if($bmpaBatchUrl !== '')
+ {{ $bmpaRunId }}
+ @else
+ -
+ @endif
+ |
详情
|
@empty
- | 暂无关联平台订单。 |
+ 暂无关联平台订单。 |
@endforelse
diff --git a/tests/Feature/AdminSiteSubscriptionShowOrdersTableShouldRenderBatchRunIdColumnsTest.php b/tests/Feature/AdminSiteSubscriptionShowOrdersTableShouldRenderBatchRunIdColumnsTest.php
new file mode 100644
index 0000000..1528535
--- /dev/null
+++ b/tests/Feature/AdminSiteSubscriptionShowOrdersTableShouldRenderBatchRunIdColumnsTest.php
@@ -0,0 +1,96 @@
+seed();
+
+ $this->post('/admin/login', [
+ 'email' => 'platform.admin@demo.local',
+ 'password' => 'Platform@123456',
+ ])->assertRedirect('/admin');
+ }
+
+ public function test_site_subscription_show_orders_table_should_render_batch_run_id_columns_and_links(): void
+ {
+ $this->loginAsPlatformAdmin();
+
+ $merchant = Merchant::query()->firstOrFail();
+ $plan = Plan::query()->create([
+ 'code' => 'sub_show_orders_batch_run_id_plan',
+ 'name' => '订阅详情订单表批次run_id列测试套餐',
+ 'billing_cycle' => 'monthly',
+ 'price' => 10,
+ 'list_price' => 10,
+ 'status' => 'active',
+ 'sort' => 10,
+ 'published_at' => now(),
+ ]);
+
+ $sub = SiteSubscription::query()->create([
+ 'merchant_id' => $merchant->id,
+ 'plan_id' => $plan->id,
+ 'status' => 'activated',
+ 'source' => 'manual',
+ 'subscription_no' => 'SUB_SHOW_ORDERS_BATCH_RUN_ID_0001',
+ 'plan_name' => $plan->name,
+ 'billing_cycle' => $plan->billing_cycle,
+ 'period_months' => 1,
+ 'amount' => 10,
+ 'starts_at' => now()->subDay(),
+ 'ends_at' => now()->addMonth(),
+ 'activated_at' => now()->subDay(),
+ ]);
+
+ $order = PlatformOrder::query()->create([
+ 'merchant_id' => $merchant->id,
+ 'plan_id' => $plan->id,
+ 'site_subscription_id' => $sub->id,
+ 'order_no' => 'PO_SUB_SHOW_ORDERS_BATCH_RUN_ID_0001',
+ 'order_type' => 'renewal',
+ 'status' => 'activated',
+ 'payment_status' => 'paid',
+ 'plan_name' => $plan->name,
+ 'billing_cycle' => $plan->billing_cycle,
+ 'period_months' => 1,
+ 'quantity' => 1,
+ 'payable_amount' => 10,
+ 'paid_amount' => 10,
+ 'placed_at' => now(),
+ 'paid_at' => now(),
+ 'activated_at' => now(),
+ 'meta' => [
+ 'batch_activation' => ['run_id' => 'RUN_BAS_SUB_0001'],
+ 'batch_mark_paid_and_activate' => ['run_id' => 'RUN_BMPA_SUB_0001'],
+ ],
+ ]);
+
+ $res = $this->get('/admin/site-subscriptions/' . $sub->id);
+ $res->assertOk();
+
+ // 表头列必须存在
+ $res->assertSee('BAS run_id', false);
+ $res->assertSee('BMPA run_id', false);
+
+ // run_id 值应可点击直达批次复盘页(带 back 回到订阅详情)
+ $expectedBack = urlencode('/admin/site-subscriptions/' . $sub->id);
+
+ $res->assertSee('/admin/platform-batches/show?type=bas&run_id=RUN_BAS_SUB_0001&back=' . $expectedBack, false);
+ $res->assertSee('/admin/platform-batches/show?type=bmpa&run_id=RUN_BMPA_SUB_0001&back=' . $expectedBack, false);
+
+ // 仍应保留订单详情 link
+ $res->assertSee('/admin/platform-orders/' . $order->id . '?back=' . $expectedBack, false);
+ }
+}