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); + } +}