From 9f895369338360d5fd679efcbdf872f599247f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Fri, 13 Mar 2026 20:40:54 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=B9=B3=E5=8F=B0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=EF=BC=9A=E7=BB=AD=E8=B4=B9=E4=B8=94=E5=85=B3=E8=81=94?= =?UTF-8?q?=E8=AE=A2=E9=98=85=E6=97=B6=E5=A2=9E=E5=8A=A0=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/platform_orders/form.blade.php | 6 ++ ...newalHintWhenSubscriptionPrefilledTest.php | 62 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 tests/Feature/AdminPlatformOrderCreateShowsRenewalHintWhenSubscriptionPrefilledTest.php diff --git a/resources/views/admin/platform_orders/form.blade.php b/resources/views/admin/platform_orders/form.blade.php index c3a82f9..d6b50f6 100644 --- a/resources/views/admin/platform_orders/form.blade.php +++ b/resources/views/admin/platform_orders/form.blade.php @@ -15,6 +15,12 @@ {{ $siteSubscription->subscription_no }} (订阅ID:{{ $siteSubscription->id }}) + + @if((string) ($defaults['order_type'] ?? '') === 'renewal') +
+ 提示:该订单类型为「续费」。在订单完成「标记支付并生效 → 同步订阅」后,将会对该订阅执行续期/延长到期时间(以系统同步结果为准)。 +
+ @endif @endif diff --git a/tests/Feature/AdminPlatformOrderCreateShowsRenewalHintWhenSubscriptionPrefilledTest.php b/tests/Feature/AdminPlatformOrderCreateShowsRenewalHintWhenSubscriptionPrefilledTest.php new file mode 100644 index 0000000..c71b5ea --- /dev/null +++ b/tests/Feature/AdminPlatformOrderCreateShowsRenewalHintWhenSubscriptionPrefilledTest.php @@ -0,0 +1,62 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_create_page_should_show_renewal_hint_when_site_subscription_prefilled_and_order_type_is_renewal(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'po_create_renewal_hint_plan', + 'name' => '创建平台订单续费提示测试套餐', + '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_PO_CREATE_RENEWAL_HINT_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(), + ]); + + $res = $this->get('/admin/platform-orders/create?site_subscription_id=' . $sub->id . '&order_type=renewal'); + $res->assertOk(); + + $res->assertSee('该订单类型为「续费」', false); + $res->assertSee('将会对该订阅执行续期/延长到期时间', false); + } +}