创建平台订单:续费且关联订阅时增加运营提示

This commit is contained in:
萝卜
2026-03-13 20:40:54 +00:00
parent 55871f39ed
commit 9f89536933
2 changed files with 68 additions and 0 deletions

View File

@@ -15,6 +15,12 @@
<a class="link" href="/admin/site-subscriptions/{{ $siteSubscription->id }}">{{ $siteSubscription->subscription_no }}</a> <a class="link" href="/admin/site-subscriptions/{{ $siteSubscription->id }}">{{ $siteSubscription->subscription_no }}</a>
<span class="muted">订阅ID{{ $siteSubscription->id }}</span> <span class="muted">订阅ID{{ $siteSubscription->id }}</span>
</div> </div>
@if((string) ($defaults['order_type'] ?? '') === 'renewal')
<div class="muted muted-xs" style="margin-top:6px;">
提示:该订单类型为「续费」。在订单完成「标记支付并生效 同步订阅」后,将会对该订阅执行续期/延长到期时间(以系统同步结果为准)。
</div>
@endif
</div> </div>
@endif @endif
</div> </div>

View File

@@ -0,0 +1,62 @@
<?php
namespace Tests\Feature;
use App\Models\Merchant;
use App\Models\Plan;
use App\Models\SiteSubscription;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderCreateShowsRenewalHintWhenSubscriptionPrefilledTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->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);
}
}