admin: 平台订单列表续费缺订阅时补充行级治理提示入口(去关联订阅)
This commit is contained in:
@@ -1795,9 +1795,10 @@
|
||||
// 精简视图也要可达的“治理入口”:不要只依赖可选列(col-optional)里的提示
|
||||
$reconcileFixUrlCompact = \App\Support\BackUrl::withBackAndFragment('/admin/platform-orders/' . $order->id, $selfWithoutBack, 'add-payment-receipt');
|
||||
$refundFixUrlCompact = \App\Support\BackUrl::withBackAndFragment('/admin/platform-orders/' . $order->id, $selfWithoutBack, 'add-refund-receipt');
|
||||
$relationFixUrlCompactForBmpa = \App\Support\BackUrl::withBackAndFragment('/admin/platform-orders/' . $order->id, $selfWithoutBack, 'relation-subscription');
|
||||
@endphp
|
||||
|
||||
@if($needReconcileFix || $needRefundFix)
|
||||
@if($needReconcileFix || $needRefundFix || $blockedByMissingSubscriptionOnRenewal)
|
||||
<div class="governance-hints row-warn">
|
||||
@if($needReconcileFix)
|
||||
<div class="muted text-danger muted-xs governance-hint">
|
||||
@@ -1813,6 +1814,13 @@
|
||||
<a class="link" href="{!! $refundFixUrlCompact !!}">去核对退款</a>
|
||||
</div>
|
||||
@endif
|
||||
@if($blockedByMissingSubscriptionOnRenewal)
|
||||
<div class="muted text-danger muted-xs governance-hint">
|
||||
<span class="row-warn-prefix">订阅</span>
|
||||
<span class="muted">|</span>
|
||||
<a class="link" href="{!! $relationFixUrlCompactForBmpa !!}">去关联订阅</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Merchant;
|
||||
use App\Models\Plan;
|
||||
use App\Models\PlatformOrder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderIndexRowMarkPaidAndActivateButtonShouldDisableWhenRenewalMissingSubscriptionTest 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_row_mark_paid_and_activate_button_should_be_disabled_when_renewal_missing_subscription(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$merchant = Merchant::query()->firstOrFail();
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'po_index_row_bmpa_disable_renewal_missing_sub_plan',
|
||||
'name' => '平台订单列表行级BMPA禁用(续费缺订阅)测试套餐',
|
||||
'billing_cycle' => 'monthly',
|
||||
'price' => 30,
|
||||
'list_price' => 30,
|
||||
'status' => 'active',
|
||||
'sort' => 10,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
// 构造:续费单缺订阅(脏数据),列表页应禁用 BMPA 并给出“去关联订阅”最短治理入口。
|
||||
$order = PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchant->id,
|
||||
'plan_id' => $plan->id,
|
||||
'order_no' => 'PO_INDEX_ROW_BMPA_DISABLE_RENEW_MISS_SUB_0001',
|
||||
'order_type' => 'renewal',
|
||||
'site_subscription_id' => null,
|
||||
'status' => 'pending',
|
||||
'payment_status' => 'unpaid',
|
||||
'plan_name' => $plan->name,
|
||||
'billing_cycle' => $plan->billing_cycle,
|
||||
'period_months' => 1,
|
||||
'quantity' => 1,
|
||||
'payable_amount' => 30,
|
||||
'paid_amount' => 0,
|
||||
'placed_at' => now(),
|
||||
'meta' => [],
|
||||
]);
|
||||
|
||||
$res = $this->get('/admin/platform-orders');
|
||||
$res->assertOk();
|
||||
|
||||
$html = (string) $res->getContent();
|
||||
$this->assertStringContainsString($order->order_no, $html);
|
||||
|
||||
// 断言:该订单所在行的“标记支付并生效”按钮应被禁用(避免运营在列表页误触)
|
||||
$pattern = '#/admin/platform-orders/' . $order->id . '/mark-paid-and-activate.*?<button[^>]*disabled#s';
|
||||
$this->assertMatchesRegularExpression($pattern, $html);
|
||||
|
||||
// 并且应提供最短治理入口(续费缺订阅:去关联订阅)
|
||||
$this->assertStringContainsString('#relation-subscription', $html);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user