feat(staff): WhatsApp nickname → chat timeline

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-05 19:09:24 +08:00
parent dfdd0595d2
commit 16149fd499
+35 -3
View File
@@ -2,7 +2,7 @@
import { computed, onMounted, reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { getAccounts, getCustomers } from '@/api'
import { getAccounts, getCustomers, getMessages } from '@/api'
import type { Account, Channel } from '@/api/types'
import YkStaffDetailModal from '@/components/YkStaffDetailModal.vue'
import { useChannelStore } from '@/stores/channel'
@@ -193,6 +193,25 @@ function viewGroups(row: Account): void {
})
}
async function viewChat(row: Account) {
// 取该账号最近一条会话,跳 ChatTimeline(降级:云客是会话列表,我们跳最近一条)
const res = await getMessages({
channel: row.channel,
owner_account_id: row.account_id,
page: 1,
page_size: 1,
})
const m = res.items[0]
if (!m) {
ElMessage.info('该账号暂无聊天记录')
return
}
const path = m.room_id
? `/group/${row.channel}/${row.account_id}/${m.room_id}`
: `/chat/${row.channel}/${row.account_id}/${m.talker_id}`
router.push(path)
}
// ---------------------------------------------------------------------------
// Detail modal (stat-number click → 明细) — reused for 添加人数 / 沟通人数.
// fetcher is set by open*Modal; the modal triggers it on open.
@@ -555,9 +574,13 @@ onMounted(() => {
<div class="yk-staffinfo">
<el-avatar :size="36" shape="circle">{{ initials(row) }}</el-avatar>
<div class="yk-staffinfo__meta">
<div class="yk-staffinfo__nick" :title="cellText(row, 'nickName')">
<span
class="yk-staffinfo__nick yk-link"
:title="cellText(row, 'nickName')"
@click.stop="viewChat(row)"
>
{{ cellText(row, 'nickName') }}
</div>
</span>
<div class="yk-staffinfo__muted">{{ cellText(row, 'phone') }}</div>
</div>
</div>
@@ -779,6 +802,15 @@ onMounted(() => {
text-overflow: ellipsis;
}
.yk-link {
color: var(--el-color-primary);
cursor: pointer;
}
.yk-link:hover {
opacity: 0.8;
}
.yk-staffinfo__pair {
font-size: 12px;
line-height: 1.7;