界面: 平台订单快捷筛选新增已付无回执入口

This commit is contained in:
萝卜
2026-03-18 14:45:10 +08:00
parent 7cc3e24846
commit a666c72622
2 changed files with 60 additions and 0 deletions

View File

@@ -343,6 +343,7 @@
<div class="inline-links mt-6">
<a href="{!! $buildQuickFilterUrl(['receipt_status' => 'has']) !!}" class="muted">有回执</a>
<a href="{!! $buildQuickFilterUrl(['receipt_status' => 'none']) !!}" class="muted">无回执</a>
<a href="{!! $buildQuickFilterUrl(['payment_status' => 'paid', 'receipt_status' => 'none']) !!}" class="muted">已付无回执</a>
<a href="{!! $buildQuickFilterUrl(['refund_status' => 'has']) !!}" class="muted">有退款</a>
<a href="{!! $buildQuickFilterUrl(['refund_status' => 'none']) !!}" class="muted">无退款</a>
<a href="{!! $buildQuickFilterUrl(['payment_status' => 'partially_refunded']) !!}" class="muted">部分退款</a>

View File

@@ -0,0 +1,59 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderIndexQuickFilterPaidNoReceiptLinkShouldPreserveContextTest 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_paid_no_receipt_quick_filter_link_should_preserve_context_and_clear_tool_toggles(): void
{
$this->loginAsPlatformAdmin();
// 从复杂上下文进入:保留 merchant_id + 时间范围,但不应把工具型开关继承到快捷筛选链接里。
$res = $this->get('/admin/platform-orders?' . http_build_query([
'merchant_id' => 1,
'created_from' => '2026-03-01',
'created_to' => '2026-03-18',
'fail_only' => 1,
'bmpa_failed_only' => 1,
]));
$res->assertOk();
$html = (string) $res->getContent();
// 定位“已付无回执”快捷筛选链接
$this->assertMatchesRegularExpression('/<a[^>]*href="([^"]+)"[^>]*class="muted"[^>]*>已付无回执<\/a>/', $html);
preg_match('/<a[^>]*href="([^"]+)"[^>]*class="muted"[^>]*>已付无回执<\/a>/', $html, $m);
$href = html_entity_decode($m[1] ?? '');
$query = parse_url($href, PHP_URL_QUERY) ?: '';
parse_str($query, $q);
// 目标筛选payment_status=paid + receipt_status=none
$this->assertSame('paid', (string) ($q['payment_status'] ?? ''));
$this->assertSame('none', (string) ($q['receipt_status'] ?? ''));
// 保留业务上下文
$this->assertSame('1', (string) ($q['merchant_id'] ?? ''));
$this->assertSame('2026-03-01', (string) ($q['created_from'] ?? ''));
$this->assertSame('2026-03-18', (string) ($q['created_to'] ?? ''));
// 不继承工具型开关
$this->assertArrayNotHasKey('fail_only', $q);
$this->assertArrayNotHasKey('bmpa_failed_only', $q);
}
}