CRM:完善回款 plan 详情

(cherry picked from commit fee444d191)
This commit is contained in:
YunaiV 2024-02-25 12:33:01 +08:00 committed by shizhong
parent 5dc390fa86
commit 3ca2dcbea0
6 changed files with 261 additions and 3 deletions

View File

@ -11,9 +11,16 @@ export interface ReceivablePlanVO {
remindDays: number remindDays: number
remindTime: Date remindTime: Date
customerId: number customerId: number
customerName?: string
contractId: number contractId: number
contractNo?: string
ownerUserId: number ownerUserId: number
ownerUserName?: string
remark: string remark: string
creator: string // 创建人
creatorName?: string // 创建人名称
createTime: Date // 创建时间
updateTime: Date // 更新时间
receivable?: { receivable?: {
price: number price: number
returnTime: Date returnTime: Date

View File

@ -539,6 +539,17 @@ const remainingRouter: AppRouteRecordRaw[] = [
}, },
component: () => import('@/views/crm/contract/detail/index.vue') component: () => import('@/views/crm/contract/detail/index.vue')
}, },
{
path: 'receivable-plan/detail/:id',
name: 'CrmReceivablePlanDetail',
meta: {
title: '回款计划详情',
noCache: true,
hidden: true,
activeMenu: '/crm/contract'
},
component: () => import('@/views/crm/receivable/plan/detail/index.vue')
},
{ {
path: 'contact/detail/:id', path: 'contact/detail/:id',
name: 'CrmContactDetail', name: 'CrmContactDetail',

View File

@ -0,0 +1,44 @@
<template>
<div>
<div class="flex items-start justify-between">
<div>
<el-col>
<el-row>
<span class="text-xl font-bold"> {{ receivablePlan.period }} </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="客户名称">
{{ receivablePlan.customerName }}
</el-descriptions-item>
<el-descriptions-item label="合同编号">{{ receivablePlan.contractNo }}</el-descriptions-item>
<el-descriptions-item label="计划回款金额">
{{ erpPriceInputFormatter(receivablePlan.price) }}
</el-descriptions-item>
<el-descriptions-item label="计划回款日期">
{{ formatDate(receivablePlan.returnTime) }}
</el-descriptions-item>
<el-descriptions-item label="实际回款金额">
<el-text v-if="receivablePlan.receivable">
{{ erpPriceInputFormatter(receivablePlan.receivable.price) }}
</el-text>
<el-text v-else>{{ erpPriceInputFormatter(0) }}</el-text>
</el-descriptions-item>
</el-descriptions>
</ContentWrap>
</template>
<script lang="ts" setup>
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
import { formatDate } from '@/utils/formatTime'
import { erpPriceInputFormatter } from '@/utils'
const { receivablePlan } = defineProps<{ receivablePlan: ReceivablePlanApi.ReceivablePlanVO }>()
</script>

View File

@ -0,0 +1,83 @@
<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="期数">{{ receivablePlan.period }}</el-descriptions-item>
<el-descriptions-item label="客户名称">
{{ receivablePlan.customerName }}
</el-descriptions-item>
<el-descriptions-item label="合同编号">
{{ receivablePlan.contractNo }}
</el-descriptions-item>
<el-descriptions-item label="计划回款金额">
{{ erpPriceInputFormatter(receivablePlan.price) }}
</el-descriptions-item>
<el-descriptions-item label="计划回款日期">
{{ formatDate(receivablePlan.returnTime, 'YYYY-MM-DD') }}
</el-descriptions-item>
<el-descriptions-item label="计划回款方式">
<dict-tag
:type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE"
:value="receivablePlan.returnType"
/>
</el-descriptions-item>
<el-descriptions-item label="提前几天提醒">
{{ receivablePlan.remindDays }}
</el-descriptions-item>
<el-descriptions-item label="备注">{{ receivablePlan.remark }}</el-descriptions-item>
<el-descriptions-item label="实际回款金额">
<el-text v-if="receivablePlan.receivable">
{{ erpPriceInputFormatter(receivablePlan.receivable.price) }}
</el-text>
<el-text v-else>{{ erpPriceInputFormatter(0) }}</el-text>
</el-descriptions-item>
<el-descriptions-item label="未回款金额">
<el-text v-if="receivablePlan.receivable">
{{ erpPriceInputFormatter(receivablePlan.price - receivablePlan.receivable.price) }}
</el-text>
<el-text v-else>{{ erpPriceInputFormatter(receivablePlan.price) }}</el-text>
</el-descriptions-item>
<el-descriptions-item label="实际回款日期">
{{ formatDate(receivablePlan.receivable?.returnTime, 'YYYY-MM-DD') }}
</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="负责人">
{{ receivablePlan.ownerUserName }}
</el-descriptions-item>
<el-descriptions-item label="创建人">
{{ receivablePlan.creatorName }}
</el-descriptions-item>
<el-descriptions-item label="创建时间">
{{ formatDate(receivablePlan.createTime) }}
</el-descriptions-item>
<el-descriptions-item label="更新时间">
{{ formatDate(receivablePlan.updateTime) }}
</el-descriptions-item>
</el-descriptions>
</el-collapse-item>
</el-collapse>
</ContentWrap>
</template>
<script setup lang="ts">
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
import { DICT_TYPE } from '@/utils/dict'
import { formatDate } from '@/utils/formatTime'
import { erpPriceInputFormatter } from '@/utils'
const { receivablePlan } = defineProps<{
receivablePlan: ReceivablePlanApi.ReceivablePlanVO
}>()
//
const activeNames = ref(['basicInfo', 'systemInfo'])
</script>

View File

@ -0,0 +1,103 @@
<template>
<ReceivablePlanDetailsHeader v-loading="loading" :receivable-plan="receivablePlan">
<el-button
v-if="permissionListRef?.validateWrite"
@click="openForm('update', receivablePlan.id)"
>
编辑
</el-button>
</ReceivablePlanDetailsHeader>
<el-col>
<el-tabs>
<el-tab-pane label="详细资料">
<ReceivablePlanDetailsInfo :receivable-plan="receivablePlan" />
</el-tab-pane>
<el-tab-pane label="操作日志">
<OperateLogV2 :log-list="logList" />
</el-tab-pane>
<el-tab-pane label="团队成员">
<PermissionList
ref="permissionListRef"
:biz-id="receivablePlan.id!"
:biz-type="BizTypeEnum.CRM_RECEIVABLE_PLAN"
:show-action="true"
@quit-team="close"
/>
</el-tab-pane>
</el-tabs>
</el-col>
<!-- 表单弹窗添加/修改 -->
<ReceivablePlanForm ref="formRef" @success="getReceivablePlan(receivablePlan.id)" />
</template>
<script lang="ts" setup>
import { useTagsViewStore } from '@/store/modules/tagsView'
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
import ReceivablePlanDetailsHeader from './ReceivablePlanDetailsHeader.vue'
import ReceivablePlanDetailsInfo from './ReceivablePlanDetailsInfo.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 ReceivablePlanForm from '@/views/crm/receivable/plan/ReceivablePlanForm.vue'
defineOptions({ name: 'CrmReceivablePlanDetail' })
const message = useMessage()
const receivablePlanId = ref(0) // 线
const loading = ref(true) //
const receivablePlan = ref<ReceivablePlanApi.ReceivablePlanVO>(
{} as ReceivablePlanApi.ReceivablePlanVO
) //
const permissionListRef = ref<InstanceType<typeof PermissionList>>() // Ref
/** 获取详情 */
const getReceivablePlan = async (id: number) => {
loading.value = true
try {
receivablePlan.value = await ReceivablePlanApi.getReceivablePlan(id)
await getOperateLog(id)
} finally {
loading.value = false
}
}
/** 编辑 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 获取操作日志 */
const logList = ref<OperateLogV2VO[]>([]) //
const getOperateLog = async (receivablePlanId: number) => {
if (!receivablePlanId) {
return
}
const data = await getOperateLogPage({
bizType: BizTypeEnum.CRM_RECEIVABLE_PLAN,
bizId: receivablePlanId
})
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
}
receivablePlanId.value = params.id as unknown as number
await getReceivablePlan(receivablePlanId.value)
})
</script>

View File

@ -79,8 +79,13 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="合同编号" prop="contractNo" width="200px" /> <el-table-column align="center" label="合同编号" prop="contractNo" width="200px" />
<!-- TODO @puhui999这里可以点到详情最新版本他有了单独的详情哈 --> <el-table-column align="center" label="期数" prop="period">
<el-table-column align="center" label="期数" prop="period" /> <template #default="scope">
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
{{ scope.row.period }}
</el-link>
</template>
</el-table-column>
<el-table-column <el-table-column
align="center" align="center"
label="计划回款金额(元)" label="计划回款金额(元)"
@ -289,8 +294,13 @@ const handleExport = async () => {
} }
} }
/** 打开客户详情 */ /** 打开详情 */
const { push } = useRouter() const { push } = useRouter()
const openDetail = (id: number) => {
push({ name: 'CrmReceivablePlanDetail', params: { id } })
}
/** 打开客户详情 */
const openCustomerDetail = (id: number) => { const openCustomerDetail = (id: number) => {
push({ name: 'CrmCustomerDetail', params: { id } }) push({ name: 'CrmCustomerDetail', params: { id } })
} }