From c9f3e5b323256da8f59db614f677b1f8d9ffb672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E6=9C=A8?= <594326199@qq.com> Date: Sat, 17 Oct 2026 09:47:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E5=AF=B9=E8=B4=A6?= =?UTF-8?q?=EF=BC=9A=E5=8E=82=E5=AE=B6=E4=B8=8A=E4=BC=A0=E7=9A=84=E5=AF=B9?= =?UTF-8?q?=E8=B4=A6=E6=95=B0=E6=8D=AE=E6=94=B9=E4=B8=BA=E6=AF=8F=E9=A1=B5?= =?UTF-8?q?=2015=20=E8=A1=8C=20+=20=E9=A1=B5=E7=A0=81=E7=BF=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上传的对账数据表原来一页 100 行太长:改为每页 15 行的短表,底部显示总行数/页码(首尾页+当前页附近页码、上一页/下一页),翻页保留所选厂家。 --- .../View/SupplierReconciliationPageData.php | 3 +- .../supplier-data.blade.php | 28 +++++++++++++++++-- .../Business/SupplierReconciliationTest.php | 27 ++++++++++++++++++ 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/modules/EcommerceFinance/View/SupplierReconciliationPageData.php b/modules/EcommerceFinance/View/SupplierReconciliationPageData.php index 08ad4d0d..a66abff4 100644 --- a/modules/EcommerceFinance/View/SupplierReconciliationPageData.php +++ b/modules/EcommerceFinance/View/SupplierReconciliationPageData.php @@ -15,7 +15,8 @@ use Modules\EcommerceFinance\Services\SupplierStatementStore; */ class SupplierReconciliationPageData { - private const PER_PAGE = 100; + /** 厂家上传的对账数据表:每页行数(短表 + 翻页)。 */ + private const PER_PAGE = 15; public function __construct( private readonly SupplierPayableOverrideStore $store, diff --git a/resources/views/business/pages/supplier-reconciliation/supplier-data.blade.php b/resources/views/business/pages/supplier-reconciliation/supplier-data.blade.php index e65fbb4a..f4d02676 100644 --- a/resources/views/business/pages/supplier-reconciliation/supplier-data.blade.php +++ b/resources/views/business/pages/supplier-reconciliation/supplier-data.blade.php @@ -132,13 +132,35 @@ @if ($statementTotal > $perPage) + @php + $pageCount = max((int) ceil($statementTotal / $perPage), 1); + $pageStart = max(1, min($rowsPage - 4, $pageCount - 8)); + $pageEnd = min($pageCount, $pageStart + 8); + $pageUrl = fn (int $number): string => route('business.pages.show', [ + 'section' => $section['slug'], 'page' => $page['slug'], + 'supplier' => $selectedSupplier, 'rows_page' => $number, + ]); + @endphp
- 第 {{ $rowsPage }} 页 / 共 {{ max((int) ceil($statementTotal / $perPage), 1) }} 页 + 共 {{ number_format($statementTotal) }} 行,每页 {{ $perPage }} 行 · 第 {{ $rowsPage }} / {{ $pageCount }} 页 @if ($rowsPage > 1) - 上一页 + 上一页 + @endif + @if ($pageStart > 1) + 1 + @if ($pageStart > 2) … @endif + @endif + @for ($number = $pageStart; $number <= $pageEnd; $number++) + {{ $number }} + @endfor + @if ($pageEnd < $pageCount) + @if ($pageEnd < $pageCount - 1) … @endif + {{ $pageCount }} @endif @if ($rowsPage * $perPage < $statementTotal) - 下一页 + 下一页 @endif
@endif diff --git a/tests/Feature/Business/SupplierReconciliationTest.php b/tests/Feature/Business/SupplierReconciliationTest.php index d3556204..426f46a0 100644 --- a/tests/Feature/Business/SupplierReconciliationTest.php +++ b/tests/Feature/Business/SupplierReconciliationTest.php @@ -134,6 +134,33 @@ class SupplierReconciliationTest extends FeatureTestCase ->assertSeeText('ZSJ-1'); } + public function test_statement_rows_are_paginated_fifteen_per_page(): void + { + $rows = []; + for ($i = 1; $i <= 20; $i++) { + $rows[] = $this->statementRow(sprintf('ST-%02d', $i), '10.00', '1', '10.00'); + } + $this->seedStatement('晨丰', $rows); + + $pageUrl = fn (int $page): string => route('business.pages.show', [ + 'section' => 'supplier-reconciliation', + 'page' => 'supplier-data', + 'supplier' => '晨丰', + 'rows_page' => $page, + ]); + + $this->loginAs()->get($pageUrl(1)) + ->assertOk() + ->assertSeeText('每页 15 行') + ->assertSeeText('ST-01') + ->assertDontSeeText('ST-20'); + + $this->loginAs()->get($pageUrl(2)) + ->assertOk() + ->assertSeeText('ST-20') + ->assertDontSeeText('ST-01'); + } + public function test_return_rows_can_be_confirmed_disputed_and_confirmed_all(): void { $store = app(SupplierPayableOverrideStore::class);