crm: 增加基于客户查询回款分页

This commit is contained in:
YunaiV 2023-12-01 19:37:51 +08:00
parent 88e5e67a89
commit bdc80ea55b
4 changed files with 144 additions and 164 deletions

View File

@ -6,46 +6,47 @@ export interface ReceivableVO {
planId: number
customerId: number
contractId: number
checkStatus: number
auditStatus: number
processInstanceId: number
returnTime: Date
returnType: string
price: number
ownerUserId: number
batchId: number
sort: number
dataScope: number
dataScopeDeptIds: string
status: number
remark: string
}
// 查询回款管理列表
// 查询回款列表
export const getReceivablePage = async (params) => {
return await request.get({ url: `/crm/receivable/page`, params })
}
// 查询回款管理详情
// 查询回款列表
export const getReceivablePageByCustomer = async (params) => {
return await request.get({ url: `/crm/receivable/page-by-customer`, params })
}
// 查询回款详情
export const getReceivable = async (id: number) => {
return await request.get({ url: `/crm/receivable/get?id=` + id })
}
// 新增回款管理
// 新增回款
export const createReceivable = async (data: ReceivableVO) => {
return await request.post({ url: `/crm/receivable/create`, data })
}
// 修改回款管理
// 修改回款
export const updateReceivable = async (data: ReceivableVO) => {
return await request.put({ url: `/crm/receivable/update`, data })
}
// 删除回款管理
// 删除回款
export const deleteReceivable = async (id: number) => {
return await request.delete({ url: `/crm/receivable/delete?id=` + id })
}
// 导出回款管理 Excel
// 导出回款 Excel
export const exportReceivable = async (params) => {
return await request.download({ url: `/crm/receivable/export-excel`, params })
}

View File

@ -18,7 +18,9 @@
<el-tab-pane label="合同" lazy>
<ContractList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
</el-tab-pane>
<el-tab-pane label="回款" lazy>TODO待开发 </el-tab-pane>
<el-tab-pane label="回款" lazy>
<ReceivableList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
</el-tab-pane>
<el-tab-pane label="回访" lazy>TODO 待开发</el-tab-pane>
</el-tabs>
</el-col>
@ -31,6 +33,7 @@ import CustomerDetailsHeader from './CustomerDetailsHeader.vue' // 客户明细
import ContactList from '@/views/crm/contact/components/ContactList.vue' //
import ContractList from '@/views/crm/contract/components/ContractList.vue' //
import BusinessList from '@/views/crm/business/components/BusinessList.vue' //
import ReceivableList from '@/views/crm/receivable/components/ReceivableList.vue' //
import PermissionList from '@/views/crm/permission/components/PermissionList.vue' //
import { BizTypeEnum } from '@/api/crm/permission'

View File

@ -0,0 +1,125 @@
<template>
<!-- 操作栏 -->
<el-row justify="end">
<el-button @click="openForm">
<Icon class="mr-5px" icon="icon-park:income-one" />
创建回款
</el-button>
</el-row>
<!-- 列表 -->
<ContentWrap class="mt-10px">
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="回款编号" fixed="left" align="center" prop="no">
<template #default="scope">
<el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
{{ scope.row.no }}
</el-link>
</template>
</el-table-column>
<el-table-column label="合同编号" align="center" prop="contractNo" />
<el-table-column
label="回款金额(元)"
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="回款日期"
align="center"
prop="returnTime"
:formatter="dateFormatter"
width="180px"
/>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加 -->
<ReceivableForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import * as ReceivableApi from '@/api/crm/receivable'
import ReceivableForm from './../ReceivableForm.vue'
import { BizTypeEnum } from '@/api/crm/permission'
import { dateFormatter } from '@/utils/formatTime'
import { fenToYuanFormat } from '@/utils/formatter'
import { DICT_TYPE } from '@/utils/dict'
defineOptions({ name: 'CrmReceivableList' })
const props = defineProps<{
bizType: number //
bizId: number //
}>()
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
customerId: undefined as unknown // undefined + number
})
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
//
queryParams.customerId = undefined
//
let data = { list: [], total: 0 }
switch (props.bizType) {
case BizTypeEnum.CRM_CUSTOMER:
queryParams.customerId = props.bizId
data = await ReceivableApi.getReceivablePageByCustomer(queryParams)
break
default:
return
}
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 添加 */
const formRef = ref()
const openForm = () => {
formRef.value.open('create')
}
/** 打开合同详情 */
const { push } = useRouter()
const openDetail = (id: number) => {
push({ name: 'CrmReceivableDetail', params: { id } })
}
/** 监听打开的 bizId + bizType从而加载最新的列表 */
watch(
() => [props.bizId, props.bizType],
() => {
handleQuery()
},
{ immediate: true, deep: true }
)
</script>

View File

@ -17,15 +17,6 @@
class="!w-240px"
/>
</el-form-item>
<!--<el-form-item label="回款计划ID" prop="planId">
<el-input
v-model="queryParams.planId"
placeholder="请输入回款计划ID"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>-->
<el-form-item label="客户名称" prop="customerId">
<el-input
v-model="queryParams.customerId"
@ -35,131 +26,6 @@
class="!w-240px"
/>
</el-form-item>
<el-form-item label="合同名称" prop="contractId">
<el-input
v-model="queryParams.contractId"
placeholder="请输入合同名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="审批状态" prop="checkStatus">
<el-select
v-model="queryParams.checkStatus"
placeholder="请选择审批状态"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.CRM_AUDIT_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!--<el-form-item label="工作流编号" prop="processInstanceId">
<el-input
v-model="queryParams.processInstanceId"
placeholder="请输入工作流编号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>-->
<el-form-item label="回款日期" prop="returnTime">
<el-date-picker
v-model="queryParams.returnTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="回款方式" prop="returnType">
<el-select
v-model="queryParams.returnType"
placeholder="请选择回款方式"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.CRM_RETURN_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!--<el-form-item label="回款金额" prop="price">
<el-input
v-model="queryParams.price"
placeholder="请输入回款金额"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>-->
<!--<el-form-item label="负责人" prop="ownerUserId">
<el-input
v-model="queryParams.ownerUserId"
placeholder="请输入负责人"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="批次" prop="batchId">
<el-input
v-model="queryParams.batchId"
placeholder="请输入批次"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>-->
<!--<el-form-item label="数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限" prop="dataScope">
<el-input
v-model="queryParams.dataScope"
placeholder="请输入数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="数据范围(指定部门数组)" prop="dataScopeDeptIds">
<el-input
v-model="queryParams.dataScopeDeptIds"
placeholder="请输入数据范围(指定部门数组)"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>-->
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
@ -266,7 +132,7 @@
</template>
<script setup lang="ts">
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
import download from '@/utils/download'
import * as ReceivableApi from '@/api/crm/receivable'
@ -284,22 +150,7 @@ const queryParams = reactive({
pageNo: 1,
pageSize: 10,
no: null,
planId: null,
customerId: null,
contractId: null,
checkStatus: null,
processInstanceId: null,
returnTime: [],
returnType: null,
price: null,
ownerUserId: null,
batchId: null,
sort: null,
dataScope: null,
dataScopeDeptIds: null,
status: null,
remark: null,
createTime: []
customerId: null
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
@ -355,7 +206,7 @@ const handleExport = async () => {
//
exportLoading.value = true
const data = await ReceivableApi.exportReceivable(queryParams)
download.excel(data, '回款管理.xls')
download.excel(data, '回款.xls')
} catch {
} finally {
exportLoading.value = false