CRM:完成客户的分配接入

This commit is contained in:
YunaiV 2024-02-20 20:19:11 +08:00
parent 4362251b59
commit a401fff74c
13 changed files with 229 additions and 100 deletions

View File

@ -1,21 +1,11 @@
import request from '@/config/axios'
// TODO 芋艿:融合下
// 1. 获得今日需联系客户数量
export const getTodayCustomerCount = async () => {
return await request.get({ url: '/crm/customer/today-customer-count' })
}
// 3. 获得分配给我的客户数量
export const getFollowCustomerCount = async () => {
return await request.get({ url: '/crm/customer/follow-customer-count' })
}
// 4. 获得待进入公海的客户数量
export const getPutInPoolCustomerRemindCount = async () => {
return await request.get({ url: '/crm/customer/put-in-pool-remind-count' })
}
// 5. 获得待审核合同数量
export const getCheckContractCount = async () => {
return await request.get({ url: '/crm/contract/check-contract-count' })

View File

@ -35,6 +35,26 @@ export const getCustomerPage = async (params) => {
return await request.get({ url: `/crm/customer/page`, params })
}
// 进入公海客户提醒的客户列表
export const getPutPoolRemindCustomerPage = async (params) => {
return await request.get({ url: `/crm/customer/put-pool-remind-page`, params })
}
// 获得待进入公海客户数量
export const getPutPoolRemindCustomerCount = async () => {
return await request.get({ url: `/crm/customer/put-pool-remind-count` })
}
// 获得今日需联系客户数量
export const getTodayContactCustomerCount = async () => {
return await request.get({ url: `/crm/customer/today-contact-count` })
}
// 获得分配给我、待跟进的线索数量的客户数量
export const getFollowCustomerCount = async () => {
return await request.get({ url: `/crm/customer/follow-count` })
}
// 查询客户详情
export const getCustomer = async (id: number) => {
return await request.get({ url: `/crm/customer/get?id=` + id })
@ -71,8 +91,8 @@ export const importCustomerTemplate = () => {
}
// 客户列表
export const getSimpleCustomerList = async () => {
return await request.get({ url: `/crm/customer/list-all-simple` })
export const getCustomerSimpleList = async () => {
return await request.get({ url: `/crm/customer/simple-list` })
}
// ======================= 业务操作 =======================
@ -98,12 +118,15 @@ export const receiveCustomer = async (ids: any[]) => {
return await request.put({ url: '/crm/customer/receive', params: { ids: ids.join(',') } })
}
// 分配公海给对应负责人
export const distributeCustomer = async (ids: any[], ownerUserId: number) => {
return await request.put({
url: '/crm/customer/distribute',
data: { ids: ids, ownerUserId }
})
}
// 客户放入公海
export const putCustomerPool = async (id: number) => {
return await request.put({ url: `/crm/customer/put-pool?id=${id}` })
}
// 进入公海客户提醒
export const getPutInPoolRemindCustomerPage = async (params) => {
return await request.get({ url: `/crm/customer/put-in-pool-remind-page`, params })
}

View File

@ -31,32 +31,31 @@
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
<el-table-column align="center" label="编号" prop="id" />
<el-table-column align="center" label="客户名称" prop="name" width="160">
<el-table-column align="center" label="客户名称" fixed="left" prop="name" width="160">
<template #default="scope">
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
{{ scope.row.name }}
</el-link>
</template>
</el-table-column>
<el-table-column align="center" label="手机" prop="mobile" width="120" />
<el-table-column align="center" label="电话" prop="telephone" width="120" />
<el-table-column align="center" label="客户来源" prop="source" width="100">
<template #default="scope">
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_SOURCE" :value="scope.row.source" />
</template>
</el-table-column>
<el-table-column align="center" label="所属行业" prop="industryId" width="120">
<template #default="scope">
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_INDUSTRY" :value="scope.row.industryId" />
</template>
</el-table-column>
<el-table-column align="center" label="客户级别" prop="level" width="120">
<el-table-column label="手机" align="center" prop="mobile" width="120" />
<el-table-column label="电话" align="center" prop="telephone" width="130" />
<el-table-column label="邮箱" align="center" prop="email" width="180" />
<el-table-column align="center" label="客户级别" prop="level" width="135">
<template #default="scope">
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_LEVEL" :value="scope.row.level" />
</template>
</el-table-column>
<el-table-column align="center" label="网址" prop="website" width="200" />
<el-table-column align="center" label="客户行业" prop="industryId" width="100">
<template #default="scope">
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_INDUSTRY" :value="scope.row.industryId" />
</template>
</el-table-column>
<el-table-column
:formatter="dateFormatter"
align="center"
@ -65,14 +64,16 @@
width="180px"
/>
<el-table-column align="center" label="备注" prop="remark" width="200" />
<el-table-column align="center" label="锁定状态" prop="lockStatus">
<template #default="scope">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.lockStatus" />
</template>
</el-table-column>
<el-table-column align="center" label="成交状态" prop="dealStatus">
<template #default="scope">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.dealStatus" />
</template>
</el-table-column>
<el-table-column align="center" label="距离进入公海" prop="poolDay">
<template #default="scope"> {{ scope.row.poolDay }} </template>
</el-table-column>
<el-table-column
:formatter="dateFormatter"
align="center"
@ -80,10 +81,17 @@
prop="contactLastTime"
width="180px"
/>
<el-table-column align="center" label="最后跟进记录" prop="contactLastContent" width="200" />
<el-table-column label="地址" align="center" prop="detailAddress" width="180" />
<el-table-column align="center" label="距离进入公海天数" prop="poolDay" width="140">
<template #default="scope"> {{ scope.row.poolDay }} </template>
</el-table-column>
<el-table-column align="center" label="负责人" prop="ownerUserName" width="100px" />
<el-table-column align="center" label="所属部门" prop="ownerUserDeptName" width="100px" />
<el-table-column
:formatter="dateFormatter"
align="center"
label="创建时间"
label="更新时间"
prop="updateTime"
width="180px"
/>
@ -94,8 +102,6 @@
prop="createTime"
width="180px"
/>
<el-table-column align="center" label="负责人" prop="ownerUserName" width="100px" />
<el-table-column align="center" label="所属部门" prop="ownerUserDeptName" width="100px" />
<el-table-column align="center" label="创建人" prop="creatorName" width="100px" />
</el-table>
<!-- 分页 -->
@ -108,12 +114,14 @@
</ContentWrap>
</template>
<script setup lang="ts" name="FollowCustomer">
<script setup lang="ts">
import * as CustomerApi from '@/api/crm/customer'
import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import { FOLLOWUP_STATUS } from './common'
defineOptions({ name: 'CrmCustomerFollowList' })
const { push } = useRouter()
const loading = ref(true) //

View File

@ -104,13 +104,13 @@
</ContentWrap>
</template>
<script lang="ts" setup name="PutInPoolRemind">
<script lang="ts" setup>
import * as CustomerApi from '@/api/crm/customer'
import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import { SCENE_TYPES } from './common'
const { push } = useRouter()
defineOptions({ name: 'CrmCustomerPutPoolRemindList' })
const loading = ref(true) //
const total = ref(0) //
@ -127,7 +127,7 @@ const queryFormRef = ref() // 搜索的表单
const getList = async () => {
loading.value = true
try {
const data = await CustomerApi.getPutInPoolRemindCustomerPage(queryParams.value)
const data = await CustomerApi.getPutPoolRemindCustomerPage(queryParams.value)
list.value = data.list
total.value = data.total
} finally {
@ -142,10 +142,16 @@ const handleQuery = () => {
}
/** 打开客户详情 */
const { push } = useRouter()
const openDetail = (id: number) => {
push({ name: 'CrmCustomerDetail', params: { id } })
}
/** 激活时 */
onActivated(async () => {
await getList()
})
/** 初始化 **/
onMounted(() => {
getList()

View File

@ -43,7 +43,6 @@
</ContentWrap>
<ContentWrap>
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
<el-table-column align="center" label="编号" fixed="left" prop="id" />
<el-table-column align="center" label="客户名称" fixed="left" prop="name" width="160">
<template #default="scope">
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
@ -51,24 +50,24 @@
</el-link>
</template>
</el-table-column>
<el-table-column align="center" label="手机" prop="mobile" width="120" />
<el-table-column align="center" label="电话" prop="telephone" width="120" />
<el-table-column align="center" label="客户来源" prop="source" width="100">
<template #default="scope">
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_SOURCE" :value="scope.row.source" />
</template>
</el-table-column>
<el-table-column align="center" label="所属行业" prop="industryId" width="120">
<template #default="scope">
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_INDUSTRY" :value="scope.row.industryId" />
</template>
</el-table-column>
<el-table-column align="center" label="客户级别" prop="level" width="120">
<el-table-column label="手机" align="center" prop="mobile" width="120" />
<el-table-column label="电话" align="center" prop="telephone" width="130" />
<el-table-column label="邮箱" align="center" prop="email" width="180" />
<el-table-column align="center" label="客户级别" prop="level" width="135">
<template #default="scope">
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_LEVEL" :value="scope.row.level" />
</template>
</el-table-column>
<el-table-column align="center" label="网址" prop="website" width="200" />
<el-table-column align="center" label="客户行业" prop="industryId" width="100">
<template #default="scope">
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_INDUSTRY" :value="scope.row.industryId" />
</template>
</el-table-column>
<el-table-column
:formatter="dateFormatter"
align="center"
@ -77,12 +76,16 @@
width="180px"
/>
<el-table-column align="center" label="备注" prop="remark" width="200" />
<el-table-column align="center" label="锁定状态" prop="lockStatus">
<template #default="scope">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.lockStatus" />
</template>
</el-table-column>
<el-table-column align="center" label="成交状态" prop="dealStatus">
<template #default="scope">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.dealStatus" />
</template>
</el-table-column>
<el-table-column align="center" label="距进入公海天数" prop="poolDay" width="130" />
<el-table-column
:formatter="dateFormatter"
align="center"
@ -90,10 +93,17 @@
prop="contactLastTime"
width="180px"
/>
<el-table-column align="center" label="最后跟进记录" prop="contactLastContent" width="200" />
<el-table-column label="地址" align="center" prop="detailAddress" width="180" />
<el-table-column align="center" label="距离进入公海天数" prop="poolDay" width="140">
<template #default="scope"> {{ scope.row.poolDay }} </template>
</el-table-column>
<el-table-column align="center" label="负责人" prop="ownerUserName" width="100px" />
<el-table-column align="center" label="所属部门" prop="ownerUserDeptName" width="100px" />
<el-table-column
:formatter="dateFormatter"
align="center"
label="创建时间"
label="更新时间"
prop="updateTime"
width="180px"
/>
@ -104,8 +114,6 @@
prop="createTime"
width="180px"
/>
<el-table-column align="center" label="负责人" prop="ownerUserName" width="100px" />
<el-table-column align="center" label="所属部门" prop="ownerUserDeptName" width="100px" />
<el-table-column align="center" label="创建人" prop="creatorName" width="100px" />
</el-table>
<!-- 分页 -->
@ -118,13 +126,13 @@
</ContentWrap>
</template>
<script lang="ts" setup name="TodayCustomer">
<script lang="ts" setup>
import * as CustomerApi from '@/api/crm/customer'
import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import { CONTACT_STATUS, SCENE_TYPES } from './common'
// defineOptions({ name: 'TodayCustomer' }) TODO @dhb5212 CustomerTodayTable ++ tables components
defineOptions({ name: 'CrmCustomerTodayContactList' })
const { push } = useRouter()

View File

@ -15,13 +15,13 @@
</div>
</el-col>
<el-col :span="20" :xs="24">
<TodayCustomer v-if="leftMenu === 'todayCustomer'" />
<CustomerTodayContactList v-if="leftMenu === 'customerTodayContact'" />
<ClueFollowList v-if="leftMenu === 'clueFollow'" />
<CheckContract v-if="leftMenu === 'checkContract'" />
<CheckReceivables v-if="leftMenu === 'checkReceivables'" />
<EndContract v-if="leftMenu === 'endContract'" />
<FollowCustomer v-if="leftMenu === 'followCustomer'" />
<PutInPoolRemind v-if="leftMenu === 'putInPoolRemind'" />
<CustomerFollowList v-if="leftMenu === 'customerFollow'" />
<CustomerPutPoolRemindList v-if="leftMenu === 'customerPutPoolRemind'" />
<RemindReceivables v-if="leftMenu === 'remindReceivables'" />
</el-col>
</el-row>
@ -29,34 +29,35 @@
<script lang="ts" setup>
import * as BacklogApi from '@/api/crm/backlog'
import CustomerFollowList from './components/CustomerFollowList.vue'
import CustomerTodayContactList from './components/CustomerTodayContactList.vue'
import CustomerPutPoolRemindList from './components/CustomerPutPoolRemindList.vue'
import ClueFollowList from './components/ClueFollowList.vue'
import CheckContract from './tables/CheckContract.vue'
import CheckReceivables from './tables/CheckReceivables.vue'
import EndContract from './tables/EndContract.vue'
import FollowCustomer from './tables/FollowCustomer.vue'
import ClueFollowList from './components/ClueFollowList.vue'
import PutInPoolRemind from './tables/PutInPoolRemind.vue'
import RemindReceivables from './tables/RemindReceivables.vue'
import TodayCustomer from './tables/TodayCustomer.vue'
import * as CustomerApi from '@/api/crm/customer'
import * as ClueApi from '@/api/crm/clue'
defineOptions({ name: 'CrmBacklog' })
const leftMenu = ref('todayCustomer')
const leftMenu = ref('customerTodayContact')
const todayCustomerCountRef = ref(0)
const customerTodayContactCount = ref(0)
const clueFollowCount = ref(0)
const followCustomerCountRef = ref(0)
const putInPoolCustomerRemindCountRef = ref(0)
const checkContractCountRef = ref(0)
const checkReceivablesCountRef = ref(0)
const remindReceivablesCountRef = ref(0)
const endContractCountRef = ref(0)
const customerFollowCount = ref(0)
const customerPutPoolRemindCount = ref(0)
const checkContractCount = ref(0)
const checkReceivablesCount = ref(0)
const remindReceivablesCount = ref(0)
const endContractCount = ref(0)
const leftSides = ref([
{
name: '今日需联系客户',
menu: 'todayCustomer',
count: todayCustomerCountRef
menu: 'customerTodayContact',
count: customerTodayContactCount
},
{
name: '分配给我的线索',
@ -65,33 +66,33 @@ const leftSides = ref([
},
{
name: '分配给我的客户',
menu: 'followCustomer',
count: followCustomerCountRef
menu: 'customerFollow',
count: customerFollowCount
},
{
name: '待进入公海的客户',
menu: 'putInPoolRemind',
count: putInPoolCustomerRemindCountRef
menu: 'customerPutPoolRemind',
count: customerPutPoolRemindCount
},
{
name: '待审核合同',
menu: 'checkContract',
count: checkContractCountRef
count: checkContractCount
},
{
name: '待审核回款',
menu: 'checkReceivables',
count: checkReceivablesCountRef
count: checkReceivablesCount
},
{
name: '待回款提醒',
menu: 'remindReceivables',
count: remindReceivablesCountRef
count: remindReceivablesCount
},
{
name: '即将到期的合同',
menu: 'endContract',
count: endContractCountRef
count: endContractCount
}
])
@ -101,19 +102,18 @@ const sideClick = (item: any) => {
}
const getCount = () => {
BacklogApi.getTodayCustomerCount().then((count) => (todayCustomerCountRef.value = count))
CustomerApi.getTodayContactCustomerCount().then(
(count) => (customerTodayContactCount.value = count)
)
CustomerApi.getPutPoolRemindCustomerCount().then(
(count) => (customerPutPoolRemindCount.value = count)
)
CustomerApi.getFollowCustomerCount().then((count) => (customerFollowCount.value = count))
ClueApi.getFollowClueCount().then((count) => (clueFollowCount.value = count))
BacklogApi.getClueFollowListCount().then((count) => (clueFollowCount.value = count))
BacklogApi.getFollowCustomerCount().then((count) => (followCustomerCountRef.value = count))
BacklogApi.getPutInPoolCustomerRemindCount().then(
(count) => (putInPoolCustomerRemindCountRef.value = count)
)
BacklogApi.getCheckContractCount().then((count) => (checkContractCountRef.value = count))
BacklogApi.getCheckReceivablesCount().then((count) => (checkReceivablesCountRef.value = count))
BacklogApi.getRemindReceivablePlanCount().then(
(count) => (remindReceivablesCountRef.value = count)
)
BacklogApi.getEndContractCount().then((count) => (endContractCountRef.value = count))
BacklogApi.getCheckContractCount().then((count) => (checkContractCount.value = count))
BacklogApi.getCheckReceivablesCount().then((count) => (checkReceivablesCount.value = count))
BacklogApi.getRemindReceivablePlanCount().then((count) => (remindReceivablesCount.value = count))
BacklogApi.getEndContractCount().then((count) => (endContractCount.value = count))
}
/** 激活时 */

View File

@ -242,7 +242,7 @@ const open = async (type: string, id?: number) => {
resetForm()
allContactList.value = await ContactApi.getSimpleContactList()
userList.value = await UserApi.getSimpleUserList()
customerList.value = await CustomerApi.getSimpleCustomerList()
customerList.value = await CustomerApi.getCustomerSimpleList()
areaList.value = await AreaApi.getAreaTree()
//
if (id) {

View File

@ -312,6 +312,6 @@ const openCustomerDetail = (id: number) => {
/** 初始化 **/
onMounted(async () => {
await getList()
customerList.value = await CustomerApi.getSimpleCustomerList()
customerList.value = await CustomerApi.getCustomerSimpleList()
})
</script>

View File

@ -257,7 +257,7 @@ const getAllApi = async () => {
/** 获取客户 */
const customerList = ref<CustomerApi.CustomerVO[]>([])
const getCustomerList = async () => {
customerList.value = await CustomerApi.getSimpleCustomerList()
customerList.value = await CustomerApi.getCustomerSimpleList()
}
/** 动态获取客户联系人 */

View File

@ -194,7 +194,7 @@ const getAllApi = async () => {
const customerList = ref<CustomerApi.CustomerVO[]>([])
/** 获取客户 */
const getCustomerList = async () => {
customerList.value = await CustomerApi.getSimpleCustomerList()
customerList.value = await CustomerApi.getCustomerSimpleList()
}
const contactList = ref<ContactApi.ContactVO[]>([])
/** 动态获取客户联系人 */

View File

@ -26,14 +26,15 @@
>
锁定
</el-button>
<el-button v-if="!customer.ownerUserId" type="primary" @click="handleReceive">
领取客户
<el-button v-if="!customer.ownerUserId" type="primary" @click="handleReceive"> 领取 </el-button>
<el-button v-if="!customer.ownerUserId" type="primary" @click="handleDistributeForm">
分配
</el-button>
<el-button
v-if="customer.ownerUserId && permissionListRef?.validateOwnerUser"
@click="handlePutPool"
>
客户放入公海
放入公海
</el-button>
</CustomerDetailsHeader>
<el-col>
@ -74,7 +75,8 @@
<!-- 表单弹窗添加/修改 -->
<CustomerForm ref="formRef" @success="getCustomer" />
<CrmTransferForm ref="transferFormRef" @success="close" />
<CustomerDistributeForm ref="distributeForm" @success="getCustomer" />
<CrmTransferForm ref="transferFormRef" @success="getCustomer" />
</template>
<script lang="ts" setup>
import { useTagsViewStore } from '@/store/modules/tagsView'
@ -93,6 +95,7 @@ import FollowUpList from '@/views/crm/followup/index.vue'
import { BizTypeEnum } from '@/api/crm/permission'
import type { OperateLogV2VO } from '@/api/system/operatelog'
import { getOperateLogPage } from '@/api/crm/operateLog'
import CustomerDistributeForm from '@/views/crm/customer/pool/CustomerDistributeForm.vue'
defineOptions({ name: 'CrmCustomerDetail' })
@ -166,6 +169,12 @@ const handleReceive = async () => {
await getCustomer()
}
/** 分配客户 */
const distributeForm = ref<InstanceType<typeof CustomerDistributeForm>>() // Ref
const handleDistributeForm = async () => {
distributeForm.value?.open(customerId.value)
}
/** 客户放入公海 */
const handlePutPool = async () => {
await message.confirm(`确定将客户【${customer.value.name}】放入公海吗?`)

View File

@ -0,0 +1,85 @@
<template>
<Dialog v-model="dialogVisible" title="分配客户">
<el-form
ref="formRef"
v-loading="formLoading"
:model="formData"
:rules="formRules"
label-width="100px"
>
<el-form-item label="负责人" prop="ownerUserId">
<el-select v-model="formData.ownerUserId" class="w-1/1">
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script lang="ts" setup>
import * as CustomerApi from '@/api/crm/customer'
import * as UserApi from '@/api/system/user'
import { distributeCustomer } from '@/api/crm/customer'
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const formLoading = ref(false) // 12
const userOptions = ref<UserApi.UserVO[]>([]) //
const formData = ref({
id: undefined,
ownerUserId: undefined
})
const formRules = reactive({
ownerUserId: [{ required: true, message: '负责人不能为空', trigger: 'blur' }]
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (id: number) => {
dialogVisible.value = true
resetForm()
formData.value.id = id
//
userOptions.value = await UserApi.getSimpleUserList()
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
//
formLoading.value = true
try {
await CustomerApi.distributeCustomer([formData.value.id], formData.value.ownerUserId)
message.success('分配客户成功')
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
ownerUserId: undefined
}
formRef.value?.resetFields()
}
</script>

View File

@ -257,7 +257,7 @@ const handleExport = async () => {
//
exportLoading.value = true
const data = await CustomerApi.exportCustomer(queryParams.value)
download.excel(data, '客户.xls')
download.excel(data, '客户公海.xls')
} catch {
} finally {
exportLoading.value = false