feat(calls): WA语音 单元格可点(客户→WA chat,员工→drawer)+ chatChannel helper

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-11 11:59:56 +08:00
parent 2b2f863800
commit 8b19c299bb
+21 -4
View File
@@ -134,6 +134,11 @@ function openDrawer(row: PhoneCall): void {
drawerOpen.value = true
}
/** 把通话类型(voice_call/wa_voice_call)映射到聊天渠道(wechat/whatsapp)。电话返回 null。 */
function chatChannel(ch: CallChannel): 'wechat' | 'whatsapp' | null {
return ch === 'voice_call' ? 'wechat' : ch === 'wa_voice_call' ? 'whatsapp' : null
}
/** 客户昵称 → 该员工×客户 1:1 聊天(复用 Phase B 导航)。 */
function viewCallCustomer(row: PhoneCall): void {
const owner = cell(row, 'weChatId')
@@ -141,7 +146,11 @@ function viewCallCustomer(row: PhoneCall): void {
if (!owner || !talker) return
router.push({
name: 'chat',
params: { channel: 'wechat', ownerId: String(owner), talkerId: String(talker) },
params: {
channel: chatChannel(row.channel) ?? 'wechat',
ownerId: String(owner),
talkerId: String(talker),
},
})
}
@@ -149,7 +158,10 @@ function viewCallCustomer(row: PhoneCall): void {
function viewCallStaff(row: PhoneCall): void {
const owner = cell(row, 'weChatId')
if (!owner) return
router.push({ name: 'chat', params: { channel: 'wechat', ownerId: String(owner) } })
router.push({
name: 'chat',
params: { channel: chatChannel(row.channel) ?? 'wechat', ownerId: String(owner) },
})
}
const drawerSections = computed(() =>
@@ -250,13 +262,18 @@ onMounted(load)
</el-table-column>
<el-table-column label="客户信息" min-width="160">
<template #default="{ row }">
<div>{{ cell(row, 'talkerNickName') || '--' }}</div>
<el-button v-if="cell(row, 'talkerNickName')" link type="primary" size="small" @click.stop="viewCallCustomer(row)">{{ cell(row, 'talkerNickName') }}</el-button>
<span v-else>--</span>
<div class="yk-cell__sub">{{ cell(row, 'talkerAlias') || row.call_number || '--' }}</div>
</template>
</el-table-column>
<el-table-column label="员工信息" min-width="160">
<template #default="{ row }">
<div>{{ row.user_id_name || '--' }} · {{ cell(row, 'userPhone') || '--' }}</div>
<div>
<el-button v-if="row.user_id_name" link type="primary" size="small" @click.stop="openDrawer(row)">{{ row.user_id_name }}</el-button>
<span v-else>--</span>
<span> · {{ cell(row, 'userPhone') || '--' }}</span>
</div>
<div class="yk-cell__sub">{{ cell(row, 'userWeChatNickName') || '--' }} · {{ cell(row, 'userWeChatAlias') || '--' }}</div>
</template>
</el-table-column>