PlatformOrder create: add renewal target governance block
This commit is contained in:
@@ -45,6 +45,19 @@
|
||||
<div class="muted muted-xs mt-6">
|
||||
提示:该订单类型为「续费」。在订单完成「标记支付并生效 → 同步订阅」后,将会对该订阅执行续期/延长到期时间(以系统同步结果为准)。
|
||||
</div>
|
||||
|
||||
<div class="governance-block mt-10">
|
||||
<h4 class="governance-block-title">续费对象确认</h4>
|
||||
<div class="governance-block-body">
|
||||
<div>订阅号:<strong>{{ $siteSubscription->subscription_no }}</strong>(订阅ID:{{ $siteSubscription->id }})</div>
|
||||
<div>站点:{{ optional($siteSubscription->merchant)->name ?: ('#' . (int) $siteSubscription->merchant_id) }}</div>
|
||||
<div>套餐:{{ $siteSubscription->plan_name ?: optional($siteSubscription->plan)->name ?: ('#' . (int) $siteSubscription->plan_id) }}</div>
|
||||
<div>到期时间:{{ optional($siteSubscription->ends_at)->format('Y-m-d H:i:s') ?: '-' }}</div>
|
||||
</div>
|
||||
<div class="governance-block-footnote muted muted-xs">
|
||||
建议流程:创建订单 → 在订单详情执行「标记支付并生效」→ 再执行「同步订阅」。请在提交前确认续费对象无误,避免误给其它订阅续期。
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
<?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 AdminPlatformOrderCreateRenewalGovernanceBlockTest 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_form_should_render_renewal_governance_block_when_order_type_is_renewal_and_subscription_present(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$merchant = Merchant::query()->firstOrFail();
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'po_create_renewal_gov_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_RENEW_GOV_0001',
|
||||
'plan_name' => $plan->name,
|
||||
'billing_cycle' => $plan->billing_cycle,
|
||||
'period_months' => 1,
|
||||
'amount' => 10,
|
||||
'starts_at' => now()->subDay(),
|
||||
'ends_at' => now()->addDays(10),
|
||||
'activated_at' => now()->subDay(),
|
||||
]);
|
||||
|
||||
$url = '/admin/platform-orders/create?site_subscription_id=' . $sub->id . '&order_type=renewal';
|
||||
|
||||
$res = $this->get($url);
|
||||
$res->assertOk();
|
||||
|
||||
$res->assertSee('续费对象确认', false);
|
||||
$res->assertSee('SUB_RENEW_GOV_0001', false);
|
||||
$res->assertSee('订阅ID:' . $sub->id, false);
|
||||
|
||||
// 使用统一的治理提示块样式类(避免 inline style 漂移)
|
||||
$res->assertSee('class="governance-block', false);
|
||||
}
|
||||
|
||||
public function test_create_form_should_not_render_governance_block_when_order_type_is_not_renewal(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$merchant = Merchant::query()->firstOrFail();
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'po_create_non_renewal_gov_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_RENEW_GOV_0002',
|
||||
'plan_name' => $plan->name,
|
||||
'billing_cycle' => $plan->billing_cycle,
|
||||
'period_months' => 1,
|
||||
'amount' => 10,
|
||||
'starts_at' => now()->subDay(),
|
||||
'ends_at' => now()->addDays(10),
|
||||
'activated_at' => now()->subDay(),
|
||||
]);
|
||||
|
||||
$url = '/admin/platform-orders/create?site_subscription_id=' . $sub->id . '&order_type=new_purchase';
|
||||
|
||||
$res = $this->get($url);
|
||||
$res->assertOk();
|
||||
|
||||
$res->assertDontSee('续费对象确认', false);
|
||||
$res->assertDontSee('class="governance-block', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user