📖 CRM:code review crm 客户列表

This commit is contained in:
YunaiV 2024-01-07 21:20:00 +08:00
parent 4eb3c8a2f9
commit ec87c1b61d
4 changed files with 31 additions and 13 deletions

View File

@ -73,13 +73,14 @@ export const getOperateLogPage = async (id: number) => {
return await request.get({ url: '/crm/customer/operate-log-page?id=' + id }) return await request.get({ url: '/crm/customer/operate-log-page?id=' + id })
} }
//======================= 业务操作 ======================= // ======================= 业务操作 =======================
// 锁定/解锁客户 // 锁定/解锁客户
export const lockCustomer = async (id: number, lockStatus: boolean) => { export const lockCustomer = async (id: number, lockStatus: boolean) => {
return await request.put({ url: `/crm/customer/lock`, data: { id, lockStatus } }) return await request.put({ url: `/crm/customer/lock`, data: { id, lockStatus } })
} }
// TODO @puhui999方法名改成和后端一致哈
// 领取公海客户 // 领取公海客户
export const receive = async (ids: any[]) => { export const receive = async (ids: any[]) => {
return await request.put({ url: '/crm/customer/receive', params: { ids: ids.join(',') } }) return await request.put({ url: '/crm/customer/receive', params: { ids: ids.join(',') } })

View File

@ -1,4 +1,5 @@
<template> <template>
<!-- TODO @puhui999左边不用有空隙哈 -->
<div class="p-20px"> <div class="p-20px">
<el-timeline> <el-timeline>
<el-timeline-item <el-timeline-item

View File

@ -1,5 +1,6 @@
<template> <template>
<CustomerDetailsHeader :customer="customer" :loading="loading"> <CustomerDetailsHeader :customer="customer" :loading="loading">
<!-- @puhui999返回是不是可以去掉哈貌似用途可能不大 -->
<el-button @click="close">返回</el-button> <el-button @click="close">返回</el-button>
<!-- TODO puhui999: 按钮数据权限收尾统一完善需要按权限分级和客户状态来动态显示匹配的按钮 --> <!-- TODO puhui999: 按钮数据权限收尾统一完善需要按权限分级和客户状态来动态显示匹配的按钮 -->
<el-button v-hasPermi="['crm:customer:update']" type="primary" @click="openForm"> <el-button v-hasPermi="['crm:customer:update']" type="primary" @click="openForm">
@ -12,7 +13,7 @@
<el-button v-if="customer.lockStatus" @click="handleUnlock">解锁</el-button> <el-button v-if="customer.lockStatus" @click="handleUnlock">解锁</el-button>
<el-button v-if="!customer.lockStatus" @click="handleLock">锁定</el-button> <el-button v-if="!customer.lockStatus" @click="handleLock">锁定</el-button>
<el-button v-if="!customer.ownerUserId" type="primary" @click="receive">领取客户</el-button> <el-button v-if="!customer.ownerUserId" type="primary" @click="receive">领取客户</el-button>
<el-button v-if="customer.ownerUserId" type="primary" @click="putPool">客户放入公海</el-button> <el-button v-if="customer.ownerUserId" @click="putPool">客户放入公海</el-button>
</CustomerDetailsHeader> </CustomerDetailsHeader>
<el-col> <el-col>
<el-tabs> <el-tabs>
@ -67,6 +68,7 @@ const loading = ref(true) // 加载中
const message = useMessage() // const message = useMessage() //
const { delView } = useTagsViewStore() // const { delView } = useTagsViewStore() //
const { currentRoute, push } = useRouter() // const { currentRoute, push } = useRouter() //
/** 获取详情 */ /** 获取详情 */
const customer = ref<CustomerApi.CustomerVO>({} as CustomerApi.CustomerVO) // const customer = ref<CustomerApi.CustomerVO>({} as CustomerApi.CustomerVO) //
const getCustomer = async () => { const getCustomer = async () => {
@ -78,45 +80,51 @@ const getCustomer = async () => {
loading.value = false loading.value = false
} }
} }
/** 编辑客户 */
const formRef = ref<InstanceType<typeof CustomerForm>>() // Ref const formRef = ref<InstanceType<typeof CustomerForm>>() // Ref
//
const openForm = () => { const openForm = () => {
formRef.value?.open('update', customerId.value) formRef.value?.open('update', customerId.value)
} }
//
/** 客户转移 */
const transfer = () => {} const transfer = () => {}
//
/** 锁定客户 */
const handleLock = async () => { const handleLock = async () => {
await message.confirm(`确定锁定客户【${customer.value.name}】 吗?`) await message.confirm(`确定锁定客户【${customer.value.name}】 吗?`)
await CustomerApi.lockCustomer(unref(customerId.value), true) await CustomerApi.lockCustomer(unref(customerId.value), true)
message.success(`锁定客户【${customer.value.name}】成功`) message.success(`锁定客户【${customer.value.name}】成功`)
await getCustomer() await getCustomer()
} }
//
/** 解锁客户 */
const handleUnlock = async () => { const handleUnlock = async () => {
await message.confirm(`确定解锁客户【${customer.value.name}】 吗?`) await message.confirm(`确定解锁客户【${customer.value.name}】 吗?`)
await CustomerApi.lockCustomer(unref(customerId.value), false) await CustomerApi.lockCustomer(unref(customerId.value), false)
message.success(`解锁客户【${customer.value.name}】成功`) message.success(`解锁客户【${customer.value.name}】成功`)
await getCustomer() await getCustomer()
} }
//
// TODO @puhui999 handleXXX
/** 领取客户 */
const receive = async () => { const receive = async () => {
await message.confirm(`确定领取客户【${customer.value.name}】 吗?`) await message.confirm(`确定领取客户【${customer.value.name}】 吗?`)
await CustomerApi.receive([unref(customerId.value)]) await CustomerApi.receive([unref(customerId.value)])
message.success(`领取客户【${customer.value.name}】成功`) message.success(`领取客户【${customer.value.name}】成功`)
await getCustomer() await getCustomer()
} }
//
/** 客户放入公海 */
const putPool = async () => { const putPool = async () => {
await message.confirm(`确定将客户【${customer.value.name}】放入公海吗?`) await message.confirm(`确定将客户【${customer.value.name}】放入公海吗?`)
await CustomerApi.putPool(unref(customerId.value)) await CustomerApi.putPool(unref(customerId.value))
message.success(`客户【${customer.value.name}】放入公海成功`) message.success(`客户【${customer.value.name}】放入公海成功`)
close() close()
} }
/** 获取操作日志 */
const logList = ref<OperateLogV2VO[]>([]) // const logList = ref<OperateLogV2VO[]>([]) //
/**
* 获取操作日志
*/
const getOperateLog = async () => { const getOperateLog = async () => {
if (!customerId.value) { if (!customerId.value) {
return return
@ -124,11 +132,13 @@ const getOperateLog = async () => {
const data = await CustomerApi.getOperateLogPage(customerId.value) const data = await CustomerApi.getOperateLogPage(customerId.value)
logList.value = data.list logList.value = data.list
} }
const close = () => { const close = () => {
delView(unref(currentRoute)) delView(unref(currentRoute))
// TODO // TODO
push({ name: 'CrmCustomer' }) push({ name: 'CrmCustomer' })
} }
/** 初始化 */ /** 初始化 */
const { params } = useRoute() const { params } = useRoute()
onMounted(() => { onMounted(() => {

View File

@ -100,9 +100,10 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<!-- TODO @puhui999是不是就 3 重呀我负责的我参与的我下属的 -->
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="客户列表" name="1" /> <el-tab-pane label="客户列表" name="1" />
<el-tab-pane label="我负责的" name="2" /> <el-tab-pane label="我负责的" name="2" />
<el-tab-pane label="我关注的" name="3" /> <el-tab-pane label="我关注的" name="3" />
<el-tab-pane label="我参与的" name="4" /> <el-tab-pane label="我参与的" name="4" />
<el-tab-pane label="下属负责的" name="5" /> <el-tab-pane label="下属负责的" name="5" />
@ -270,6 +271,7 @@ const handleClick = (tab: TabsPaneContext) => {
queryParams.value.sceneType = CrmSceneTypeEnum.FOLLOW queryParams.value.sceneType = CrmSceneTypeEnum.FOLLOW
}) })
break break
// TODO @puhui999
case '4': case '4':
resetQuery(() => { resetQuery(() => {
queryParams.value.sceneType = CrmSceneTypeEnum.INVOLVED queryParams.value.sceneType = CrmSceneTypeEnum.INVOLVED
@ -280,6 +282,7 @@ const handleClick = (tab: TabsPaneContext) => {
queryParams.value.sceneType = CrmSceneTypeEnum.SUBORDINATE queryParams.value.sceneType = CrmSceneTypeEnum.SUBORDINATE
}) })
break break
// TODO @puhui999
case '6': case '6':
resetQuery(() => { resetQuery(() => {
queryParams.value.pool = true queryParams.value.pool = true
@ -287,6 +290,7 @@ const handleClick = (tab: TabsPaneContext) => {
break break
} }
} }
/** 查询列表 */ /** 查询列表 */
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
@ -362,13 +366,15 @@ const handleExport = async () => {
exportLoading.value = false exportLoading.value = false
} }
} }
//
/** 监听路由变化更新列表 */
watch( watch(
() => currentRoute.value, () => currentRoute.value,
() => { () => {
getList() getList()
} }
) )
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {
getList() getList()