退货对账:每页固定展示15条数据 #398

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

View File

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

View File

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

View File

@ -8,6 +8,7 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Validation\ValidationException;
use Modules\EcommerceFinance\Services\PayablesFinalImporter;
use Modules\EcommerceFinance\Services\PayablesFinalRegistry;
use Modules\EcommerceFinance\Services\SupplierPayableOverrideStore;
use Tests\Feature\FeatureTestCase;
class SupplierPayableFinalPagesTest extends FeatureTestCase
@ -203,6 +204,50 @@ class SupplierPayableFinalPagesTest extends FeatureTestCase
$this->assertStringNotContainsString('快递名称', $export->streamedContent());
}
public function test_final_return_reconciliation_page_paginates_fifteen_rows(): void
{
$records = [];
for ($index = 1; $index <= 20; $index++) {
$records[sprintf('return:%02d', $index)] = [
'summary_month' => '2026-09',
'send_time' => '2026-09-30',
'supplier' => '退货供应商',
'barcode' => sprintf('RC-%02d', $index),
'sku_name' => '退货商品',
'qty' => '1',
'unit_price' => '10',
'amount' => '10',
];
}
app(SupplierPayableOverrideStore::class)->saveBatch(
'final:supplier:return-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' => 'return-reconciliation',
]);
$url = fn (int $page): string => $baseUrl . '?page=' . $page;
$this->loginAs()->get($url(1))
->assertOk()
->assertSeeText('每页 15 条')
->assertSeeText('第 1 页 / 共 2 页')
->assertSeeText('RC-01')
->assertDontSeeText('RC-16');
$this->loginAs()->get($url(2))
->assertOk()
->assertSeeText('第 2 页 / 共 2 页')
->assertSeeText('RC-16')
->assertSeeText('RC-20')
->assertDontSeeText('RC-01');
}
public function test_final_import_reads_files_larger_than_one_chunk(): void
{
$lines = ['月份,入库单号,采购单号,日期,供应商,货号,商品编码,规格名称,数量,单价,金额,预估单价,预估金额,供应商商品编码,备注,仓库名称,快递名称,快递单号,未发出,对账人'];