货款对账:每页固定展示15条数据 #399

Merged
renshen merged 1 commits from feature/sumu-payment-page-15 into main 2026-10-20 09:48:26 +08:00
3 changed files with 50 additions and 3 deletions

View File

@ -2741,8 +2741,8 @@ class Pages extends Controller
}));
}
// 退货明细较宽,固定每页 15 行,减少纵向滚动并保持横向核对区稳定。
$perPage = $dataset === 'return-reconciliation' ? 15 : 50;
// 货款/退货明细较宽,固定每页 15 行,减少纵向滚动并保持横向核对区稳定。
$perPage = in_array($dataset, ['payment-reconciliation', 'return-reconciliation'], true) ? 15 : 50;
$currentPage = max((int) request('page', 1), 1);
return [

View File

@ -119,7 +119,7 @@
<a href="{{ $finalRows->previousPageUrl() }}">上一页</a>
@endif
第 {{ $finalRows?->currentPage() ?? 1 }} 页 / 共 {{ $finalRows?->lastPage() ?? 1 }} 页
· 每页 {{ $finalRows?->perPage() ?? ($finalDataset === 'return-reconciliation' ? 15 : 50) }} 条
· 每页 {{ $finalRows?->perPage() ?? (in_array($finalDataset, ['payment-reconciliation', 'return-reconciliation'], true) ? 15 : 50) }} 条
@if ($finalRows?->hasMorePages())
<a href="{{ $finalRows->nextPageUrl() }}">下一页</a>
@endif

View File

@ -248,6 +248,53 @@ class SupplierPayableFinalPagesTest extends FeatureTestCase
->assertDontSeeText('RC-01');
}
public function test_final_payment_reconciliation_page_paginates_fifteen_rows(): void
{
$records = [];
for ($index = 1; $index <= 20; $index++) {
$records[sprintf('payment:%02d', $index)] = [
'summary_month' => '2026-09',
'stockNo' => sprintf('RK-%02d', $index),
'purchaseNo' => sprintf('CG-%02d', $index),
'date' => '2026-09-30',
'supplier' => '货款供应商',
'skuCode' => sprintf('PM-%02d', $index),
'productCode' => sprintf('P-%02d', $index),
'skuName' => '货款商品',
'qty' => '1',
'unitPrice' => '10',
'amount' => '10',
];
}
app(SupplierPayableOverrideStore::class)->saveBatch(
'final:supplier:payment-reconciliation',
$records,
(int) $this->company->id,
(int) $this->user->id,
);
$baseUrl = route('business.pages.show', [
'company_id' => (int) $this->company->id,
'section' => 'supplier-payables-final',
'page' => 'payment-reconciliation',
]);
$url = fn (int $page): string => $baseUrl . '?page=' . $page;
$this->loginAs()->get($url(1))
->assertOk()
->assertSeeText('每页 15 条')
->assertSeeText('第 1 页 / 共 2 页')
->assertSeeText('PM-01')
->assertDontSeeText('PM-16');
$this->loginAs()->get($url(2))
->assertOk()
->assertSeeText('第 2 页 / 共 2 页')
->assertSeeText('PM-16')
->assertSeeText('PM-20')
->assertDontSeeText('PM-01');
}
public function test_final_import_reads_files_larger_than_one_chunk(): void
{
$lines = ['月份,入库单号,采购单号,日期,供应商,货号,商品编码,规格名称,数量,单价,金额,预估单价,预估金额,供应商商品编码,备注,仓库名称,快递名称,快递单号,未发出,对账人'];