ui: reconcile mismatch summary link keeps filters

This commit is contained in:
萝卜
2026-03-11 07:24:28 +00:00
parent 73dd49ac43
commit 62500e5a03
2 changed files with 76 additions and 1 deletions

View File

@@ -207,7 +207,7 @@
<div class="metric-number">¥{{ number_format($delta, 2) }}</div>
<div class="muted muted-xs">{{ $summaryStats['reconciliation_delta_note'] ?? '回执总额 - 订单已付总额' }}(当前筛选范围)</div>
<div class="muted muted-xs">对账不一致订单:
<a class="link" href="/admin/platform-orders?reconcile_mismatch=1">{{ $summaryStats['reconcile_mismatch_orders'] ?? 0 }}</a>
<a class="link" href="{{ request()->fullUrlWithQuery(['reconcile_mismatch' => '1', 'page' => null]) }}">{{ $summaryStats['reconcile_mismatch_orders'] ?? 0 }}</a>
</div>
@if(abs($delta) >= 0.01)
<div class="muted text-danger mt-6">提示:差额非 0,可能存在回执金额与订单金额不一致的订单。</div>

View File

@@ -0,0 +1,75 @@
<?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 AdminPlatformOrderReconcileMismatchSummaryCardLinkTest 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_summary_card_reconcile_mismatch_orders_link_keeps_filters_and_clears_page(): void
{
$this->loginAsPlatformAdmin();
$merchant = Merchant::query()->firstOrFail();
$plan = Plan::query()->create([
'code' => 'reconcile_mismatch_summary_link_01',
'name' => '对账不一致摘要卡链接测试套餐',
'billing_cycle' => 'monthly',
'price' => 10,
'list_price' => 10,
'status' => 'active',
'sort' => 10,
'published_at' => now(),
]);
// 构造一个对账不一致订单
PlatformOrder::query()->create([
'merchant_id' => $merchant->id,
'plan_id' => $plan->id,
'order_no' => 'PO_RECON_SUMMARY_LINK_0001',
'order_type' => 'new_purchase',
'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.99,
],
],
]);
$url = '/admin/platform-orders?plan_id=' . $plan->id . '&page=2';
// 期望链接保留 plan_id并清空 page回到第一页
$this->get($url)
->assertOk()
->assertSee('reconcile_mismatch=1', false)
->assertSee('plan_id=' . $plan->id, false)
->assertDontSee('page=2', false);
}
}