✨ CRM:完成客户的分配接入
This commit is contained in:
parent
4362251b59
commit
a401fff74c
@ -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' })
|
||||
|
@ -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 })
|
||||
}
|
||||
|
@ -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) // 列表的加载中
|
@ -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()
|
@ -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 @dhb52:1)定义改成这种;2)命名要不要改成 CustomerTodayTable,就是 模块+形容词+表格(更容易识别),然后把 tables 目录改成 components 目录
|
||||
defineOptions({ name: 'CrmCustomerTodayContactList' })
|
||||
|
||||
const { push } = useRouter()
|
||||
|
@ -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))
|
||||
}
|
||||
|
||||
/** 激活时 */
|
||||
|
@ -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) {
|
||||
|
@ -312,6 +312,6 @@ const openCustomerDetail = (id: number) => {
|
||||
/** 初始化 **/
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
customerList.value = await CustomerApi.getSimpleCustomerList()
|
||||
customerList.value = await CustomerApi.getCustomerSimpleList()
|
||||
})
|
||||
</script>
|
||||
|
@ -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()
|
||||
}
|
||||
|
||||
/** 动态获取客户联系人 */
|
||||
|
@ -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[]>([])
|
||||
/** 动态获取客户联系人 */
|
||||
|
@ -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}】放入公海吗?`)
|
||||
|
85
src/views/crm/customer/pool/CustomerDistributeForm.vue
Normal file
85
src/views/crm/customer/pool/CustomerDistributeForm.vue
Normal 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) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
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>
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user