Skip to content

Commit b0c1e55

Browse files
committed
crm: 增加基于客户查询回款计划分页
1 parent bdc80ea commit b0c1e55

File tree

9 files changed

+143
-106
lines changed

9 files changed

+143
-106
lines changed

src/api/crm/receivablePlan/index.ts renamed to src/api/crm/receivable/plan/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ export const getReceivablePlanPage = async (params) => {
2323
return await request.get({ url: `/crm/receivable-plan/page`, params })
2424
}
2525

26+
// 查询回款计划列表
27+
export const getReceivablePlanPageByCustomer = async (params) => {
28+
return await request.get({ url: `/crm/receivable-plan/page-by-customer`, params })
29+
}
30+
2631
// 查询回款计划详情
2732
export const getReceivablePlan = async (id: number) => {
2833
return await request.get({ url: `/crm/receivable-plan/get?id=` + id })

src/utils/dict.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export enum DICT_TYPE {
192192
// ========== CRM - 客户管理模块 ==========
193193
CRM_AUDIT_STATUS = 'crm_audit_status', // CRM 审批状态
194194
CRM_BIZ_TYPE = 'crm_biz_type', // CRM 业务类型
195-
CRM_RETURN_TYPE = 'crm_return_type',
195+
CRM_RECEIVABLE_RETURN_TYPE = 'crm_receivable_return_type', // CRM 回款的还款方式
196196
CRM_CUSTOMER_INDUSTRY = 'crm_customer_industry',
197197
CRM_CUSTOMER_LEVEL = 'crm_customer_level',
198198
CRM_CUSTOMER_SOURCE = 'crm_customer_source',

src/views/crm/contact/components/ContactList.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.master" />
2626
</template>
2727
</el-table-column>
28+
<!-- TODO 芋艿:【操作:设为首要联系人】 -->
2829
</el-table>
2930
<!-- 分页 -->
3031
<Pagination

src/views/crm/customer/detail/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<ContractList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
2020
</el-tab-pane>
2121
<el-tab-pane label="回款" lazy>
22+
<ReceivablePlanList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
2223
<ReceivableList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
2324
</el-tab-pane>
2425
<el-tab-pane label="回访" lazy>TODO 待开发</el-tab-pane>
@@ -34,6 +35,7 @@ import ContactList from '@/views/crm/contact/components/ContactList.vue' // 联
3435
import ContractList from '@/views/crm/contract/components/ContractList.vue' // 合同列表
3536
import BusinessList from '@/views/crm/business/components/BusinessList.vue' // 商机列表
3637
import ReceivableList from '@/views/crm/receivable/components/ReceivableList.vue' // 回款列表
38+
import ReceivablePlanList from '@/views/crm/receivable/plan/components/ReceivablePlanList.vue' // 回款计划列表
3739
import PermissionList from '@/views/crm/permission/components/PermissionList.vue' // 团队成员列表(权限)
3840
import { BizTypeEnum } from '@/api/crm/permission'
3941

src/views/crm/receivable/ReceivableForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<el-form-item label="回款方式" prop="returnType">
4444
<el-select v-model="formData.returnType" placeholder="请选择回款方式">
4545
<el-option
46-
v-for="dict in getStrDictOptions(DICT_TYPE.CRM_RETURN_TYPE)"
46+
v-for="dict in getStrDictOptions(DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE)"
4747
:key="dict.value"
4848
:label="dict.label"
4949
:value="dict.value"

src/views/crm/receivable/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
/>
7474
<el-table-column label="回款方式" align="center" prop="returnType" width="130px">
7575
<template #default="scope">
76-
<dict-tag :type="DICT_TYPE.CRM_RETURN_TYPE" :value="scope.row.returnType" />
76+
<dict-tag :type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE" :value="scope.row.returnType" />
7777
</template>
7878
</el-table-column>
7979
<el-table-column label="回款金额(元)" align="center" prop="price" />

src/views/crm/receivablePlan/ReceivablePlanForm.vue renamed to src/views/crm/receivable/plan/ReceivablePlanForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
</Dialog>
8989
</template>
9090
<script setup lang="ts">
91-
import * as ReceivablePlanApi from '@/api/crm/receivablePlan'
91+
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
9292
import * as UserApi from '@/api/system/user'
9393
const { t } = useI18n() // 国际化
9494
const message = useMessage() // 消息弹窗
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<template>
2+
<!-- 操作栏 -->
3+
<el-row justify="end">
4+
<el-button @click="openForm">
5+
<Icon class="mr-5px" icon="icon-park:income" />
6+
创建回款计划
7+
</el-button>
8+
</el-row>
9+
10+
<!-- 列表 -->
11+
<ContentWrap class="mt-10px">
12+
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
13+
<el-table-column label="期数" fixed="left" align="center" prop="no">
14+
<template #default="scope">
15+
<el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
16+
{{ scope.row.period }}
17+
</el-link>
18+
</template>
19+
</el-table-column>
20+
<el-table-column label="客户名称" align="center" prop="customerName" />
21+
<el-table-column label="合同编号" align="center" prop="contractNo" />
22+
<el-table-column
23+
label="计划还款金额(元)"
24+
align="center"
25+
prop="price"
26+
:formatter="fenToYuanFormat"
27+
/>
28+
<el-table-column
29+
label="计划还款日期"
30+
align="center"
31+
prop="returnTime"
32+
:formatter="dateFormatter"
33+
width="180px"
34+
/>
35+
<el-table-column align="center" label="计划还款方式" prop="auditStatus">
36+
<template #default="scope">
37+
<dict-tag :type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE" :value="scope.row.returnType" />
38+
</template>
39+
</el-table-column>
40+
<el-table-column label="提前几日提醒" align="center" prop="remindDays" />
41+
<el-table-column label="备注" align="center" prop="remark" />
42+
<!-- TODO 芋艿:新建回款、编辑、删除 -->
43+
</el-table>
44+
<!-- 分页 -->
45+
<Pagination
46+
:total="total"
47+
v-model:page="queryParams.pageNo"
48+
v-model:limit="queryParams.pageSize"
49+
@pagination="getList"
50+
/>
51+
</ContentWrap>
52+
53+
<!-- 表单弹窗:添加 -->
54+
<ReceivableForm ref="formRef" @success="getList" />
55+
</template>
56+
<script setup lang="ts">
57+
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
58+
import ReceivableForm from './../ReceivablePlanForm.vue'
59+
import { BizTypeEnum } from '@/api/crm/permission'
60+
import { dateFormatter } from '@/utils/formatTime'
61+
import { fenToYuanFormat } from '@/utils/formatter'
62+
import { DICT_TYPE } from '@/utils/dict'
63+
64+
defineOptions({ name: 'CrmReceivablePlanList' })
65+
const props = defineProps<{
66+
bizType: number // 业务类型
67+
bizId: number // 业务编号
68+
}>()
69+
70+
const loading = ref(true) // 列表的加载中
71+
const total = ref(0) // 列表的总页数
72+
const list = ref([]) // 列表的数据
73+
const queryParams = reactive({
74+
pageNo: 1,
75+
pageSize: 10,
76+
customerId: undefined as unknown // 允许 undefined + number
77+
})
78+
79+
/** 查询列表 */
80+
const getList = async () => {
81+
loading.value = true
82+
try {
83+
// 置空参数
84+
queryParams.customerId = undefined
85+
// 执行查询
86+
let data = { list: [], total: 0 }
87+
switch (props.bizType) {
88+
case BizTypeEnum.CRM_CUSTOMER:
89+
queryParams.customerId = props.bizId
90+
data = await ReceivablePlanApi.getReceivablePlanPageByCustomer(queryParams)
91+
break
92+
default:
93+
return
94+
}
95+
list.value = data.list
96+
total.value = data.total
97+
} finally {
98+
loading.value = false
99+
}
100+
}
101+
102+
/** 搜索按钮操作 */
103+
const handleQuery = () => {
104+
queryParams.pageNo = 1
105+
getList()
106+
}
107+
108+
/** 添加 */
109+
const formRef = ref()
110+
const openForm = () => {
111+
formRef.value.open('create')
112+
}
113+
114+
/** 打开合同详情 */
115+
const { push } = useRouter()
116+
const openDetail = (id: number) => {
117+
push({ name: 'CrmReceivablePlanDetail', params: { id } })
118+
}
119+
120+
/** 监听打开的 bizId + bizType,从而加载最新的列表 */
121+
watch(
122+
() => [props.bizId, props.bizType],
123+
() => {
124+
handleQuery()
125+
},
126+
{ immediate: true, deep: true }
127+
)
128+
</script>

src/views/crm/receivablePlan/index.vue renamed to src/views/crm/receivable/plan/index.vue

Lines changed: 3 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -26,96 +26,6 @@
2626
class="!w-240px"
2727
/>
2828
</el-form-item>
29-
<el-form-item label="完成状态" prop="status">
30-
<el-select
31-
v-model="queryParams.status"
32-
placeholder="请选择完成状态"
33-
clearable
34-
class="!w-240px"
35-
>
36-
<el-option
37-
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
38-
:key="dict.value"
39-
:label="dict.label"
40-
:value="dict.value"
41-
/>
42-
</el-select>
43-
</el-form-item>
44-
<el-form-item label="审批状态" prop="checkStatus">
45-
<el-select
46-
v-model="queryParams.checkStatus"
47-
placeholder="请选择审批状态"
48-
clearable
49-
class="!w-240px"
50-
>
51-
<el-option
52-
v-for="dict in getStrDictOptions(DICT_TYPE.CRM_AUDIT_STATUS)"
53-
:key="dict.value"
54-
:label="dict.label"
55-
:value="dict.value"
56-
/>
57-
</el-select>
58-
</el-form-item>
59-
<el-form-item label="回款日期" prop="returnTime">
60-
<el-date-picker
61-
v-model="queryParams.returnTime"
62-
value-format="YYYY-MM-DD HH:mm:ss"
63-
type="daterange"
64-
start-placeholder="开始日期"
65-
end-placeholder="结束日期"
66-
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
67-
class="!w-240px"
68-
/>
69-
</el-form-item>
70-
<!--<el-form-item label="提前几天提醒" prop="remindDays">
71-
<el-input
72-
v-model="queryParams.remindDays"
73-
placeholder="请输入提前几天提醒"
74-
clearable
75-
@keyup.enter="handleQuery"
76-
class="!w-240px"
77-
/>
78-
</el-form-item>-->
79-
<!--<el-form-item label="提醒日期" prop="remindTime">
80-
<el-date-picker
81-
v-model="queryParams.remindTime"
82-
value-format="YYYY-MM-DD HH:mm:ss"
83-
type="daterange"
84-
start-placeholder="开始日期"
85-
end-placeholder="结束日期"
86-
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
87-
class="!w-240px"
88-
/>
89-
</el-form-item>-->
90-
<!--<el-form-item label="负责人" prop="ownerUserId">
91-
<el-input
92-
v-model="queryParams.ownerUserId"
93-
placeholder="请输入负责人"
94-
clearable
95-
@keyup.enter="handleQuery"
96-
class="!w-240px"
97-
/>
98-
</el-form-item>
99-
<el-form-item label="备注" prop="remark">
100-
<el-input
101-
v-model="queryParams.remark"
102-
placeholder="请输入备注"
103-
clearable
104-
@keyup.enter="handleQuery"
105-
class="!w-240px"
106-
/>
107-
</el-form-item>-->
108-
<el-form-item label="创建时间" prop="createTime">
109-
<el-date-picker
110-
v-model="queryParams.createTime"
111-
value-format="YYYY-MM-DD HH:mm:ss"
112-
type="daterange"
113-
start-placeholder="开始日期"
114-
end-placeholder="结束日期"
115-
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
116-
class="!w-240px"
117-
/>
118-
</el-form-item>
11929
<el-form-item>
12030
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
12131
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
@@ -224,10 +134,10 @@
224134
</template>
225135

226136
<script setup lang="ts">
227-
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
137+
import { DICT_TYPE } from '@/utils/dict'
228138
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
229139
import download from '@/utils/download'
230-
import * as ReceivablePlanApi from '@/api/crm/receivablePlan'
140+
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
231141
import ReceivablePlanForm from './ReceivablePlanForm.vue'
232142
import * as UserApi from '@/api/system/user'
233143
@@ -243,17 +153,8 @@ const userList = ref<UserApi.UserVO[]>([]) // 用户列表
243153
const queryParams = reactive({
244154
pageNo: 1,
245155
pageSize: 10,
246-
period: null,
247-
status: null,
248-
checkStatus: null,
249-
returnTime: [],
250-
remindDays: null,
251-
remindTime: [],
252156
customerId: null,
253-
contractId: null,
254-
ownerUserId: null,
255-
remark: null,
256-
createTime: []
157+
contractId: null
257158
})
258159
const queryFormRef = ref() // 搜索的表单
259160
const exportLoading = ref(false) // 导出的加载中

0 commit comments

Comments
 (0)