订阅详情:对账/退款异常提示改用治理 CSS 组件并加护栏测试
This commit is contained in:
@@ -237,11 +237,14 @@
|
||||
@php $refundTol = (float) config('saasshop.amounts.tolerance', 0.01); @endphp
|
||||
<div class="muted muted-xs">当前容差:¥{{ number_format($refundTol, 2) }}</div>
|
||||
@if(((int) ($summaryStats['refund_inconsistent_orders'] ?? 0)) > 0)
|
||||
<div class="muted muted-xs text-danger">
|
||||
提示:存在退款状态与退款总额不一致订单。
|
||||
<div class="card governance-block" style="margin-top:10px;">
|
||||
<div class="muted text-danger governance-block-title"><strong>退款不一致治理提示</strong></div>
|
||||
<div class="muted governance-block-body">
|
||||
存在退款状态与退款总额不一致订单。
|
||||
<a class="link" href="{!! $makePlatformOrderUrl(['site_subscription_id' => $subscription->id, 'refund_inconsistent' => '1']) !!}">进入退款不一致订单列表</a>
|
||||
(建议先逐单核对退款轨迹,再在订单详情页使用「退款状态治理」修正状态;仅修口径,不会自动生成回执/退款回执)。
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -258,13 +261,21 @@
|
||||
</div>
|
||||
@php $tol = (float) config('saasshop.amounts.tolerance', 0.01); @endphp
|
||||
@if(((int) ($summaryStats['reconcile_mismatch_orders'] ?? 0)) > 0)
|
||||
<div class="muted muted-xs text-danger">
|
||||
提示:存在「回执总额 vs 已付金额」不一致订单。
|
||||
<div class="card governance-block" style="margin-top:10px;">
|
||||
<div class="muted text-danger governance-block-title"><strong>对账不一致治理提示</strong></div>
|
||||
<div class="muted governance-block-body">
|
||||
存在「回执总额 vs 已付金额」不一致订单。
|
||||
<a class="link" href="{!! $makePlatformOrderUrl(['site_subscription_id' => $subscription->id, 'reconcile_mismatch' => '1']) !!}">进入对账不一致订单列表</a>
|
||||
(建议先逐单核对回执轨迹与订单金额,再决定是否补回执/修正订单金额口径)。
|
||||
</div>
|
||||
</div>
|
||||
@elseif(abs($delta) >= $tol)
|
||||
<div class="muted muted-xs text-danger">提示:差额超过容差(tol={{ number_format($tol, 2) }}),可能存在回执金额与订单已付金额不一致。</div>
|
||||
<div class="card governance-block" style="margin-top:10px;">
|
||||
<div class="muted text-danger governance-block-title"><strong>对账差额提示</strong></div>
|
||||
<div class="muted governance-block-body">
|
||||
差额超过容差(tol={{ number_format($tol, 2) }}),可能存在回执金额与订单已付金额不一致。
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="muted muted-xs">差额在容差范围内(tol={{ number_format($tol, 2) }},当前订阅维度)</div>
|
||||
@endif
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Merchant;
|
||||
use App\Models\Plan;
|
||||
use App\Models\PlatformOrder;
|
||||
use App\Models\SiteSubscription;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminSiteSubscriptionShowGovernanceBlocksUseCssComponentTest 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_show_should_render_governance_blocks_with_css_component_class_when_mismatch_present(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$merchant = Merchant::query()->firstOrFail();
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'sub_show_gov_block_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' => 'active',
|
||||
'source' => 'manual',
|
||||
'subscription_no' => 'SUB_SHOW_GOV_BLOCK_0001',
|
||||
'plan_name' => $plan->name,
|
||||
'billing_cycle' => $plan->billing_cycle,
|
||||
'period_months' => 1,
|
||||
'amount' => 10,
|
||||
'starts_at' => now(),
|
||||
'ends_at' => now()->addMonth(),
|
||||
]);
|
||||
|
||||
// 构造一条对账不一致订单(receipt_total=9, paid_amount=10)
|
||||
PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchant->id,
|
||||
'plan_id' => $plan->id,
|
||||
'site_subscription_id' => $sub->id,
|
||||
'order_no' => 'PO_SUB_SHOW_GOV_RECON_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(),
|
||||
'paid_at' => now(),
|
||||
'activated_at' => now(),
|
||||
'meta' => [
|
||||
'payment_summary' => [
|
||||
'count' => 1,
|
||||
'total_amount' => 9,
|
||||
],
|
||||
'payment_receipts' => [
|
||||
[
|
||||
'type' => 'bank_transfer',
|
||||
'channel' => 'offline',
|
||||
'amount' => 9,
|
||||
'paid_at' => now()->toDateTimeString(),
|
||||
'created_at' => now()->toDateTimeString(),
|
||||
'admin_id' => 1,
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$res = $this->get('/admin/site-subscriptions/' . $sub->id);
|
||||
$res->assertOk();
|
||||
|
||||
$res->assertSee('governance-block', false);
|
||||
$res->assertSee('governance-block-title', false);
|
||||
$res->assertSee('governance-block-body', false);
|
||||
$res->assertSee('对账不一致治理提示', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user