Skip to content

Commit 11766f5

Browse files
committed
✨ CRM:完善合同的列表实现
1 parent bbf6c16 commit 11766f5

File tree

4 files changed

+102
-34
lines changed

4 files changed

+102
-34
lines changed

src/api/crm/contract/index.ts

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,48 @@
11
import request from '@/config/axios'
2-
import { ProductExpandVO } from '@/api/crm/product'
32
import { TransferReqVO } from '@/api/crm/customer'
43

54
export interface ContractVO {
65
id: number
76
name: string
7+
no: string
88
customerId: number
9+
customerName?: string
910
businessId: number
1011
businessName: string
12+
contactLastTime: Date
13+
ownerUserId: number
14+
ownerUserName?: string
15+
ownerUserDeptName?: string
1116
processInstanceId: number
17+
auditStatus: number
1218
orderDate: Date
13-
ownerUserId: number
14-
no: string
1519
startTime: Date
1620
endTime: Date
17-
price: number
21+
totalProductPrice: number
1822
discountPercent: number
19-
productPrice: number
20-
contactId: number
23+
totalPrice: number
24+
signContactId: number
25+
signContactName?: string
2126
signUserId: number
2227
signUserName: string
23-
contactLastTime: Date
24-
auditStatus: number
2528
remark: string
26-
productItems: ProductExpandVO[]
29+
createTime?: Date
30+
creator: string
2731
creatorName: string
2832
updateTime?: Date
29-
createTime?: Date
30-
customerName: string
31-
contactName: string
32-
ownerUserName: string
33+
products?: [
34+
{
35+
id: number
36+
productId: number
37+
productName: string
38+
productNo: string
39+
productUnit: number
40+
productPrice: number
41+
contractPrice: number
42+
count: number
43+
totalPrice: number
44+
}
45+
]
3346
}
3447

3548
// 查询 CRM 合同列表

src/api/crm/product/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface ProductVO {
1212
ownerUserId: number
1313
}
1414

15+
// TODO 芋艿:待删除
1516
export interface ProductExpandVO extends ProductVO {
1617
count: number
1718
discountPercent: number

src/views/crm/contact/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ const { t } = useI18n() // 国际化
230230
const loading = ref(true) // 列表的加载中
231231
const total = ref(0) // 列表的总页数
232232
const list = ref([]) // 列表的数据
233-
const customerList = ref<CustomerApi.CustomerVO[]>([]) // 客户列表
234233
const queryParams = reactive({
235234
pageNo: 1,
236235
pageSize: 10,
@@ -245,6 +244,7 @@ const queryParams = reactive({
245244
const queryFormRef = ref() // 搜索的表单
246245
const exportLoading = ref(false) // 导出的加载中
247246
const activeName = ref('1') // 列表 tab
247+
const customerList = ref<CustomerApi.CustomerVO[]>([]) // 客户列表
248248
249249
/** 查询列表 */
250250
const getList = async () => {

src/views/crm/contract/index.vue

Lines changed: 74 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@
2525
placeholder="请输入合同名称"
2626
@keyup.enter="handleQuery"
2727
/>
28+
<el-form-item label="客户" prop="customerId">
29+
<el-select
30+
v-model="queryParams.customerId"
31+
class="!w-240px"
32+
clearable
33+
lable-key="name"
34+
placeholder="请选择客户"
35+
value-key="id"
36+
@keyup.enter="handleQuery"
37+
>
38+
<el-option
39+
v-for="item in customerList"
40+
:key="item.id"
41+
:label="item.name"
42+
:value="item.id!"
43+
/>
44+
</el-select>
45+
</el-form-item>
2846
</el-form-item>
2947
<el-form-item>
3048
<el-button @click="handleQuery">
@@ -55,9 +73,20 @@
5573

5674
<!-- 列表 -->
5775
<ContentWrap>
76+
<el-tabs v-model="activeName" @tab-click="handleTabClick">
77+
<el-tab-pane label="我负责的" name="1" />
78+
<el-tab-pane label="我参与的" name="2" />
79+
<el-tab-pane label="下属负责的" name="3" />
80+
</el-tabs>
5881
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
5982
<el-table-column align="center" fixed="left" label="合同编号" prop="no" width="130" />
60-
<el-table-column align="center" label="合同名称" prop="name" width="130" />
83+
<el-table-column align="center" fixed="left" label="合同名称" prop="name" width="160">
84+
<template #default="scope">
85+
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
86+
{{ scope.row.name }}
87+
</el-link>
88+
</template>
89+
</el-table-column>
6190
<el-table-column align="center" label="客户名称" prop="customerName" width="120">
6291
<template #default="scope">
6392
<el-link
@@ -69,22 +98,31 @@
6998
</el-link>
7099
</template>
71100
</el-table-column>
72-
<!-- TODO @puhui999:做了商机详情后,可以把这个超链接加上 -->
73-
<el-table-column align="center" label="商机名称" prop="businessName" width="130" />
101+
<el-table-column align="center" label="商机名称" prop="businessName" width="130">
102+
<template #default="scope">
103+
<el-link
104+
:underline="false"
105+
type="primary"
106+
@click="openBusinessDetail(scope.row.businessId)"
107+
>
108+
{{ scope.row.businessName }}
109+
</el-link>
110+
</template>
111+
</el-table-column>
112+
<el-table-column
113+
align="center"
114+
label="合同金额(元)"
115+
prop="totalPrice"
116+
width="140"
117+
:formatter="erpPriceTableColumnFormatter"
118+
/>
74119
<el-table-column
75120
align="center"
76121
label="下单时间"
77122
prop="orderDate"
78123
width="120"
79124
:formatter="dateFormatter2"
80125
/>
81-
<el-table-column
82-
align="center"
83-
label="合同金额"
84-
prop="price"
85-
width="130"
86-
:formatter="fenToYuanFormat"
87-
/>
88126
<el-table-column
89127
align="center"
90128
label="合同开始时间"
@@ -104,17 +142,24 @@
104142
<el-link
105143
:underline="false"
106144
type="primary"
107-
@click="openContactDetail(scope.row.contactId)"
145+
@click="openContactDetail(scope.row.signContactId)"
108146
>
109-
{{ scope.row.contactName }}
147+
{{ scope.row.signContactName }}
110148
</el-link>
111149
</template>
112150
</el-table-column>
113151
<el-table-column align="center" label="公司签约人" prop="signUserName" width="130" />
114-
<el-table-column align="center" label="备注" prop="remark" width="130" />
152+
<el-table-column align="center" label="备注" prop="remark" width="200" />
115153
<!-- TODO @puhui999:后续可加 【已收款金额】、【未收款金额】 -->
154+
<el-table-column
155+
:formatter="dateFormatter"
156+
align="center"
157+
label="最后跟进时间"
158+
prop="contactLastTime"
159+
width="180px"
160+
/>
116161
<el-table-column align="center" label="负责人" prop="ownerUserName" width="120" />
117-
<el-table-column align="center" label="创建人" prop="creatorName" width="120" />
162+
<el-table-column align="center" label="所属部门" prop="ownerUserDeptName" width="100px" />
118163
<el-table-column
119164
:formatter="dateFormatter"
120165
align="center"
@@ -129,6 +174,7 @@
129174
prop="createTime"
130175
width="180px"
131176
/>
177+
<el-table-column align="center" label="创建人" prop="creatorName" width="120" />
132178
<el-table-column align="center" fixed="right" label="合同状态" prop="auditStatus" width="120">
133179
<template #default="scope">
134180
<dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
@@ -191,6 +237,8 @@ import * as ContractApi from '@/api/crm/contract'
191237
import ContractForm from './ContractForm.vue'
192238
import { fenToYuanFormat } from '@/utils/formatter'
193239
import { DICT_TYPE } from '@/utils/dict'
240+
import { erpPriceTableColumnFormatter } from '@/utils'
241+
import * as CustomerApi from '@/api/crm/customer'
194242
195243
defineOptions({ name: 'CrmContract' })
196244
@@ -203,16 +251,16 @@ const list = ref([]) // 列表的数据
203251
const queryParams = reactive({
204252
pageNo: 1,
205253
pageSize: 10,
254+
sceneType: '1', // 默认和 activeName 相等
206255
name: null,
207256
customerId: null,
208-
businessId: null,
209257
orderDate: [],
210-
no: null,
211-
discountPercent: null,
212-
productPrice: null
258+
no: null
213259
})
214260
const queryFormRef = ref() // 搜索的表单
215261
const exportLoading = ref(false) // 导出的加载中
262+
const activeName = ref('1') // 列表 tab
263+
const customerList = ref<CustomerApi.CustomerVO[]>([]) // 客户列表
216264
217265
/** 查询列表 */
218266
const getList = async () => {
@@ -296,8 +344,14 @@ const openContactDetail = (id: number) => {
296344
push({ name: 'CrmContactDetail', params: { id } })
297345
}
298346
347+
/** 打开商机详情 */
348+
const openBusinessDetail = (id: number) => {
349+
push({ name: 'CrmBusinessDetail', params: { id } })
350+
}
351+
299352
/** 初始化 **/
300-
onMounted(() => {
301-
getList()
353+
onMounted(async () => {
354+
await getList()
355+
customerList.value = await CustomerApi.getCustomerSimpleList()
302356
})
303357
</script>

0 commit comments

Comments
 (0)