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' import request from '@/config/axios'
// TODO 芋艿:融合下 // TODO 芋艿:融合下
// 1. 获得今日需联系客户数量
export const getTodayCustomerCount = async () => {
return await request.get({ url: '/crm/customer/today-customer-count' })
}
// 3. 获得分配给我的客户数量 // 3. 获得分配给我的客户数量
export const getFollowCustomerCount = async () => { export const getFollowCustomerCount = async () => {
return await request.get({ url: '/crm/customer/follow-customer-count' }) 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. 获得待审核合同数量 // 5. 获得待审核合同数量
export const getCheckContractCount = async () => { export const getCheckContractCount = async () => {
return await request.get({ url: '/crm/contract/check-contract-count' }) 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 }) 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) => { export const getCustomer = async (id: number) => {
return await request.get({ url: `/crm/customer/get?id=` + id }) return await request.get({ url: `/crm/customer/get?id=` + id })
@ -71,8 +91,8 @@ export const importCustomerTemplate = () => {
} }
// 客户列表 // 客户列表
export const getSimpleCustomerList = async () => { export const getCustomerSimpleList = async () => {
return await request.get({ url: `/crm/customer/list-all-simple` }) 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(',') } }) 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) => { export const putCustomerPool = async (id: number) => {
return await request.put({ url: `/crm/customer/put-pool?id=${id}` }) 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> <ContentWrap>
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true"> <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="客户名称" fixed="left" prop="name" width="160">
<el-table-column align="center" label="客户名称" prop="name" width="160">
<template #default="scope"> <template #default="scope">
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)"> <el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
{{ scope.row.name }} {{ scope.row.name }}
</el-link> </el-link>
</template> </template>
</el-table-column> </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"> <el-table-column align="center" label="客户来源" prop="source" width="100">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_SOURCE" :value="scope.row.source" /> <dict-tag :type="DICT_TYPE.CRM_CUSTOMER_SOURCE" :value="scope.row.source" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="所属行业" prop="industryId" width="120"> <el-table-column label="手机" align="center" prop="mobile" width="120" />
<template #default="scope"> <el-table-column label="电话" align="center" prop="telephone" width="130" />
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_INDUSTRY" :value="scope.row.industryId" /> <el-table-column label="邮箱" align="center" prop="email" width="180" />
</template> <el-table-column align="center" label="客户级别" prop="level" width="135">
</el-table-column>
<el-table-column align="center" label="客户级别" prop="level" width="120">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_LEVEL" :value="scope.row.level" /> <dict-tag :type="DICT_TYPE.CRM_CUSTOMER_LEVEL" :value="scope.row.level" />
</template> </template>
</el-table-column> </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 <el-table-column
:formatter="dateFormatter" :formatter="dateFormatter"
align="center" align="center"
@ -65,14 +64,16 @@
width="180px" width="180px"
/> />
<el-table-column align="center" label="备注" prop="remark" width="200" /> <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"> <el-table-column align="center" label="成交状态" prop="dealStatus">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.dealStatus" /> <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.dealStatus" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="距离进入公海" prop="poolDay">
<template #default="scope"> {{ scope.row.poolDay }} </template>
</el-table-column>
<el-table-column <el-table-column
:formatter="dateFormatter" :formatter="dateFormatter"
align="center" align="center"
@ -80,10 +81,17 @@
prop="contactLastTime" prop="contactLastTime"
width="180px" 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 <el-table-column
:formatter="dateFormatter" :formatter="dateFormatter"
align="center" align="center"
label="创建时间" label="更新时间"
prop="updateTime" prop="updateTime"
width="180px" width="180px"
/> />
@ -94,8 +102,6 @@
prop="createTime" prop="createTime"
width="180px" 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-column align="center" label="创建人" prop="creatorName" width="100px" />
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
@ -108,12 +114,14 @@
</ContentWrap> </ContentWrap>
</template> </template>
<script setup lang="ts" name="FollowCustomer"> <script setup lang="ts">
import * as CustomerApi from '@/api/crm/customer' import * as CustomerApi from '@/api/crm/customer'
import { DICT_TYPE } from '@/utils/dict' import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import { FOLLOWUP_STATUS } from './common' import { FOLLOWUP_STATUS } from './common'
defineOptions({ name: 'CrmCustomerFollowList' })
const { push } = useRouter() const { push } = useRouter()
const loading = ref(true) // const loading = ref(true) //

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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