platform orders: row hint for renewal missing subscription
This commit is contained in:
@@ -1241,6 +1241,12 @@
|
|||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
<span class="muted">-</span>
|
<span class="muted">-</span>
|
||||||
|
@if((string) ($order->order_type ?? '') === 'renewal')
|
||||||
|
<div class="muted muted-xs text-danger row-warn">
|
||||||
|
<span class="row-warn-prefix">治理</span>
|
||||||
|
续费单未绑定订阅
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<?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 AdminPlatformOrderIndexRenewalMissingSubscriptionRowHintTest 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_index_should_show_row_hint_when_renewal_order_missing_subscription(): void
|
||||||
|
{
|
||||||
|
$this->loginAsPlatformAdmin();
|
||||||
|
|
||||||
|
$merchant = Merchant::query()->firstOrFail();
|
||||||
|
$plan = Plan::query()->create([
|
||||||
|
'code' => 'po_index_row_hint_renewal_missing_sub_plan',
|
||||||
|
'name' => '平台订单列表行提示(续费缺订阅)测试套餐',
|
||||||
|
'billing_cycle' => 'monthly',
|
||||||
|
'price' => 10,
|
||||||
|
'list_price' => 10,
|
||||||
|
'status' => 'active',
|
||||||
|
'sort' => 10,
|
||||||
|
'published_at' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$bad = PlatformOrder::query()->create([
|
||||||
|
'merchant_id' => $merchant->id,
|
||||||
|
'plan_id' => $plan->id,
|
||||||
|
'order_no' => 'PO_INDEX_ROW_HINT_RENEW_NO_SUB_0001',
|
||||||
|
'order_type' => 'renewal',
|
||||||
|
'status' => 'activated',
|
||||||
|
'payment_status' => 'paid',
|
||||||
|
'plan_name' => $plan->name,
|
||||||
|
'billing_cycle' => $plan->billing_cycle,
|
||||||
|
'period_months' => 1,
|
||||||
|
'quantity' => 1,
|
||||||
|
'payable_amount' => 10,
|
||||||
|
'paid_amount' => 10,
|
||||||
|
'placed_at' => now()->subMinutes(10),
|
||||||
|
'paid_at' => now()->subMinutes(9),
|
||||||
|
'activated_at' => now()->subMinutes(8),
|
||||||
|
'meta' => [],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->get('/admin/platform-orders?renewal_missing_subscription=1')
|
||||||
|
->assertOk()
|
||||||
|
->assertSee($bad->order_no)
|
||||||
|
->assertSee('续费', false)
|
||||||
|
->assertSee('未绑定订阅', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user