Skip to content

Commit d29dfef

Browse files
author
puhui999
committed
新增客户跟进
1 parent 1e68cd5 commit d29dfef

File tree

13 files changed

+610
-52
lines changed

13 files changed

+610
-52
lines changed

src/api/crm/business/index.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/*
2-
* @Author: zyna
3-
* @Date: 2023-12-02 13:08:56
4-
* @LastEditTime: 2023-12-17 16:28:20
5-
* @FilePath: \yudao-ui-admin-vue3\src\api\crm\business\index.ts
6-
* @Description:
7-
*/
81
import request from '@/config/axios'
92

103
export interface BusinessVO {
@@ -67,3 +60,8 @@ export const exportBusiness = async (params) => {
6760
export const getBusinessPageByContact = async (params) => {
6861
return await request.get({ url: `/crm/business/page-by-contact`, params })
6962
}
63+
64+
// 获得 CRM 商机列表
65+
export const getBusinessListByIds = async (val: number[]) => {
66+
return await request.get({ url: '/crm/business/list-by-ids', params: { ids: val } })
67+
}

src/api/crm/contact/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ export const getSimpleContactList = async () => {
7171
return await request.get({ url: `/crm/contact/simple-all-list` })
7272
}
7373

74+
// 获得 CRM 联系人列表
75+
export const getContactListByIds = async (val: number[]) => {
76+
return await request.get({ url: '/crm/contact/list-by-ids', params: { ids: val } })
77+
}
78+
7479
// 批量新增联系人商机关联
7580
export const createContactBusinessList = async (data: ContactBusinessReqVO) => {
7681
return await request.post({ url: `/crm/contact/create-business-list`, data })
@@ -84,4 +89,4 @@ export const deleteContactBusinessList = async (data: ContactBusinessReqVO) => {
8489
// 查询联系人操作日志
8590
export const getOperateLogPage = async (params: any) => {
8691
return await request.get({ url: '/crm/contact/operate-log-page', params })
87-
}
92+
}

src/api/crm/followup/index.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import request from '@/config/axios'
2+
3+
// 跟进记录 VO
4+
export interface FollowUpRecordVO {
5+
// 编号
6+
id: number
7+
// 数据类型
8+
bizType: number
9+
// 数据编号
10+
bizId: number
11+
// 跟进类型
12+
type: number
13+
// 跟进内容
14+
content: string
15+
// 下次联系时间
16+
nextTime: Date
17+
// 关联的商机编号数组
18+
businessIds: number[]
19+
// 关联的联系人编号数组
20+
contactIds: number[]
21+
}
22+
23+
// 跟进记录 API
24+
export const FollowUpRecordApi = {
25+
// 查询跟进记录分页
26+
getFollowUpRecordPage: async (params: any) => {
27+
return await request.get({ url: `/crm/follow-up-record/page`, params })
28+
},
29+
30+
// 查询跟进记录详情
31+
getFollowUpRecord: async (id: number) => {
32+
return await request.get({ url: `/crm/follow-up-record/get?id=` + id })
33+
},
34+
35+
// 新增跟进记录
36+
createFollowUpRecord: async (data: FollowUpRecordVO) => {
37+
return await request.post({ url: `/crm/follow-up-record/create`, data })
38+
},
39+
40+
// 修改跟进记录
41+
updateFollowUpRecord: async (data: FollowUpRecordVO) => {
42+
return await request.put({ url: `/crm/follow-up-record/update`, data })
43+
},
44+
45+
// 删除跟进记录
46+
deleteFollowUpRecord: async (id: number) => {
47+
return await request.delete({ url: `/crm/follow-up-record/delete?id=` + id })
48+
},
49+
50+
// 导出跟进记录 Excel
51+
exportFollowUpRecord: async (params) => {
52+
return await request.download({ url: `/crm/follow-up-record/export-excel`, params })
53+
}
54+
}

src/components/OperateLogV2/src/OperateLogV2.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<!-- TODO @puhui999:左边不用有空隙哈 -->
3-
<div class="p-20px">
3+
<div class="pt-20px">
44
<el-timeline>
55
<el-timeline-item
66
v-for="(log, index) in logList"
@@ -58,7 +58,7 @@ const getUserTypeColor = (type: number) => {
5858
<style lang="scss" scoped>
5959
// 时间线样式调整
6060
:deep(.el-timeline) {
61-
margin: 10px 0 0 160px;
61+
margin: 10px 0 0 110px;
6262
6363
.el-timeline-item__wrapper {
6464
position: relative;

src/utils/dict.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* 数据字典工具类
33
*/
4-
import { useDictStoreWithOut } from '@/store/modules/dict'
5-
import { ElementPlusInfoType } from '@/types/elementPlus'
4+
import {useDictStoreWithOut} from '@/store/modules/dict'
5+
import {ElementPlusInfoType} from '@/types/elementPlus'
66

77
const dictStore = useDictStoreWithOut()
88

@@ -205,5 +205,6 @@ export enum DICT_TYPE {
205205
CRM_CUSTOMER_SOURCE = 'crm_customer_source',
206206
CRM_PRODUCT_STATUS = 'crm_product_status',
207207
CRM_PERMISSION_LEVEL = 'crm_permission_level', // CRM 数据权限的级别
208-
CRM_PRODUCT_UNIT = 'crm_product_unit' // 产品单位
208+
CRM_PRODUCT_UNIT = 'crm_product_unit', // 产品单位
209+
CRM_FOLLOW_UP_TYPE = 'crm_follow_up_type' // 跟进方式
209210
}

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<template>
22
<CustomerDetailsHeader :customer="customer" :loading="loading">
3-
<!-- @puhui999:返回是不是可以去掉哈,貌似用途可能不大 -->
4-
<el-button @click="close">返回</el-button>
53
<!-- TODO puhui999: 按钮数据权限收尾统一完善,需要按权限分级和客户状态来动态显示匹配的按钮 -->
64
<el-button v-hasPermi="['crm:customer:update']" type="primary" @click="openForm">
75
编辑
@@ -12,8 +10,10 @@
1210
<el-button>更改成交状态</el-button>
1311
<el-button v-if="customer.lockStatus" @click="handleUnlock">解锁</el-button>
1412
<el-button v-if="!customer.lockStatus" @click="handleLock">锁定</el-button>
15-
<el-button v-if="!customer.ownerUserId" type="primary" @click="receive">领取客户</el-button>
16-
<el-button v-if="customer.ownerUserId" @click="putPool">客户放入公海</el-button>
13+
<el-button v-if="!customer.ownerUserId" type="primary" @click="handleReceive">
14+
领取客户
15+
</el-button>
16+
<el-button v-if="customer.ownerUserId" @click="handlePutPool">客户放入公海</el-button>
1717
</CustomerDetailsHeader>
1818
<el-col>
1919
<el-tabs>
@@ -23,6 +23,9 @@
2323
<el-tab-pane label="操作日志">
2424
<OperateLogV2 :log-list="logList" />
2525
</el-tab-pane>
26+
<el-tab-pane label="跟进">
27+
<FollowUpList :biz-id="customerId" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
28+
</el-tab-pane>
2629
<el-tab-pane label="联系人" lazy>
2730
<ContactList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
2831
</el-tab-pane>
@@ -58,6 +61,7 @@ import BusinessList from '@/views/crm/business/components/BusinessList.vue' //
5861
import ReceivableList from '@/views/crm/receivable/components/ReceivableList.vue' // 回款列表
5962
import ReceivablePlanList from '@/views/crm/receivable/plan/components/ReceivablePlanList.vue' // 回款计划列表
6063
import PermissionList from '@/views/crm/permission/components/PermissionList.vue' // 团队成员列表(权限)
64+
import FollowUpList from '@/views/crm/followup/index.vue'
6165
import { BizTypeEnum } from '@/api/crm/permission'
6266
import type { OperateLogV2VO } from '@/api/system/operatelog'
6367
@@ -67,7 +71,7 @@ const customerId = ref(0) // 客户编号
6771
const loading = ref(true) // 加载中
6872
const message = useMessage() // 消息弹窗
6973
const { delView } = useTagsViewStore() // 视图操作
70-
const { currentRoute, push } = useRouter() // 路由
74+
const { currentRoute } = useRouter() // 路由
7175
7276
/** 获取详情 */
7377
const customer = ref<CustomerApi.CustomerVO>({} as CustomerApi.CustomerVO) // 客户详情
@@ -106,17 +110,16 @@ const handleUnlock = async () => {
106110
await getCustomer()
107111
}
108112
109-
// TODO @puhui999:下面两个方法的命名,也用 handleXXX 风格哈
110113
/** 领取客户 */
111-
const receive = async () => {
114+
const handleReceive = async () => {
112115
await message.confirm(`确定领取客户【${customer.value.name}】 吗?`)
113116
await CustomerApi.receive([unref(customerId.value)])
114117
message.success(`领取客户【${customer.value.name}】成功`)
115118
await getCustomer()
116119
}
117120
118121
/** 客户放入公海 */
119-
const putPool = async () => {
122+
const handlePutPool = async () => {
120123
await message.confirm(`确定将客户【${customer.value.name}】放入公海吗?`)
121124
await CustomerApi.putPool(unref(customerId.value))
122125
message.success(`客户【${customer.value.name}】放入公海成功`)
@@ -135,15 +138,13 @@ const getOperateLog = async () => {
135138
136139
const close = () => {
137140
delView(unref(currentRoute))
138-
// TODO 先返回到客户列表
139-
push({ name: 'CrmCustomer' })
140141
}
141142
142143
/** 初始化 */
143144
const { params } = useRoute()
144145
onMounted(() => {
145146
if (!params.id) {
146-
ElMessage.warning('参数错误,客户不能为空!')
147+
message.warning('参数错误,客户不能为空!')
147148
close()
148149
return
149150
}

src/views/crm/customer/index.vue

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,10 @@
100100

101101
<!-- 列表 -->
102102
<ContentWrap>
103-
<!-- TODO @puhui999:是不是就 3 重呀,我负责的,我参与的,我下属的 -->
104103
<el-tabs v-model="activeName" @tab-click="handleClick">
105-
<el-tab-pane label="客户列表" name="1" />
106-
<el-tab-pane label="我负责的" name="2" />
107-
<el-tab-pane label="我关注的" name="3" />
108-
<el-tab-pane label="我参与的" name="4" />
109-
<el-tab-pane label="下属负责的" name="5" />
110-
<el-tab-pane label="客户公海" name="6" />
104+
<el-tab-pane label="我负责的" name="1" />
105+
<el-tab-pane label="我参与的" name="2" />
106+
<el-tab-pane label="下属负责的" name="3" />
111107
</el-tabs>
112108
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
113109
<el-table-column align="center" label="编号" prop="id" />
@@ -149,7 +145,9 @@
149145
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.dealStatus" />
150146
</template>
151147
</el-table-column>
152-
<!-- TODO @puhui999:距进入公海天数 -->
148+
<el-table-column align="center" label="距离进入公海" prop="poolDay">
149+
<template #default="scope"> {{ scope.row.poolDay }}天</template>
150+
</el-table-column>
153151
<el-table-column
154152
:formatter="dateFormatter"
155153
align="center"
@@ -251,43 +249,27 @@ const activeName = ref('1') // 列表 tab
251249
252250
enum CrmSceneTypeEnum {
253251
OWNER = 1,
254-
FOLLOW = 2,
255-
INVOLVED = 3,
256-
SUBORDINATE = 4
252+
INVOLVED = 2,
253+
SUBORDINATE = 3
257254
}
258255
259256
const handleClick = (tab: TabsPaneContext) => {
260257
switch (tab.paneName) {
261258
case '1':
262-
resetQuery()
263-
break
264-
case '2':
265259
resetQuery(() => {
266260
queryParams.value.sceneType = CrmSceneTypeEnum.OWNER
267261
})
268262
break
269-
case '3':
270-
resetQuery(() => {
271-
queryParams.value.sceneType = CrmSceneTypeEnum.FOLLOW
272-
})
273-
break
274-
// TODO @puhui999:这个貌似报错?
275-
case '4':
263+
case '2':
276264
resetQuery(() => {
277265
queryParams.value.sceneType = CrmSceneTypeEnum.INVOLVED
278266
})
279267
break
280-
case '5':
268+
case '3':
281269
resetQuery(() => {
282270
queryParams.value.sceneType = CrmSceneTypeEnum.SUBORDINATE
283271
})
284272
break
285-
// TODO @puhui999:公海单独一个菜单哈。
286-
case '6':
287-
resetQuery(() => {
288-
queryParams.value.pool = true
289-
})
290-
break
291273
}
292274
}
293275

0 commit comments

Comments
 (0)