From b89789faf1ec8b31e01da091e8763f18a8b4e86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sat, 14 Mar 2026 12:47:20 +0000 Subject: [PATCH] platform_orders index: compact view shows subscription ends_at date-only --- .../admin/platform_orders/index.blade.php | 8 +- ...ompactViewSubscriptionEndsAtFormatTest.php | 88 +++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/AdminPlatformOrderIndexCompactViewSubscriptionEndsAtFormatTest.php diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index a694582..3f18fd7 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -1130,7 +1130,13 @@ - @endif - {{ optional($order->siteSubscription?->ends_at)->format('Y-m-d H:i:s') ?: '-' }} + + @if($isFullView) + {{ optional($order->siteSubscription?->ends_at)->format('Y-m-d H:i:s') ?: '-' }} + @else + {{ optional($order->siteSubscription?->ends_at)->format('Y-m-d') ?: '-' }} + @endif + {{ data_get($order->meta, 'subscription_activation.synced_at') ?: '-' }} @php diff --git a/tests/Feature/AdminPlatformOrderIndexCompactViewSubscriptionEndsAtFormatTest.php b/tests/Feature/AdminPlatformOrderIndexCompactViewSubscriptionEndsAtFormatTest.php new file mode 100644 index 0000000..5873071 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderIndexCompactViewSubscriptionEndsAtFormatTest.php @@ -0,0 +1,88 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_compact_view_subscription_ends_at_shows_date_only_full_view_shows_datetime(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + + $plan = Plan::query()->create([ + 'code' => 'po_index_sub_ends_at_format_plan', + 'name' => '平台订单列表订阅到期时间格式测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $endsAt = now()->setDate(2026, 3, 31)->setTime(23, 59, 59); + + $sub = SiteSubscription::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'status' => 'active', + 'source' => 'test', + 'subscription_no' => 'SS_ENDS_AT_FORMAT_0001', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'amount' => 10, + 'starts_at' => now(), + 'ends_at' => $endsAt, + ]); + + PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'site_subscription_id' => $sub->id, + 'order_no' => 'PO_INDEX_SUB_ENDS_AT_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' => [], + ]); + + $this->get('/admin/platform-orders') + ->assertOk() + ->assertSee('2026-03-31', false) + ->assertDontSee('23:59:59', false); + + $this->get('/admin/platform-orders?view=full') + ->assertOk() + ->assertSee('2026-03-31 23:59:59', false); + } +}