快递应付数据页显示总条数和总页数 #174

Merged
renshen merged 1 commits from feature/renshen-courier-page-totals into main 2026-09-12 18:00:07 +08:00
7 changed files with 27 additions and 16 deletions

View File

@ -533,7 +533,7 @@ class Pages extends Controller
}
}
protected function agreementTasks(?string $page): Collection
protected function agreementTasks(?string $page): Collection|\Illuminate\Contracts\Pagination\LengthAwarePaginator
{
if ($page !== 'agreement-signing') {
return collect();
@ -542,8 +542,7 @@ class Pages extends Controller
try {
return CourierAgreementSignature::query()
->latest('id')
->limit(50)
->get();
->paginate(50, ['*'], 'agreement_page')->withQueryString();
} catch (QueryException $exception) {
// 迁移尚未执行时仍允许打开页面;发送接口会明确提示数据库未就绪。
report($exception);
@ -569,7 +568,7 @@ class Pages extends Controller
}
}
protected function agreementQuoteSignatures(?string $page): Collection
protected function agreementQuoteSignatures(?string $page): Collection|\Illuminate\Contracts\Pagination\LengthAwarePaginator
{
if ($page !== 'agreement-signing') {
return collect();
@ -579,8 +578,7 @@ class Pages extends Controller
return CourierQuoteSignature::query()
->with('version')
->latest('id')
->limit(50)
->get();
->paginate(50, ['*'], 'agreement_page')->withQueryString();
} catch (QueryException $exception) {
// 报价签署迁移尚未执行时仍允许打开协议签署页。
report($exception);

View File

@ -1285,6 +1285,15 @@
</table>
</div>
@php($taskTotal = method_exists($agreementTasks, 'total') ? $agreementTasks->total() : $agreementTasks->count())
@php($quoteTotal = method_exists($agreementQuoteSignatures, 'total') ? $agreementQuoteSignatures->total() : $agreementQuoteSignatures->count())
@php($taskPages = method_exists($agreementTasks, 'lastPage') ? $agreementTasks->lastPage() : 0)
@php($quotePages = method_exists($agreementQuoteSignatures, 'lastPage') ? $agreementQuoteSignatures->lastPage() : 0)
@php($pageSource = $taskPages >= $quotePages ? $agreementTasks : $agreementQuoteSignatures)
<div class="agreement-panel-footnote">
<span>共 {{ $taskTotal + $quoteTotal }} 条 · 共 {{ $taskTotal + $quoteTotal > 0 ? max($taskPages, $quotePages) : 0 }} 页(每页两类签署记录各最多 50 条)</span>
@if (method_exists($pageSource, 'links')) {{ $pageSource->links() }} @endif
</div>
<div class="agreement-panel-footnote">
<span class="material-icons-outlined" aria-hidden="true">shield</span>
<span>签署完成只生成可核验的电子协议,不会自动启用新收款账户;账户变更仍需独立财务复核和原档案电话核验。</span>

View File

@ -93,7 +93,7 @@
</label>
@endforeach
</div><div class="sm-column-picker__foot"><button class="sm-button" type="button" data-column-reset><span class="material-icons-outlined" aria-hidden="true">restart_alt</span>恢复默认</button></div></div></div><button class="sm-button" type="button" data-surcharge-export-current><span class="material-icons-outlined" aria-hidden="true">download</span>导出当前列</button><button class="sm-button" type="button" data-surcharge-export-all><span class="material-icons-outlined" aria-hidden="true">file_download</span>导出全部字段</button><span class="sm-card__hint">规则按生效时间应用到后续结算页面</span></div></div>
<div class="sm-table-meta"><span>当前筛选结果(全部):<strong data-surcharge-row-count>{{ $rows->count() }}</strong> 条</span><span>规则编号与操作列固定显示;列设置仅保存于当前用户</span></div>
<div class="sm-table-meta"><span>当前筛选结果(全部):<strong data-surcharge-row-count>{{ $rows->count() }}</strong> 条 · 共 {{ $rows->isEmpty() ? 0 : 1 }} 页</span><span>规则编号与操作列固定显示;列设置仅保存于当前用户</span></div>
<div class="sm-table-wrap" data-surcharge-table-wrap><table class="sm-table" data-finance-table-native data-surcharge-table><thead><tr>
@foreach ($columns as $column)
<th scope="col" draggable="{{ empty($column['fixed']) ? 'true' : 'false' }}" data-column-header data-column-key="{{ $column['key'] }}" data-column-label="{{ $column['label'] }}" data-fixed="{{ !empty($column['fixed']) ? 'true' : 'false' }}"><span class="sm-table__header">@if (empty($column['fixed']))<span class="sm-table__drag material-icons-outlined" aria-hidden="true">drag_handle</span>@endif<span>{{ $column['label'] }}</span></span></th>

View File

@ -87,8 +87,8 @@
<tr><td colspan="23" class="px-4 py-16 text-center text-sm text-gray-500">@if ($freightReconciliationPending ?? false) 正在等待物流明细镜像首次同步完成… @else 暂无符合条件的运费对账数据 @endif</td></tr>
@endforelse
</tbody></table></div>
@if (($freightReconciliations ?? null)?->hasPages())
<div class="flex items-center justify-between border-t border-[#eee8de] px-4 py-3 text-sm text-gray-500"><span>第 {{ $freightReconciliations->currentPage() }} 页 · 本页 {{ $freightReconciliations->count() }} 条</span><div>{{ $freightReconciliations->links() }}</div></div>
@if ($freightReconciliations ?? null)
<div class="flex flex-wrap items-center justify-between border-t border-[#eee8de] px-4 py-3 text-sm text-gray-500"><span><span data-recon-page-totals data-per-page="{{ $freightReconciliations->perPage() }}">@if ($summaryReady) 共 {{ number_format((int) $summary['count']) }} 条 · 共 {{ (int) ceil($summary['count'] / $freightReconciliations->perPage()) }} 页 @else 总条数 / 总页数计算中 @endif</span> · 当前第 {{ $freightReconciliations->currentPage() }} 页 · 本页 {{ $freightReconciliations->count() }} 条</span><div>{{ $freightReconciliations->links() }}</div></div>
@endif
</div>
</div>
@ -117,9 +117,13 @@
current.querySelector('[data-summary-freight]').textContent = '¥ ' + new Intl.NumberFormat('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(data.freight);
current.querySelector('[data-summary-status]').textContent = '完整筛选汇总 · ' + data.computed_at;
current.dataset.summaryReady = 'true';
const totals = document.querySelector('[data-recon-page-totals]');
if (totals) totals.textContent = '共 ' + new Intl.NumberFormat('zh-CN').format(data.count) + ' 条 · 共 ' + Math.ceil(data.count / Number(totals.dataset.perPage)) + ' 页';
} catch (_) {
const status = document.querySelector('[data-courier-summary] [data-summary-status]');
if (window.location.href === locationKey && status) status.textContent = '完整汇总暂时无法计算,明细仍可正常查看。';
const totals = document.querySelector('[data-recon-page-totals]');
if (window.location.href === locationKey && totals) totals.textContent = '总条数 / 总页数暂不可用';
}
};
load();

View File

@ -251,7 +251,7 @@
<div class="table-panel">
<div class="table-toolbar">
<strong>{{ $title }}</strong>
<span>共 {{ $recordCount }} 条</span>
<span>共 {{ $recordCount }} 条 · 共 {{ $recordCount > 0 ? 1 : 0 }} 页</span>
</div>
<div class="table-scroll">

View File

@ -82,7 +82,7 @@
<span>筛选:类型=快递运费,且用途同时包含“仓”“车费”</span>
<span>镜像状态:{{ $status }}</span>
@if ($syncedAt) <span>最近同步:{{ $syncedAt }}</span> @endif
<span>共 {{ $rows?->total() ?? 0 }} 条明细</span>
<span>共 {{ $rows?->total() ?? 0 }} 条 · 共 {{ $rows ? $rows->lastPage() : 0 }} 页</span>
</div>
<div class="ding-payable-table-wrap">
@ -126,12 +126,12 @@
@endforelse
</tbody>
</table>
</div>
<div class="ding-payable-pagination">
<span>当前页 {{ $rows?->count() ?? 0 }} 条 · 第 {{ $rows?->currentPage() ?? 1 }} 页</span>
<span>共 {{ $rows?->total() ?? 0 }} 条 · 共 {{ $rows ? $rows->lastPage() : 0 }} 页 · 当前第 {{ $rows?->currentPage() ?? 1 }} 页 · 本页 {{ $rows?->count() ?? 0 }} 条</span>
<span>
@if ($rows && !$rows->onFirstPage())<a href="{{ $rows->previousPageUrl() }}">上一页</a>@endif
@if ($rows && $rows->hasMorePages())<a href="{{ $rows->nextPageUrl() }}">下一页</a>@endif
</span>
</div>
</div>
</div>

View File

@ -920,13 +920,13 @@
root.querySelector('[data-quote-result-count]').textContent = '共 ' + filteredQuotes.length + ' 个报价版本';
root.querySelector('[data-quote-page-label]').textContent = filteredQuotes.length
? '第 ' + currentPage + ' / ' + pageCount + ' 页'
: '没有匹配记录';
? '共 ' + filteredQuotes.length + ' 条 · 共 ' + pageCount + ' 页 · 当前第 ' + currentPage + ' 页'
: '共 0 条 · 共 0 页';
root.querySelector('[data-quote-page="previous"]').disabled = currentPage <= 1;
root.querySelector('[data-quote-page="next"]').disabled = currentPage >= pageCount;
tableWrap.hidden = filteredQuotes.length === 0;
empty.hidden = filteredQuotes.length !== 0;
pagination.hidden = filteredQuotes.length === 0;
pagination.hidden = false;
updateUrl();
}