diff --git a/resources/views/admin/platform_orders/show.blade.php b/resources/views/admin/platform_orders/show.blade.php index 2efdda4..e8c8d78 100644 --- a/resources/views/admin/platform_orders/show.blade.php +++ b/resources/views/admin/platform_orders/show.blade.php @@ -452,7 +452,24 @@ @if($snapPaid !== null || $snapRefund !== null) paid=¥{{ number_format((float) ($snapPaid ?? 0), 2) }};refund=¥{{ number_format((float) ($snapRefund ?? 0), 2) }} @else - - + @php + $subId = data_get($item, 'subscription_id'); + $filtersText = (string) (data_get($item, 'filters') ?? ''); + $filtersText = $filtersText !== '' ? mb_substr($filtersText, 0, 80) : ''; + @endphp + @if($subId || $filtersText !== '') + @if($subId) + subscription_id={{ $subId }} + @endif + @if($subId && $filtersText !== '') + ; + @endif + @if($filtersText !== '') + filters={{ $filtersText }} + @endif + @else + - + @endif @endif {{ data_get($item, 'note') ?: '' }} diff --git a/tests/Feature/AdminPlatformOrderAuditSnapshotFallbackRenderTest.php b/tests/Feature/AdminPlatformOrderAuditSnapshotFallbackRenderTest.php new file mode 100644 index 0000000..1a03972 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderAuditSnapshotFallbackRenderTest.php @@ -0,0 +1,77 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_show_page_can_render_audit_snapshot_fallback_fields(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'audit_snapshot_fallback_plan_01', + 'name' => '审计快照降级展示测试', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_AUDIT_SNAPSHOT_FALLBACK_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' => [ + 'audit' => [ + [ + 'action' => 'batch_activate_subscription', + 'scope' => 'filtered', + 'at' => now()->toDateTimeString(), + 'admin_id' => 1, + 'subscription_id' => 123, + 'filters' => 'syncable_only=1&refund_inconsistent=1', + 'note' => '测试用审计记录', + ], + ], + ], + ]); + + $this->get('/admin/platform-orders/' . $order->id) + ->assertOk() + ->assertSee('subscription_id=123') + ->assertSee('filters=syncable_only=1'); + } +}