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);