diff --git a/yunkes/src/views/CustomerList.vue b/yunkes/src/views/CustomerList.vue index 42dd395..767281d 100644 --- a/yunkes/src/views/CustomerList.vue +++ b/yunkes/src/views/CustomerList.vue @@ -3,9 +3,9 @@ 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 { getCustomerDeclaredTotal, getCustomers } from '@/api' +import { getCustomerDeclaredTotal, getCustomers, getGroups } from '@/api' import { downloadBlob } from '@/api/client' -import type { Channel, Customer } from '@/api/types' +import type { Channel, Customer, Group } from '@/api/types' import { useChannelStore } from '@/stores/channel' import { useOrgStore } from '@/stores/org' import { channelLabel, formatTime } from '@/utils/format' @@ -72,6 +72,40 @@ const tabState = reactive>({ whatsapp: freshTabState(10), // WA 10 条(2026-08-24 用户指定) }) +// WA 子 tab:好友列表 | 群列表(对齐云客 friendlist 页两 tab) +const waSubTab = ref<'friends' | 'groups'>( + route.query.tab === 'groups' ? 'groups' : 'friends', +) +// WA 群数据(子 tab=groups 时加载) +const waGroups = ref([]) +const waGroupsLoading = ref(false) +const waGroupsTotal = ref(0) +const waGroupsPage = ref(1) +const waGroupsPageSize = ref(10) + +async function loadWaGroups(): Promise { + if (waGroups.value.length > 0 || waSubTab.value !== 'groups') return + waGroupsLoading.value = true + try { + const res = await getGroups({ + channel: 'whatsapp', + owner_account_id: ownerId.value ?? undefined, + page: waGroupsPage.value, + page_size: waGroupsPageSize.value, + }) + waGroups.value = res.items + waGroupsTotal.value = res.total + } catch (e) { + ElMessage.error(`WA 群列表加载失败:${(e as Error).message}`) + } finally { + waGroupsLoading.value = false + } +} + +function onWaSubTabChange(): void { + if (waSubTab.value === 'groups') loadWaGroups() +} + // 全字段抽屉(两 tab 共享) const drawerOpen = ref(false) const drawerCustomer = ref(null) @@ -532,9 +566,17 @@ onMounted(() => { + + + + + + + + + + + + + + + + + + + + +
+ +
+