CRM:完善回款集成客户详情和合同详情
This commit is contained in:
parent
d9e1ffd522
commit
174724da98
@ -19,8 +19,18 @@
|
|||||||
<el-tab-pane label="产品">
|
<el-tab-pane label="产品">
|
||||||
<ContractProductList :contract="contract" />
|
<ContractProductList :contract="contract" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<!-- TODO @puhui999:回款信息 -->
|
<el-tab-pane label="回款">
|
||||||
<el-tab-pane label="回款"> 123 </el-tab-pane>
|
<ReceivablePlanList
|
||||||
|
:contract-id="contract.id!"
|
||||||
|
:customer-id="contract.customerId"
|
||||||
|
@crate-receivable="crateReceivable"
|
||||||
|
/>
|
||||||
|
<ReceivableList
|
||||||
|
ref="receivableListRef"
|
||||||
|
:contract-id="contract.id!"
|
||||||
|
:customer-id="contract.customerId"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
<el-tab-pane label="团队成员">
|
<el-tab-pane label="团队成员">
|
||||||
<PermissionList
|
<PermissionList
|
||||||
ref="permissionListRef"
|
ref="permissionListRef"
|
||||||
@ -53,6 +63,8 @@ import ContractForm from '@/views/crm/contract/ContractForm.vue'
|
|||||||
import CrmTransferForm from '@/views/crm/permission/components/TransferForm.vue'
|
import CrmTransferForm from '@/views/crm/permission/components/TransferForm.vue'
|
||||||
import PermissionList from '@/views/crm/permission/components/PermissionList.vue'
|
import PermissionList from '@/views/crm/permission/components/PermissionList.vue'
|
||||||
import FollowUpList from '@/views/crm/followup/index.vue'
|
import FollowUpList from '@/views/crm/followup/index.vue'
|
||||||
|
import ReceivableList from '@/views/crm/receivable/components/ReceivableList.vue'
|
||||||
|
import ReceivablePlanList from '@/views/crm/receivable/plan/components/ReceivablePlanList.vue'
|
||||||
|
|
||||||
defineOptions({ name: 'CrmContractDetail' })
|
defineOptions({ name: 'CrmContractDetail' })
|
||||||
const props = defineProps<{ id?: number }>()
|
const props = defineProps<{ id?: number }>()
|
||||||
@ -94,8 +106,14 @@ const getOperateLog = async (contractId: number) => {
|
|||||||
logList.value = data.list
|
logList.value = data.list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 从回款计划创建回款 */
|
||||||
|
const receivableListRef = ref<InstanceType<typeof ReceivableList>>() // 回款列表 Ref
|
||||||
|
const crateReceivable = (planData: any) => {
|
||||||
|
receivableListRef.value?.crateReceivable(planData)
|
||||||
|
}
|
||||||
|
|
||||||
/** 转移 */
|
/** 转移 */
|
||||||
// TODO @puhui999:这个组件,要不传递业务类型,然后组件里判断 title 和 api 能调用哪个;整体治理掉;
|
// TODO @puhui999:这个组件,要不传递业务类型,然后组件里判断 title 和 api 能调用哪个;整体治理掉;好呢
|
||||||
const transferFormRef = ref<InstanceType<typeof CrmTransferForm>>() // 合同转移表单 ref
|
const transferFormRef = ref<InstanceType<typeof CrmTransferForm>>() // 合同转移表单 ref
|
||||||
const transferContract = () => {
|
const transferContract = () => {
|
||||||
transferFormRef.value?.open('合同转移', contract.value.id, ContractApi.transferContract)
|
transferFormRef.value?.open('合同转移', contract.value.id, ContractApi.transferContract)
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
>
|
>
|
||||||
锁定
|
锁定
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button v-if="!customer.ownerUserId" type="primary" @click="handleReceive"> 领取 </el-button>
|
<el-button v-if="!customer.ownerUserId" type="primary" @click="handleReceive"> 领取</el-button>
|
||||||
<el-button v-if="!customer.ownerUserId" type="primary" @click="handleDistributeForm">
|
<el-button v-if="!customer.ownerUserId" type="primary" @click="handleDistributeForm">
|
||||||
分配
|
分配
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -64,8 +64,8 @@
|
|||||||
<ContractList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
|
<ContractList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="回款" lazy>
|
<el-tab-pane label="回款" lazy>
|
||||||
<ReceivablePlanList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
|
<ReceivablePlanList :customer-id="customer.id!" @crate-receivable="crateReceivable" />
|
||||||
<ReceivableList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
|
<ReceivableList ref="receivableListRef" :customer-id="customer.id!" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="操作日志">
|
<el-tab-pane label="操作日志">
|
||||||
<OperateLogV2 :log-list="logList" />
|
<OperateLogV2 :log-list="logList" />
|
||||||
@ -197,6 +197,12 @@ const getOperateLog = async () => {
|
|||||||
logList.value = data.list
|
logList.value = data.list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 从回款计划创建回款 */
|
||||||
|
const receivableListRef = ref<InstanceType<typeof ReceivableList>>() // 回款列表 Ref
|
||||||
|
const crateReceivable = (planData: any) => {
|
||||||
|
receivableListRef.value?.crateReceivable(planData)
|
||||||
|
}
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
delView(unref(currentRoute))
|
delView(unref(currentRoute))
|
||||||
push({ name: 'CrmCustomer' })
|
push({ name: 'CrmCustomer' })
|
||||||
|
@ -150,9 +150,8 @@ const formRef = ref() // 表单 Ref
|
|||||||
const customerList = ref<CustomerApi.CustomerVO[]>([]) // 客户列表
|
const customerList = ref<CustomerApi.CustomerVO[]>([]) // 客户列表
|
||||||
const contractList = ref<ContractApi.ContractVO[]>([]) // 合同列表
|
const contractList = ref<ContractApi.ContractVO[]>([]) // 合同列表
|
||||||
const receivablePlanList = ref<ReceivablePlanApi.ReceivablePlanVO[]>([]) // 回款计划列表
|
const receivablePlanList = ref<ReceivablePlanApi.ReceivablePlanVO[]>([]) // 回款计划列表
|
||||||
|
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = async (type: string, id?: number) => {
|
const open = async (type: string, id?: number, planData?: ReceivablePlanApi.ReceivablePlanVO) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
dialogTitle.value = t('action.' + type)
|
dialogTitle.value = t('action.' + type)
|
||||||
formType.value = type
|
formType.value = type
|
||||||
@ -174,6 +173,12 @@ const open = async (type: string, id?: number) => {
|
|||||||
if (formType.value === 'create') {
|
if (formType.value === 'create') {
|
||||||
formData.value.ownerUserId = useUserStore().getUser.id
|
formData.value.ownerUserId = useUserStore().getUser.id
|
||||||
}
|
}
|
||||||
|
// 从回款计划创建回款
|
||||||
|
if (planData) {
|
||||||
|
formData.value.customerId = planData.customerId
|
||||||
|
formData.value.contractId = planData.contractId
|
||||||
|
formData.value.planId = planData.id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
@ -249,9 +254,12 @@ watch(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const receivablePlan = receivablePlanList.value.find((item) => item.id === newVal)
|
const receivablePlan = receivablePlanList.value.find((item) => item.id === newVal)
|
||||||
|
if (!receivablePlan) {
|
||||||
|
return
|
||||||
|
}
|
||||||
// 只有没有金额的时候才设置
|
// 只有没有金额的时候才设置
|
||||||
if (!formData.value.price || formData.value.price === 0) {
|
if (!formData.value.price || formData.value.price === 0) {
|
||||||
formData.value.price = receivablePlan!.price
|
formData.value.price = receivablePlan.price
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -9,40 +9,51 @@
|
|||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap class="mt-10px">
|
<ContentWrap class="mt-10px">
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||||
<el-table-column label="回款编号" fixed="left" align="center" prop="no">
|
<el-table-column align="center" label="回款编号" prop="no" />
|
||||||
<template #default="scope">
|
<el-table-column align="center" label="客户" prop="customerName" />
|
||||||
<el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
|
<el-table-column align="center" label="合同" prop="contractName" />
|
||||||
{{ scope.row.no }}
|
|
||||||
</el-link>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="合同编号" align="center" prop="contractNo" />
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="回款金额(元)"
|
:formatter="dateFormatter2"
|
||||||
align="center"
|
align="center"
|
||||||
prop="price"
|
|
||||||
:formatter="fenToYuanFormat"
|
|
||||||
/>
|
|
||||||
<el-table-column label="负责人" align="center" prop="ownerUserName" />
|
|
||||||
<el-table-column align="center" label="状态" prop="auditStatus">
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
label="回款日期"
|
label="回款日期"
|
||||||
align="center"
|
|
||||||
prop="returnTime"
|
prop="returnTime"
|
||||||
:formatter="dateFormatter"
|
width="150px"
|
||||||
width="180px"
|
|
||||||
/>
|
/>
|
||||||
|
<el-table-column align="center" label="回款方式" prop="returnType" width="130px">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE" :value="scope.row.returnType" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="回款金额(元)" prop="price" />
|
||||||
|
<el-table-column align="center" label="负责人" prop="ownerUserName" />
|
||||||
|
<el-table-column align="center" label="备注" prop="remark" />
|
||||||
|
<el-table-column align="center" fixed="right" label="操作" width="130px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable:update']"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('update', scope.row.id)"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable:delete']"
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<Pagination
|
<Pagination
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNo"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
v-model:limit="queryParams.pageSize"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
:total="total"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
@ -50,45 +61,43 @@
|
|||||||
<!-- 表单弹窗:添加 -->
|
<!-- 表单弹窗:添加 -->
|
||||||
<ReceivableForm ref="formRef" @success="getList" />
|
<ReceivableForm ref="formRef" @success="getList" />
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script lang="ts" setup>
|
||||||
|
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
|
||||||
import * as ReceivableApi from '@/api/crm/receivable'
|
import * as ReceivableApi from '@/api/crm/receivable'
|
||||||
import ReceivableForm from './../ReceivableForm.vue'
|
import ReceivableForm from './../ReceivableForm.vue'
|
||||||
import { BizTypeEnum } from '@/api/crm/permission'
|
import { dateFormatter2 } from '@/utils/formatTime'
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
|
||||||
import { fenToYuanFormat } from '@/utils/formatter'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
|
|
||||||
defineOptions({ name: 'CrmReceivableList' })
|
defineOptions({ name: 'CrmReceivableList' })
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
bizType: number // 业务类型
|
customerId?: number // 客户编号
|
||||||
bizId: number // 业务编号
|
contractId?: number // 合同编号
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
const list = ref([]) // 列表的数据
|
const list = ref([]) // 列表的数据
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
customerId: undefined as unknown // 允许 undefined + number
|
customerId: undefined as unknown, // 允许 undefined + number
|
||||||
|
contractId: undefined as unknown // 允许 undefined + number
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
// 置空参数
|
if (props.customerId && !props.contractId) {
|
||||||
queryParams.customerId = undefined
|
queryParams.customerId = props.customerId
|
||||||
// 执行查询
|
} else if (props.customerId && props.contractId) {
|
||||||
let data = { list: [], total: 0 }
|
// 如果是合同的话客户编号也需要带上因为权限基于客户
|
||||||
switch (props.bizType) {
|
queryParams.customerId = props.customerId
|
||||||
case BizTypeEnum.CRM_CUSTOMER:
|
queryParams.contractId = props.contractId
|
||||||
queryParams.customerId = props.bizId
|
|
||||||
data = await ReceivableApi.getReceivablePageByCustomer(queryParams)
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
const data = await ReceivableApi.getReceivablePageByCustomer(queryParams)
|
||||||
list.value = data.list
|
list.value = data.list
|
||||||
total.value = data.total
|
total.value = data.total
|
||||||
} finally {
|
} finally {
|
||||||
@ -99,25 +108,45 @@ const getList = async () => {
|
|||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
queryParams.pageNo = 1
|
queryParams.pageNo = 1
|
||||||
|
// 置空参数
|
||||||
|
queryParams.customerId = undefined
|
||||||
|
queryParams.contractId = undefined
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加 */
|
/** 添加/修改操作 */
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
const openForm = () => {
|
const openForm = (type: string, id?: number) => {
|
||||||
formRef.value.open('create')
|
formRef.value.open(type, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 打开合同详情 */
|
/** 删除按钮操作 */
|
||||||
const { push } = useRouter()
|
const handleDelete = async (id: number) => {
|
||||||
const openDetail = (id: number) => {
|
try {
|
||||||
push({ name: 'CrmReceivableDetail', params: { id } })
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
// 发起删除
|
||||||
|
await ReceivableApi.deleteReceivable(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 监听打开的 bizId + bizType,从而加载最新的列表 */
|
/** 从回款计划创建回款 */
|
||||||
|
const crateReceivable = (planData: any) => {
|
||||||
|
const data = planData as unknown as ReceivablePlanApi.ReceivablePlanVO
|
||||||
|
formRef.value.open('create', undefined, data)
|
||||||
|
}
|
||||||
|
defineExpose({ crateReceivable })
|
||||||
|
/** 监听打开的 customerId + contractId,从而加载最新的列表 */
|
||||||
watch(
|
watch(
|
||||||
() => [props.bizId, props.bizType],
|
() => [props.customerId, props.contractId],
|
||||||
() => {
|
(newVal) => {
|
||||||
|
// 保证至少客户编号有值
|
||||||
|
if (!newVal[0]) {
|
||||||
|
return
|
||||||
|
}
|
||||||
handleQuery()
|
handleQuery()
|
||||||
},
|
},
|
||||||
{ immediate: true, deep: true }
|
{ immediate: true, deep: true }
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="回款金额(元)" prop="price" />
|
<el-table-column align="center" label="回款金额(元)" prop="price" />
|
||||||
<el-table-column align="center" label="负责人" prop="ownerUserId" />
|
<el-table-column align="center" label="负责人" prop="ownerUserName" />
|
||||||
<el-table-column align="center" label="备注" prop="remark" />
|
<el-table-column align="center" label="备注" prop="remark" />
|
||||||
<el-table-column align="center" fixed="right" label="回款状态" prop="auditStatus" width="120">
|
<el-table-column align="center" fixed="right" label="回款状态" prop="auditStatus" width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
@ -9,43 +9,73 @@
|
|||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap class="mt-10px">
|
<ContentWrap class="mt-10px">
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||||
<el-table-column label="期数" fixed="left" align="center" prop="no">
|
<el-table-column align="center" label="客户名称" prop="customerName" width="150px" />
|
||||||
<template #default="scope">
|
<el-table-column align="center" label="合同编号" prop="contractNo" width="200px" />
|
||||||
<el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
|
<el-table-column align="center" label="期数" prop="period" />
|
||||||
{{ scope.row.period }}
|
<el-table-column align="center" label="计划回款(元)" prop="price" width="120" />
|
||||||
</el-link>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="客户名称" align="center" prop="customerName" />
|
|
||||||
<el-table-column label="合同编号" align="center" prop="contractNo" />
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="计划还款金额(元)"
|
:formatter="dateFormatter2"
|
||||||
align="center"
|
|
||||||
prop="price"
|
|
||||||
:formatter="fenToYuanFormat"
|
|
||||||
/>
|
|
||||||
<el-table-column
|
|
||||||
label="计划还款日期"
|
|
||||||
align="center"
|
align="center"
|
||||||
|
label="计划回款日期"
|
||||||
prop="returnTime"
|
prop="returnTime"
|
||||||
:formatter="dateFormatter"
|
|
||||||
width="180px"
|
width="180px"
|
||||||
/>
|
/>
|
||||||
<el-table-column align="center" label="计划还款方式" prop="auditStatus">
|
<el-table-column align="center" label="提前几天提醒" prop="remindDays" width="150" />
|
||||||
|
<el-table-column
|
||||||
|
:formatter="dateFormatter2"
|
||||||
|
align="center"
|
||||||
|
label="提醒日期"
|
||||||
|
prop="remindTime"
|
||||||
|
width="180px"
|
||||||
|
/>
|
||||||
|
<el-table-column label="负责人" prop="ownerUserName" width="120" />
|
||||||
|
<el-table-column align="center" label="备注" prop="remark" />
|
||||||
|
<el-table-column
|
||||||
|
align="center"
|
||||||
|
fixed="right"
|
||||||
|
label="完成状态"
|
||||||
|
prop="finishStatus"
|
||||||
|
width="130px"
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE" :value="scope.row.returnType" />
|
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.finishStatus" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" fixed="right" label="操作" width="200px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable:create']"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="crateReceivable(scope.row)"
|
||||||
|
>
|
||||||
|
创建回款
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable-plan:update']"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('update', scope.row.id)"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['crm:receivable-plan:delete']"
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="提前几日提醒" align="center" prop="remindDays" />
|
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
|
||||||
<!-- TODO 芋艿:新建回款、编辑、删除 -->
|
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<Pagination
|
<Pagination
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNo"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
v-model:limit="queryParams.pageSize"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
:total="total"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
@ -53,45 +83,42 @@
|
|||||||
<!-- 表单弹窗:添加 -->
|
<!-- 表单弹窗:添加 -->
|
||||||
<ReceivableForm ref="formRef" @success="getList" />
|
<ReceivableForm ref="formRef" @success="getList" />
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script lang="ts" setup>
|
||||||
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
|
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
|
||||||
import ReceivableForm from './../ReceivablePlanForm.vue'
|
import ReceivableForm from './../ReceivablePlanForm.vue'
|
||||||
import { BizTypeEnum } from '@/api/crm/permission'
|
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
|
||||||
import { fenToYuanFormat } from '@/utils/formatter'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { dateFormatter2 } from '@/utils/formatTime'
|
||||||
|
|
||||||
defineOptions({ name: 'CrmReceivablePlanList' })
|
defineOptions({ name: 'CrmReceivablePlanList' })
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
bizType: number // 业务类型
|
customerId?: number // 客户编号
|
||||||
bizId: number // 业务编号
|
contractId?: number // 合同编号
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
const list = ref([]) // 列表的数据
|
const list = ref([]) // 列表的数据
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
customerId: undefined as unknown // 允许 undefined + number
|
customerId: undefined as unknown, // 允许 undefined + number
|
||||||
|
contractId: undefined as unknown // 允许 undefined + number
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
// 置空参数
|
if (props.customerId && !props.contractId) {
|
||||||
queryParams.customerId = undefined
|
queryParams.customerId = props.customerId
|
||||||
// 执行查询
|
} else if (props.customerId && props.contractId) {
|
||||||
let data = { list: [], total: 0 }
|
// 如果是合同的话客户编号也需要带上因为权限基于客户
|
||||||
switch (props.bizType) {
|
queryParams.customerId = props.customerId
|
||||||
case BizTypeEnum.CRM_CUSTOMER:
|
queryParams.contractId = props.contractId
|
||||||
queryParams.customerId = props.bizId
|
|
||||||
data = await ReceivablePlanApi.getReceivablePlanPageByCustomer(queryParams)
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
const data = await ReceivablePlanApi.getReceivablePlanPageByCustomer(queryParams)
|
||||||
list.value = data.list
|
list.value = data.list
|
||||||
total.value = data.total
|
total.value = data.total
|
||||||
} finally {
|
} finally {
|
||||||
@ -102,25 +129,46 @@ const getList = async () => {
|
|||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
queryParams.pageNo = 1
|
queryParams.pageNo = 1
|
||||||
|
// 置空参数
|
||||||
|
queryParams.customerId = undefined
|
||||||
|
queryParams.contractId = undefined
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加 */
|
/** 添加/修改操作 */
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
const openForm = () => {
|
const openForm = (type: string, id?: number) => {
|
||||||
formRef.value.open('create')
|
formRef.value.open(type, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 打开合同详情 */
|
const emits = defineEmits<{
|
||||||
const { push } = useRouter()
|
(e: 'crateReceivable', v: ReceivablePlanApi.ReceivablePlanVO)
|
||||||
const openDetail = (id: number) => {
|
}>()
|
||||||
push({ name: 'CrmReceivablePlanDetail', params: { id } })
|
/** 创建回款 */
|
||||||
|
const crateReceivable = (row: ReceivablePlanApi.ReceivablePlanVO) => {
|
||||||
|
emits('crateReceivable', row)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 监听打开的 bizId + bizType,从而加载最新的列表 */
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
// 发起删除
|
||||||
|
await ReceivablePlanApi.deleteReceivablePlan(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
/** 监听打开的 customerId + contractId,从而加载最新的列表 */
|
||||||
watch(
|
watch(
|
||||||
() => [props.bizId, props.bizType],
|
() => [props.customerId, props.contractId],
|
||||||
() => {
|
(newVal) => {
|
||||||
|
// 保证至少客户编号有值
|
||||||
|
if (!newVal[0]) {
|
||||||
|
return
|
||||||
|
}
|
||||||
handleQuery()
|
handleQuery()
|
||||||
},
|
},
|
||||||
{ immediate: true, deep: true }
|
{ immediate: true, deep: true }
|
||||||
|
@ -86,11 +86,7 @@
|
|||||||
prop="remindTime"
|
prop="remindTime"
|
||||||
width="180px"
|
width="180px"
|
||||||
/>
|
/>
|
||||||
<el-table-column label="负责人" prop="ownerUserId" width="120">
|
<el-table-column label="负责人" prop="ownerUserName" width="120" />
|
||||||
<template #default="scope">
|
|
||||||
{{ userList.find((user) => user.id === scope.row.ownerUserId)?.nickname }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column align="center" label="备注" prop="remark" />
|
<el-table-column align="center" label="备注" prop="remark" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
align="center"
|
||||||
|
Loading…
Reference in New Issue
Block a user