fix(customers): 好友数跳转分页用真实过滤数——声明口径仅无过滤时展示
员工列表点「好友数」跳 /customers?owner_account_id=x 后,头部计数与 el-pagination 的 :total 都绑 declaredTotals(云客口径全局声明值,Σ员工 好友数,不吃任何过滤)——列表只有该员工 9 条,分页却按全部客户 8956 条/ 1792 页展示,用户报「不是员工下面的好友列表」。 修:新增 displayTotal()——无过滤时保持声明口径(页脚对齐云客的产品 定调不变),department/owner 任一过滤生效时回到 tabState 真实 total。 头部计数与微信/WA 两处分页器三处统一走它。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,20 @@ function freshTabState(pageSize = 5): TabState {
|
||||
/** 云客口径客户合计(分渠道,Σ员工好友数声明值,含云客索引重复;页脚对齐云客)。 */
|
||||
const declaredTotals = ref<{ wechat: number | null; whatsapp: number | null }>({ wechat: null, whatsapp: null })
|
||||
|
||||
/** 列表过滤是否生效(部门/员工)——生效时计数与分页必须用真实 total,声明口径是
|
||||
* 全局值不吃过滤:员工列表点「好友数」跳入时曾把 8956 当分页总数,列表却只有
|
||||
* 该员工的 9 条,翻页按全部客户算(2026-09-08 用户报「不是员工下面的好友列表」)。 */
|
||||
const filtered = computed(
|
||||
() => departmentId.value !== null || ownerId.value !== null,
|
||||
)
|
||||
|
||||
/** 展示用总数:无过滤时对齐云客声明口径(产品定调),有过滤时回到真实结果数。 */
|
||||
function displayTotal(tab: TabKey): number {
|
||||
return !filtered.value && declaredTotals.value[tab] !== null
|
||||
? (declaredTotals.value[tab] as number)
|
||||
: tabState[tab].total
|
||||
}
|
||||
|
||||
async function loadDeclaredTotal(): Promise<void> {
|
||||
try {
|
||||
const r = await getCustomerDeclaredTotal()
|
||||
@@ -440,7 +454,7 @@ onMounted(() => {
|
||||
<div>
|
||||
<h2 style="margin: 0 0 4px; font-size: 16px">{{ activeTab === 'wechat' ? '微信' : 'WhatsApp' }}客户列表</h2>
|
||||
<span class="yk-customers__sub">
|
||||
共 {{ declaredTotals[activeTab] !== null ? declaredTotals[activeTab] : tabState[activeTab].total }} 条
|
||||
共 {{ displayTotal(activeTab) }} 条
|
||||
<template v-if="departmentName"> · 部门:{{ departmentName }}</template>
|
||||
<template v-if="ownerId"> · 员工账号:{{ ownerId }}</template>
|
||||
</span>
|
||||
@@ -589,7 +603,7 @@ onMounted(() => {
|
||||
:current-page="tabState.wechat.page"
|
||||
:page-size="tabState.wechat.pageSize"
|
||||
:page-sizes="[5, 10, 20, 50, 100]"
|
||||
:total="declaredTotals.wechat ?? tabState.wechat.total"
|
||||
:total="displayTotal('wechat')"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
@current-change="onWechatPageChange"
|
||||
@@ -726,7 +740,7 @@ onMounted(() => {
|
||||
:current-page="tabState.whatsapp.page"
|
||||
:page-size="tabState.whatsapp.pageSize"
|
||||
:page-sizes="[5, 10, 20, 50, 100]"
|
||||
:total="declaredTotals.whatsapp ?? tabState.whatsapp.total"
|
||||
:total="displayTotal('whatsapp')"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
@current-change="onWhatsappPageChange"
|
||||
|
||||
Reference in New Issue
Block a user