feat(staff): 微信员工明细 modal 内客户微信 → 聊天记录(二级操作)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-06 17:47:02 +08:00
parent 6a30bef21b
commit b63b71bf68
+16 -3
View File
@@ -3,7 +3,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { getAccounts, getCustomers, getMessages } from '@/api' import { getAccounts, getCustomers, getMessages } from '@/api'
import type { Account, Channel } from '@/api/types' import type { Account, Channel, Customer } from '@/api/types'
import YkStaffDetailModal from '@/components/YkStaffDetailModal.vue' import YkStaffDetailModal from '@/components/YkStaffDetailModal.vue'
import { useChannelStore } from '@/stores/channel' import { useChannelStore } from '@/stores/channel'
import { channelLabel, formatTime } from '@/utils/format' import { channelLabel, formatTime } from '@/utils/format'
@@ -274,13 +274,26 @@ function openTalkedModal(row: Account) {
/** 微信员工「沟通数」3 数字 → 明细 modal(数据源:该员工客户列表,度量精确区分见 plan 数据源说明)。 */ /** 微信员工「沟通数」3 数字 → 明细 modal(数据源:该员工客户列表,度量精确区分见 plan 数据源说明)。 */
function openWechatCommModal(row: Account, title: string, withMsgCols: boolean): void { function openWechatCommModal(row: Account, title: string, withMsgCols: boolean): void {
detailTitle.value = `${title} · ${row.user_name ?? row.account_id}` detailTitle.value = `${title} · ${row.user_name ?? row.account_id}`
// 客户微信列可点 → 跳该客户聊天记录(ChatTimeline,name:'chat' 路由同 CustomerList.viewChat)。
// modal 列数据是 Customer,goChat 守卫 owner/friend 存在;缺失则静默 no-op(与 onClick?: 一致)。
const goChat = (r: Customer) => {
if (!r.owner_account_id || !r.friend_id) return
router.push({
name: 'chat',
params: {
channel: r.channel,
ownerId: r.owner_account_id,
talkerId: r.friend_id,
},
})
}
detailCols.value = withMsgCols detailCols.value = withMsgCols
? [ ? [
{ prop: 'friend_nickname', label: '客户微信', minWidth: 160 }, { prop: 'friend_nickname', label: '客户微信', minWidth: 160, onClick: goChat },
{ prop: 'send_num', label: '发送消息数', width: 110, align: 'center' }, { prop: 'send_num', label: '发送消息数', width: 110, align: 'center' },
{ prop: 'receive_num', label: '接收消息数', width: 110, align: 'center' }, { prop: 'receive_num', label: '接收消息数', width: 110, align: 'center' },
] ]
: [{ prop: 'friend_nickname', label: '客户微信', minWidth: 160 }] : [{ prop: 'friend_nickname', label: '客户微信', minWidth: 160, onClick: goChat }]
detailFetcher.value = async (page: number, page_size: number) => detailFetcher.value = async (page: number, page_size: number) =>
getCustomers({ channel: 'wechat', owner_account_id: row.account_id, page, page_size }) getCustomers({ channel: 'wechat', owner_account_id: row.account_id, page, page_size })
detailOpen.value = true detailOpen.value = true