CRM:完善商机的详情、跟进记录、操作日志、团队成员

pull/392/head
YunaiV 2024-02-22 08:32:07 +08:00
parent 29605800b5
commit 01684aa6e8
5 changed files with 249 additions and 13 deletions

View File

@ -4,22 +4,29 @@ import { TransferReqVO } from '@/api/crm/customer'
export interface BusinessVO {
id: number
name: string
statusTypeId: number
statusId: number
contactNextTime: Date
customerId: number
dealTime: Date
price: number
discountPercent: number
productPrice: number
remark: string
customerName?: string
followUpStatus: boolean
contactLastTime: Date
contactNextTime: Date
ownerUserId: number
roUserIds: string
rwUserIds: string
ownerUserName?: string // 负责人的用户名称
ownerUserDept?: string // 负责人的部门名称
statusTypeId: number
statusTypeName?: string
statusId: number
statusName?: string
endStatus: number
endRemark: string
contactLastTime: Date
followUpStatus: number
dealTime: Date
totalProductPrice: number
totalPrice: number
discountPercent: number
remark: string
creator: string // 创建人
creatorName?: string // 创建人名称
createTime: Date // 创建时间
updateTime: Date // 更新时间
}
// 查询 CRM 商机列表

View File

@ -104,7 +104,6 @@ const remainingRouter: AppRouteRecordRaw[] = [
}
]
},
{
path: '/dict',
component: Layout,
@ -518,6 +517,17 @@ const remainingRouter: AppRouteRecordRaw[] = [
},
component: () => import('@/views/crm/customer/detail/index.vue')
},
{
path: 'business/detail/:id',
name: 'CrmBusinessDetail',
meta: {
title: '商机详情',
noCache: true,
hidden: true,
activeMenu: '/crm/business'
},
component: () => import('@/views/crm/business/detail/index.vue')
},
{
path: 'contract/detail/:id',
name: 'CrmContractDetail',

View File

@ -0,0 +1,37 @@
<template>
<div>
<div class="flex items-start justify-between">
<div>
<el-col>
<el-row>
<span class="text-xl font-bold">{{ business.name }}</span>
</el-row>
</el-col>
</div>
<div>
<!-- 右上按钮 -->
<slot></slot>
</div>
</div>
</div>
<ContentWrap class="mt-10px">
<el-descriptions :column="5" direction="vertical">
<el-descriptions-item label="客户名称">{{ business.customerName }}</el-descriptions-item>
<el-descriptions-item label="商机金额(元)">
{{ erpPriceInputFormatter(business.totalPrice) }}
</el-descriptions-item>
<el-descriptions-item label="商机组">{{ business.statusTypeName }}</el-descriptions-item>
<el-descriptions-item label="负责人">{{ business.ownerUserName }}</el-descriptions-item>
<el-descriptions-item label="创建时间">
{{ formatDate(business.createTime) }}
</el-descriptions-item>
</el-descriptions>
</ContentWrap>
</template>
<script lang="ts" setup>
import * as BusinessApi from '@/api/crm/business'
import { formatDate } from '@/utils/formatTime'
import { erpPriceInputFormatter } from '@/utils'
const { business } = defineProps<{ business: BusinessApi.BusinessVO }>()
</script>

View File

@ -0,0 +1,61 @@
<template>
<ContentWrap>
<el-collapse v-model="activeNames">
<el-collapse-item name="basicInfo">
<template #title>
<span class="text-base font-bold">基本信息</span>
</template>
<el-descriptions :column="4">
<el-descriptions-item label="商机姓名">{{ business.name }}</el-descriptions-item>
<el-descriptions-item label="客户名称">{{ business.customerName }}</el-descriptions-item>
<el-descriptions-item label="商机金额(元)">
{{ erpPriceInputFormatter(business.totalPrice) }}
</el-descriptions-item>
<el-descriptions-item label="预计成交日期">
{{ formatDate(business.dealTime) }}
</el-descriptions-item>
<el-descriptions-item label="下次联系时间">
{{ formatDate(business.contactNextTime) }}
</el-descriptions-item>
<el-descriptions-item label="商机状态组">
{{ business.statusTypeName }}
</el-descriptions-item>
<el-descriptions-item label="商机阶段">{{ business.statusName }}</el-descriptions-item>
<el-descriptions-item label="备注">{{ business.remark }}</el-descriptions-item>
</el-descriptions>
</el-collapse-item>
<el-collapse-item name="systemInfo">
<template #title>
<span class="text-base font-bold">系统信息</span>
</template>
<el-descriptions :column="4">
<el-descriptions-item label="负责人">{{ business.ownerUserName }}</el-descriptions-item>
<el-descriptions-item label="最后跟进时间">
{{ formatDate(business.contactLastTime) }}
</el-descriptions-item>
<el-descriptions-item label="">&nbsp;</el-descriptions-item>
<el-descriptions-item label="">&nbsp;</el-descriptions-item>
<el-descriptions-item label="创建人">{{ business.creatorName }}</el-descriptions-item>
<el-descriptions-item label="创建时间">
{{ formatDate(business.createTime) }}
</el-descriptions-item>
<el-descriptions-item label="更新时间">
{{ formatDate(business.updateTime) }}
</el-descriptions-item>
</el-descriptions>
</el-collapse-item>
</el-collapse>
</ContentWrap>
</template>
<script setup lang="ts">
import * as BusinessApi from '@/api/crm/business'
import { formatDate } from '@/utils/formatTime'
import { erpPriceInputFormatter } from '@/utils'
const { business } = defineProps<{
business: BusinessApi.BusinessVO
}>()
//
const activeNames = ref(['basicInfo', 'systemInfo'])
</script>

View File

@ -0,0 +1,121 @@
<template>
<BusinessDetailsHeader v-loading="loading" :business="business">
<el-button v-if="permissionListRef?.validateWrite" @click="openForm('update', business.id)">
编辑
</el-button>
<el-button v-if="permissionListRef?.validateOwnerUser" type="primary" @click="transfer">
转移
</el-button>
</BusinessDetailsHeader>
<el-col>
<el-tabs>
<el-tab-pane label="跟进记录">
<FollowUpList :biz-id="businessId" :biz-type="BizTypeEnum.CRM_BUSINESS" />
</el-tab-pane>
<el-tab-pane label="详细资料">
<BusinessDetailsInfo :business="business" />
</el-tab-pane>
<el-tab-pane label="操作日志">
<OperateLogV2 :log-list="logList" />
</el-tab-pane>
<el-tab-pane label="团队成员">
<PermissionList
ref="permissionListRef"
:biz-id="business.id!"
:biz-type="BizTypeEnum.CRM_BUSINESS"
:show-action="true"
@quit-team="close"
/>
</el-tab-pane>
<el-tab-pane label="商机" lazy>
<BusinessList
:biz-id="business.id!"
:biz-type="BizTypeEnum.CRM_CONTACT"
:customer-id="business.customerId"
/>
</el-tab-pane>
</el-tabs>
</el-col>
<!-- 表单弹窗添加/修改 -->
<ContactForm ref="formRef" @success="getContact(business.id)" />
<CrmTransferForm ref="transferFormRef" @success="close" />
</template>
<script lang="ts" setup>
import { useTagsViewStore } from '@/store/modules/tagsView'
import * as ContactApi from '@/api/crm/contact'
import * as BusinessApi from '@/api/crm/business'
import BusinessDetailsHeader from './BusinessDetailsHeader.vue'
import BusinessDetailsInfo from './BusinessDetailsInfo.vue'
import BusinessList from '@/views/crm/business/components/BusinessList.vue' //
import PermissionList from '@/views/crm/permission/components/PermissionList.vue' //
import { BizTypeEnum } from '@/api/crm/permission'
import { OperateLogV2VO } from '@/api/system/operatelog'
import { getOperateLogPage } from '@/api/crm/operateLog'
import ContactForm from '@/views/crm/contact/ContactForm.vue'
import CrmTransferForm from '@/views/crm/permission/components/TransferForm.vue'
import FollowUpList from '@/views/crm/followup/index.vue'
defineOptions({ name: 'CrmBusinessDetail' })
const message = useMessage()
const businessId = ref(0) // 线
const loading = ref(true) //
const business = ref<ContactApi.ContactVO>({} as ContactApi.ContactVO) //
const permissionListRef = ref<InstanceType<typeof PermissionList>>() // Ref
/** 获取详情 */
const getContact = async (id: number) => {
loading.value = true
try {
business.value = await BusinessApi.getBusiness(id)
await getOperateLog(id)
} finally {
loading.value = false
}
}
/** 编辑 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 联系人转移 */
const transferFormRef = ref<InstanceType<typeof CrmTransferForm>>() // ref
const transfer = () => {
transferFormRef.value?.open('商机转移', business.value.id, BusinessApi.transferBusiness)
}
/** 获取操作日志 */
const logList = ref<OperateLogV2VO[]>([]) //
const getOperateLog = async (contactId: number) => {
if (!contactId) {
return
}
const data = await getOperateLogPage({
bizType: BizTypeEnum.CRM_BUSINESS,
bizId: contactId
})
logList.value = data.list
}
/** 关闭窗口 */
const { delView } = useTagsViewStore() //
const { currentRoute } = useRouter() //
const close = () => {
delView(unref(currentRoute))
}
/** 初始化 */
const { params } = useRoute()
onMounted(async () => {
if (!params.id) {
message.warning('参数错误,商机不能为空!')
close()
return
}
businessId.value = params.id as unknown as number
await getContact(businessId.value)
})
</script>