feat(customers): 微信客户页脚改云客口径(Σ员工好友数声明值8590,用户选B方案)

- GET /api/customers/declared-total: Σ wechat_account.contacts_num
- 页脚优先显示云客口径(回退真实total);列表内容保持去重真实行
- 云客列表声明值含其ES索引重复doc(连行id都相同无法物理区分),仅对齐计数

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-20 13:44:39 +08:00
parent 0d04f68c07
commit fd3cf0003b
4 changed files with 67 additions and 3 deletions
+4
View File
@@ -48,6 +48,10 @@ export interface CustomerQuery {
last_chat_since?: number
}
export function getCustomerDeclaredTotal(): Promise<{ declared_total: number; account_count: number }> {
return getJson<{ declared_total: number; account_count: number }>('/customers/declared-total')
}
export function getCustomers(query: CustomerQuery = {}): Promise<Page<Customer>> {
return getJson<Page<Customer>>(
'/customers',
+15 -2
View File
@@ -3,7 +3,7 @@ import { computed, onMounted, reactive, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { Download } from '@element-plus/icons-vue'
import { getCustomers } from '@/api'
import { getCustomerDeclaredTotal, getCustomers } from '@/api'
import { downloadBlob } from '@/api/client'
import type { Channel, Customer } from '@/api/types'
import { useChannelStore } from '@/stores/channel'
@@ -39,6 +39,18 @@ function freshTabState(): TabState {
return { items: [], total: 0, page: 1, pageSize: 10, loading: false, errorMsg: null, loaded: false }
}
/** 云客口径微信客户合计(Σ员工好友数声明值,含云客索引重复;页脚对齐云客)。 */
const declaredTotal = ref<number | null>(null)
async function loadDeclaredTotal(): Promise<void> {
try {
const r = await getCustomerDeclaredTotal()
declaredTotal.value = r.declared_total
} catch {
declaredTotal.value = null // 回退真实 total
}
}
const route = useRoute()
const router = useRouter()
const channelStore = useChannelStore()
@@ -346,6 +358,7 @@ watch(
onMounted(() => {
loadTab(activeTab.value)
loadDeclaredTotal()
})
</script>
@@ -355,7 +368,7 @@ onMounted(() => {
<div>
<h2 style="margin: 0 0 4px; font-size: 16px">{{ activeTab === 'wechat' ? '微信' : 'WhatsApp' }}客户列表</h2>
<span class="yk-customers__sub">
共 {{ tabState[activeTab].total }} 条
共 {{ activeTab === 'wechat' && declaredTotal !== null ? declaredTotal : tabState[activeTab].total }} 条
<template v-if="departmentName"> · 部门:{{ departmentName }}</template>
<template v-if="ownerId"> · 员工账号:{{ ownerId }}</template>
</span>