diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php
index abe813c..53c4c9d 100644
--- a/resources/views/admin/platform_orders/index.blade.php
+++ b/resources/views/admin/platform_orders/index.blade.php
@@ -1069,6 +1069,7 @@
@php
$syncedId = (int) data_get($order->meta, 'subscription_activation.subscription_id', 0);
$syncErr = (string) (data_get($order->meta, 'subscription_activation_error.message') ?? '');
+ $bmpaErrCompact = (string) (data_get($order->meta, 'batch_mark_paid_and_activate_error.message') ?? '');
@endphp
@if($syncedId > 0)
已同步
@@ -1077,6 +1078,15 @@
@else
未同步
@endif
+
+ @if(! $isFullView)
+ @if($syncErr !== '')
+
原因:{{ mb_substr($syncErr, 0, $SYNC_FAILED_REASON_TRUNCATE_LEN) }}
+ @endif
+ @if($bmpaErrCompact !== '')
+ BMPA:{{ mb_substr($bmpaErrCompact, 0, $SYNC_FAILED_REASON_TRUNCATE_LEN) }}
+ @endif
+ @endif
@if($order->siteSubscription)
diff --git a/tests/Feature/AdminPlatformOrderIndexCompactViewSyncStatusShowsReasonTest.php b/tests/Feature/AdminPlatformOrderIndexCompactViewSyncStatusShowsReasonTest.php
new file mode 100644
index 0000000..eba44bd
--- /dev/null
+++ b/tests/Feature/AdminPlatformOrderIndexCompactViewSyncStatusShowsReasonTest.php
@@ -0,0 +1,82 @@
+seed();
+
+ $this->post('/admin/login', [
+ 'email' => 'platform.admin@demo.local',
+ 'password' => 'Platform@123456',
+ ])->assertRedirect('/admin');
+ }
+
+ public function test_compact_view_shows_sync_and_bmpa_error_reason_under_sync_status_cell(): void
+ {
+ $this->loginAsPlatformAdmin();
+
+ $merchant = Merchant::query()->firstOrFail();
+
+ $plan = Plan::query()->create([
+ 'code' => 'compact_view_sync_reason_test',
+ '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,
+ 'order_no' => 'PO_COMPACT_SYNC_REASON_0001',
+ 'order_type' => 'new_purchase',
+ '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' => [
+ 'subscription_activation_error' => [
+ 'message' => 'SIMULATED_SYNC_ERROR: remote api failed',
+ 'at' => now()->toDateTimeString(),
+ ],
+ 'batch_mark_paid_and_activate_error' => [
+ 'message' => 'SIMULATED_BMPA_ERROR: validation failed',
+ 'at' => now()->toDateTimeString(),
+ ],
+ ],
+ ]);
+
+ // 默认精简视图:应显示原因(full 视图仍由“失败原因”列承载)
+ $this->get('/admin/platform-orders')
+ ->assertOk()
+ ->assertSee('原因:SIMULATED_SYNC_ERROR', false)
+ ->assertSee('BMPA:SIMULATED_BMPA_ERROR', false);
+
+ // full 视图:不强制在该单元格重复显示(避免信息过载),这里确保不出现 compact 的前缀文案
+ $this->get('/admin/platform-orders?view=full')
+ ->assertOk()
+ ->assertDontSee('原因:SIMULATED_SYNC_ERROR', false)
+ ->assertDontSee('BMPA:SIMULATED_BMPA_ERROR', false);
+ }
+}
|