ui(platform-orders): add bmpa run_id badge with quick links

This commit is contained in:
萝卜
2026-03-17 14:20:43 +08:00
parent a806ed9b1c
commit eef0fbad8a
2 changed files with 72 additions and 0 deletions

View File

@@ -542,6 +542,40 @@
</div>
@endif
@php
$batchBmpaRunId = trim((string) ($filters['batch_bmpa_run_id'] ?? ''));
@endphp
@if($batchBmpaRunId !== '')
@php
$bmpaGoFailedUrl = $buildQuickFilterUrl([
'batch_bmpa_run_id' => $batchBmpaRunId,
'bmpa_failed_only' => '1',
'page' => null,
]);
$bmpaGoAllUrl = $buildQuickFilterUrl([
'batch_bmpa_run_id' => $batchBmpaRunId,
'page' => null,
]);
@endphp
<div class="card mb-20 governance-block" data-role="batch-bmpa-run-id-badge">
<div class="muted governance-block-title"><strong>当前 BMPA 批次筛选</strong></div>
<div class="muted governance-block-body">
<div>
当前 BMPA run_id<strong>{{ $batchBmpaRunId }}</strong>
<span class="muted"></span>
<a class="btn btn-secondary btn-sm" href="{!! $safeFullUrlWithQuery(['batch_bmpa_run_id' => null, 'page' => null]) !!}">清除 BMPA 批次筛选</a>
</div>
<div class="mt-6">
<span class="muted">快速查看:</span>
<a class="link" href="{!! $bmpaGoAllUrl !!}">本批次全部</a>
<span class="muted"></span>
<a class="link" href="{!! $bmpaGoFailedUrl !!}">本批次 BMPA 失败</a>
</div>
</div>
</div>
@endif
<div class="grid-3 mb-20">
<div class="card">
<h3>平台订单总数</h3>

View File

@@ -0,0 +1,38 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderIndexBatchBmpaRunIdBadgeShouldRenderTest 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_platform_orders_page_should_render_batch_bmpa_run_id_badge_and_quick_links(): void
{
$this->loginAsPlatformAdmin();
$runId = 'BMPA_TEST_BADGE_0001';
$html = $this->get('/admin/platform-orders?batch_bmpa_run_id=' . $runId)
->assertOk()
->getContent();
$this->assertStringContainsString('当前 BMPA run_id<strong>' . $runId . '</strong>', $html);
// 快捷入口:本批次失败(应带 batch_bmpa_run_id + bmpa_failed_only=1
$this->assertStringContainsString('batch_bmpa_run_id=' . $runId, $html);
$this->assertStringContainsString('bmpa_failed_only=1', $html);
}
}