Skip to content

Commit ec87c1b

Browse files
committed
📖 CRM:code review crm 客户列表
1 parent 4eb3c8a commit ec87c1b

File tree

4 files changed

+31
-13
lines changed

4 files changed

+31
-13
lines changed

src/api/crm/customer/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,14 @@ export const getOperateLogPage = async (id: number) => {
7373
return await request.get({ url: '/crm/customer/operate-log-page?id=' + id })
7474
}
7575

76-
//======================= 业务操作 =======================
76+
// ======================= 业务操作 =======================
7777

7878
// 锁定/解锁客户
7979
export const lockCustomer = async (id: number, lockStatus: boolean) => {
8080
return await request.put({ url: `/crm/customer/lock`, data: { id, lockStatus } })
8181
}
8282

83+
// TODO @puhui999:方法名,改成和后端一致哈
8384
// 领取公海客户
8485
export const receive = async (ids: any[]) => {
8586
return await request.put({ url: '/crm/customer/receive', params: { ids: ids.join(',') } })

src/components/OperateLogV2/src/OperateLogV2.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<template>
2+
<!-- TODO @puhui999:左边不用有空隙哈 -->
23
<div class="p-20px">
34
<el-timeline>
45
<el-timeline-item

src/views/crm/customer/detail/index.vue

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
22
<CustomerDetailsHeader :customer="customer" :loading="loading">
3+
<!-- @puhui999:返回是不是可以去掉哈,貌似用途可能不大 -->
34
<el-button @click="close">返回</el-button>
45
<!-- TODO puhui999: 按钮数据权限收尾统一完善,需要按权限分级和客户状态来动态显示匹配的按钮 -->
56
<el-button v-hasPermi="['crm:customer:update']" type="primary" @click="openForm">
@@ -12,7 +13,7 @@
1213
<el-button v-if="customer.lockStatus" @click="handleUnlock">解锁</el-button>
1314
<el-button v-if="!customer.lockStatus" @click="handleLock">锁定</el-button>
1415
<el-button v-if="!customer.ownerUserId" type="primary" @click="receive">领取客户</el-button>
15-
<el-button v-if="customer.ownerUserId" type="primary" @click="putPool">客户放入公海</el-button>
16+
<el-button v-if="customer.ownerUserId" @click="putPool">客户放入公海</el-button>
1617
</CustomerDetailsHeader>
1718
<el-col>
1819
<el-tabs>
@@ -67,6 +68,7 @@ const loading = ref(true) // 加载中
6768
const message = useMessage() // 消息弹窗
6869
const { delView } = useTagsViewStore() // 视图操作
6970
const { currentRoute, push } = useRouter() // 路由
71+
7072
/** 获取详情 */
7173
const customer = ref<CustomerApi.CustomerVO>({} as CustomerApi.CustomerVO) // 客户详情
7274
const getCustomer = async () => {
@@ -78,57 +80,65 @@ const getCustomer = async () => {
7880
loading.value = false
7981
}
8082
}
83+
84+
/** 编辑客户 */
8185
const formRef = ref<InstanceType<typeof CustomerForm>>() // 客户表单 Ref
82-
// 编辑客户
8386
const openForm = () => {
8487
formRef.value?.open('update', customerId.value)
8588
}
86-
// 客户转移
89+
90+
/** 客户转移 */
8791
const transfer = () => {}
88-
// 锁定客户
92+
93+
/** 锁定客户 */
8994
const handleLock = async () => {
9095
await message.confirm(`确定锁定客户【${customer.value.name}】 吗?`)
9196
await CustomerApi.lockCustomer(unref(customerId.value), true)
9297
message.success(`锁定客户【${customer.value.name}】成功`)
9398
await getCustomer()
9499
}
95-
// 解锁客户
100+
101+
/** 解锁客户 */
96102
const handleUnlock = async () => {
97103
await message.confirm(`确定解锁客户【${customer.value.name}】 吗?`)
98104
await CustomerApi.lockCustomer(unref(customerId.value), false)
99105
message.success(`解锁客户【${customer.value.name}】成功`)
100106
await getCustomer()
101107
}
102-
// 领取客户
108+
109+
// TODO @puhui999:下面两个方法的命名,也用 handleXXX 风格哈
110+
/** 领取客户 */
103111
const receive = async () => {
104112
await message.confirm(`确定领取客户【${customer.value.name}】 吗?`)
105113
await CustomerApi.receive([unref(customerId.value)])
106114
message.success(`领取客户【${customer.value.name}】成功`)
107115
await getCustomer()
108116
}
109-
// 客户放入公海
117+
118+
/** 客户放入公海 */
110119
const putPool = async () => {
111120
await message.confirm(`确定将客户【${customer.value.name}】放入公海吗?`)
112121
await CustomerApi.putPool(unref(customerId.value))
113122
message.success(`客户【${customer.value.name}】放入公海成功`)
114123
close()
115124
}
125+
126+
/** 获取操作日志 */
116127
const logList = ref<OperateLogV2VO[]>([]) // 操作日志列表
117-
/**
118-
* 获取操作日志
119-
*/
120128
const getOperateLog = async () => {
121129
if (!customerId.value) {
122130
return
123131
}
124132
const data = await CustomerApi.getOperateLogPage(customerId.value)
125133
logList.value = data.list
126134
}
135+
127136
const close = () => {
128137
delView(unref(currentRoute))
129138
// TODO 先返回到客户列表
130139
push({ name: 'CrmCustomer' })
131140
}
141+
132142
/** 初始化 */
133143
const { params } = useRoute()
134144
onMounted(() => {

src/views/crm/customer/index.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@
100100

101101
<!-- 列表 -->
102102
<ContentWrap>
103+
<!-- TODO @puhui999:是不是就 3 重呀,我负责的,我参与的,我下属的 -->
103104
<el-tabs v-model="activeName" @tab-click="handleClick">
104105
<el-tab-pane label="客户列表" name="1" />
105-
<el-tab-pane label="我负责人的" name="2" />
106+
<el-tab-pane label="我负责的" name="2" />
106107
<el-tab-pane label="我关注的" name="3" />
107108
<el-tab-pane label="我参与的" name="4" />
108109
<el-tab-pane label="下属负责的" name="5" />
@@ -270,6 +271,7 @@ const handleClick = (tab: TabsPaneContext) => {
270271
queryParams.value.sceneType = CrmSceneTypeEnum.FOLLOW
271272
})
272273
break
274+
// TODO @puhui999:这个貌似报错?
273275
case '4':
274276
resetQuery(() => {
275277
queryParams.value.sceneType = CrmSceneTypeEnum.INVOLVED
@@ -280,13 +282,15 @@ const handleClick = (tab: TabsPaneContext) => {
280282
queryParams.value.sceneType = CrmSceneTypeEnum.SUBORDINATE
281283
})
282284
break
285+
// TODO @puhui999:公海单独一个菜单哈。
283286
case '6':
284287
resetQuery(() => {
285288
queryParams.value.pool = true
286289
})
287290
break
288291
}
289292
}
293+
290294
/** 查询列表 */
291295
const getList = async () => {
292296
loading.value = true
@@ -362,13 +366,15 @@ const handleExport = async () => {
362366
exportLoading.value = false
363367
}
364368
}
365-
// 监听路由变化更新列表
369+
370+
/** 监听路由变化更新列表 */
366371
watch(
367372
() => currentRoute.value,
368373
() => {
369374
getList()
370375
}
371376
)
377+
372378
/** 初始化 **/
373379
onMounted(() => {
374380
getList()

0 commit comments

Comments
 (0)