供应商对账:查看比对改为独立明细视图,返回列表按钮

财务端供应商一多(100+ 家),查看比对不再把明细堆在列表下面:点「查看比对」进入只显示该厂家明细的视图(含汇总、行级差异、返回供应商列表按钮),返回时保留月份/对账人筛选。
This commit is contained in:
苏木 2026-10-17 09:23:24 +08:00
parent 3b4db0e273
commit 691fabefbd
3 changed files with 62 additions and 1 deletions

View File

@ -89,10 +89,13 @@ class SupplierReconciliationPageData
$uploads[$name] = $latest[0] ?? null;
}
// 选中厂家时页面切换成「比对明细」视图(列表不再渲染,避免 100+ 家时往下翻)。
$selected = trim((string) request()->query('supplier', ''));
$detail = null;
if ($selected !== '' && in_array($selected, $supplierNames, true)) {
$detail = $this->detail($mine, $selected, $companyId);
} else {
$selected = '';
}
return [
@ -105,6 +108,12 @@ class SupplierReconciliationPageData
'reconciler' => $reconciler,
'selectedSupplier' => $selected,
'detail' => $detail,
'listUrl' => route('business.pages.show', array_filter([
'section' => 'supplier-reconciliation',
'page' => 'finance-data',
'month' => $month,
'reconciler' => $reconciler,
], static fn (mixed $value): bool => $value !== '' && $value !== null)),
'statementTemplateUrl' => route('business.supplier-reconciliation.template'),
'uploadUrl' => route('business.supplier-reconciliation.statement.upload'),
];

View File

@ -78,6 +78,25 @@
</p>
</div>
@if ($detail)
<div class="sr-card">
<div class="sr-toolbar">
<h2>{{ $selectedSupplier }} · 比对明细</h2>
<span class="sr-muted" style="font-size:.75rem">
月份 {{ $month !== '' ? $month : '全部' }}
@if ($reconciler !== '') · 对账人 {{ $reconciler }} @endif
@if (($uploads[$selectedSupplier]['uploaded_at'] ?? null) !== null)
· 最近上传 {{ $uploads[$selectedSupplier]['uploaded_at'] }}({{ number_format((int) ($uploads[$selectedSupplier]['rows'] ?? 0)) }} 行)
@else
· 该厂家还没有上传对账单
@endif
</span>
<span style="flex:1 1 auto"></span>
<a href="{{ $listUrl }}" class="sr-button">← 返回供应商列表</a>
<a href="{{ $statementTemplateUrl }}" class="sr-button">下载对账单模板</a>
</div>
</div>
@else
<div class="sr-card">
<h2>各厂家上传情况(实时)</h2>
<div class="sr-scroll">
@ -108,10 +127,11 @@
</table>
</div>
</div>
@endif
@if ($detail)
<div class="sr-card">
<h2>{{ $selectedSupplier }} · 比对明细(我方 {{ number_format($detail['mineRows']) }} 行 / 厂家 {{ number_format($detail['theirsRows']) }} 行)</h2>
<h2>比对汇总(我方 {{ number_format($detail['mineRows']) }} 行 / 厂家 {{ number_format($detail['theirsRows']) }} 行)</h2>
<div class="sr-summary">
<div class="sr-summary-cell"><span>双方一致</span><b>{{ $detail['summary']['match'] }}</b></div>
<div class="sr-summary-cell"><span>厂家多(退回修改)</span><b>{{ $detail['summary']['supplierExtra'] }}</b></div>

View File

@ -72,6 +72,38 @@ class SupplierReconciliationTest extends FeatureTestCase
->assertDontSeeText('鸣飞家具');
}
public function test_comparison_detail_view_replaces_the_supplier_list(): void
{
$store = app(SupplierPayableOverrideStore::class);
$companyId = (int) $this->company->id;
$store->save('final:supplier:payment-reconciliation', 'line:000001', [
'summary_month' => '2026-09', 'supplier' => '晨丰', 'skuCode' => 'ZSJ-1',
'qty' => '2', 'unitPrice' => '128', 'amount' => '256', 'reconciler' => '张三',
], $companyId, null);
$store->save('final:supplier:payment-reconciliation', 'line:000002', [
'summary_month' => '2026-09', 'supplier' => '晨丰', 'skuCode' => 'ZSJ-2',
'qty' => '1', 'unitPrice' => '50', 'amount' => '50', 'reconciler' => '张三',
], $companyId, null);
$this->seedStatement('晨丰', [
$this->statementRow('ZSJ-1N1097V01', '128.00', '2', '256.00'),
$this->statementRow('ZSJ-3N1097V01', '80.00', '1', '80.00'),
]);
$this->loginAs()
->get(route('business.pages.show', [
'section' => 'supplier-reconciliation',
'page' => 'finance-data',
'supplier' => '晨丰',
]))
->assertOk()
->assertSeeText('比对明细')
->assertSeeText('返回供应商列表')
->assertSeeText('结算金额')
->assertSeeText('ZSJ-3')
->assertSeeText('ZSJ-2')
->assertDontSeeText('各厂家上传情况');
}
public function test_supplier_page_shows_uploads_and_return_rows(): void
{
$this->seedStatement('晨丰', [