diff --git a/modules/EcommerceFinance/View/SupplierReconciliationPageData.php b/modules/EcommerceFinance/View/SupplierReconciliationPageData.php index 62230520..f1b87e62 100644 --- a/modules/EcommerceFinance/View/SupplierReconciliationPageData.php +++ b/modules/EcommerceFinance/View/SupplierReconciliationPageData.php @@ -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'), ]; diff --git a/resources/views/business/pages/supplier-reconciliation/finance-data.blade.php b/resources/views/business/pages/supplier-reconciliation/finance-data.blade.php index 3700621e..ff520032 100644 --- a/resources/views/business/pages/supplier-reconciliation/finance-data.blade.php +++ b/resources/views/business/pages/supplier-reconciliation/finance-data.blade.php @@ -78,6 +78,25 @@

+ @if ($detail) +
+
+

{{ $selectedSupplier }} · 比对明细

+ + 月份 {{ $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 + + + ← 返回供应商列表 + 下载对账单模板 +
+
+ @else

各厂家上传情况(实时)

@@ -108,10 +127,11 @@
+ @endif @if ($detail)
-

{{ $selectedSupplier }} · 比对明细(我方 {{ number_format($detail['mineRows']) }} 行 / 厂家 {{ number_format($detail['theirsRows']) }} 行)

+

比对汇总(我方 {{ number_format($detail['mineRows']) }} 行 / 厂家 {{ number_format($detail['theirsRows']) }} 行)

双方一致{{ $detail['summary']['match'] }}
厂家多(退回修改){{ $detail['summary']['supplierExtra'] }}
diff --git a/tests/Feature/Business/SupplierReconciliationTest.php b/tests/Feature/Business/SupplierReconciliationTest.php index 29ff7370..bd0580c9 100644 --- a/tests/Feature/Business/SupplierReconciliationTest.php +++ b/tests/Feature/Business/SupplierReconciliationTest.php @@ -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('晨丰', [