|
@@ -1,204 +1,204 @@
|
1
|
|
-import React, { useState } from 'react';
|
2
|
|
-import { Avatar, Button,message } from 'antd';
|
3
|
|
-import moment from 'moment';
|
4
|
|
-import request from '@/utils/request';
|
5
|
|
-import apis from '@/services/apis';
|
6
|
|
-import QueryTable from '@/components/QueryTable'
|
7
|
|
-import { router } from 'umi';
|
8
|
|
-import AuthButton from '@/components/AuthButton';
|
9
|
|
-import BuildingSelect from '@/components/SelectButton/BuildSelect';
|
10
|
|
-
|
11
|
|
-
|
12
|
|
-
|
13
|
|
-/**
|
14
|
|
- *
|
15
|
|
- *
|
16
|
|
- * @param {*} props
|
17
|
|
- * @returns
|
18
|
|
- */
|
19
|
|
-function Recommend(props) {
|
20
|
|
- const [exportLoding,setExportLoding] = useState(false)
|
21
|
|
-
|
22
|
|
- function toAudit(cuurentId) {
|
23
|
|
- router.push({
|
24
|
|
- pathname: '/customer/recommend/customer/audit',
|
25
|
|
- query: {
|
26
|
|
- id: cuurentId,
|
27
|
|
- },
|
28
|
|
- })
|
29
|
|
- }
|
30
|
|
-
|
31
|
|
-
|
32
|
|
- /**
|
33
|
|
- *导出数据(推荐用户)
|
34
|
|
- *
|
35
|
|
- */
|
36
|
|
- function exportRecommendCustomer() {
|
37
|
|
- setExportLoding(true)
|
38
|
|
- request({
|
39
|
|
- ...apis.customer.customerRecommendRecommenderExport,
|
40
|
|
- responseType: 'blob',
|
41
|
|
- }).then(response => {
|
42
|
|
- console.log('exportRecommendCustomer: ', response)
|
43
|
|
- download(response)
|
44
|
|
- }).catch(error => {
|
45
|
|
-
|
46
|
|
- })
|
47
|
|
- }
|
48
|
|
-
|
49
|
|
- function download(data) {
|
50
|
|
- if (!data) {
|
51
|
|
- return
|
52
|
|
- }
|
53
|
|
- const url = window.URL.createObjectURL(new Blob([data]))
|
54
|
|
- const link = document.createElement('a')
|
55
|
|
- link.style.display = 'none'
|
56
|
|
- link.href = url
|
57
|
|
- link.setAttribute('download', '推荐客户.xlsx')
|
58
|
|
- document.body.append(link)
|
59
|
|
- link.click()
|
60
|
|
- setExportLoding(false)
|
61
|
|
- }
|
62
|
|
-
|
63
|
|
- const columns = [
|
64
|
|
- // {
|
65
|
|
- // title: '头像',
|
66
|
|
- // dataIndex: 'picture',
|
67
|
|
- // key: 'picture',
|
68
|
|
- // render: (_, record) => <Avatar shape="square" src={record.picture} size={64} icon="user" />,
|
69
|
|
- // },
|
70
|
|
- {
|
71
|
|
- title: '姓名',
|
72
|
|
- dataIndex: 'name',
|
73
|
|
- key: 'name',
|
74
|
|
- },
|
75
|
|
- {
|
76
|
|
- title: '电话',
|
77
|
|
- dataIndex: 'phone',
|
78
|
|
- key: 'phone',
|
79
|
|
- },
|
80
|
|
- {
|
81
|
|
- title: '性别',
|
82
|
|
- dataIndex: 'sex',
|
83
|
|
- key: 'sex',
|
84
|
|
- // eslint-disable-next-line no-nested-ternary
|
85
|
|
- render: (_, record) => <><span>{record.sex === 1 ? '男' : record.sex === 2 ? '女' : '未知'}</span></>,
|
86
|
|
- },
|
87
|
|
- {
|
88
|
|
- title: '意向项目',
|
89
|
|
- dataIndex: 'buildingName',
|
90
|
|
- key: 'buildingName',
|
91
|
|
- },
|
92
|
|
- {
|
93
|
|
- title: '推荐人',
|
94
|
|
- dataIndex: 'recommendPersonName',
|
95
|
|
- key: 'recommendPersonName',
|
96
|
|
- render: (_, record) => {
|
97
|
|
- const phone = record.recommendPhone ? ` ${record.recommendPhone}` : ''
|
98
|
|
- return <span>{`${record.recommendPersonName}${phone}`}</span>
|
99
|
|
- },
|
100
|
|
- },
|
101
|
|
- {
|
102
|
|
- title: '推荐时间',
|
103
|
|
- dataIndex: 'createDate',
|
104
|
|
- key: 'createDate',
|
105
|
|
- render: (_, record) => <><span>{record.createDate && moment(record.createDate).format('YYYY-MM-DD')}</span></>,
|
106
|
|
- },
|
107
|
|
- {
|
108
|
|
- title: '状态',
|
109
|
|
- dataIndex: 'status',
|
110
|
|
- key: 'status',
|
111
|
|
- render: (_, record) => <><span>{record.status === '1' ? '未到访' : record.status === '2' ? '已到访' : record.status === '3' ? '无效' : ''}</span></>,
|
112
|
|
- },
|
113
|
|
- {
|
114
|
|
- title: '操作',
|
115
|
|
- dataIndex: 'customerId',
|
116
|
|
- key: 'customerId',
|
117
|
|
- render: (_, record) => (
|
118
|
|
- <>{record.status === '1' ? (
|
119
|
|
- <AuthButton name="customer.channel.verify">
|
120
|
|
- <Button type='link' onClick={() => toAudit(record.channelCustomerId)}>审核</Button>
|
121
|
|
- </AuthButton>
|
122
|
|
- ) : (
|
123
|
|
- <Button type='link' onClick={() => toAudit(record.channelCustomerId)}>查看详情</Button>
|
124
|
|
- )
|
125
|
|
-
|
126
|
|
- }
|
127
|
|
- {/* {
|
128
|
|
- <AuthButton name="admin.customer.recommend.verify.id.put" noRight={null}>
|
129
|
|
- {record.verifyStatus === 0 ? <span style={{ color: 'rgba(239,39,58,1)', cursor: 'pointer' }} onClick={() => toAudit(record.customerId)}>审核</span> : ''}
|
130
|
|
- </AuthButton>
|
131
|
|
- } */}
|
132
|
|
- </>
|
133
|
|
- ),
|
134
|
|
- },
|
135
|
|
- ]
|
136
|
|
-
|
137
|
|
- const searchFields=[
|
138
|
|
- {
|
139
|
|
- name: 'buildingId',
|
140
|
|
- label: '项目',
|
141
|
|
- placeholder: '项目',
|
142
|
|
- render: () => <BuildingSelect style={{width: 160}} />
|
143
|
|
- },
|
144
|
|
- {
|
145
|
|
- name: 'name',
|
146
|
|
- label: '姓名',
|
147
|
|
- placeholder: '请输入姓名',
|
148
|
|
- },
|
149
|
|
- {
|
150
|
|
- name: 'phone',
|
151
|
|
- label: '电话',
|
152
|
|
- placeholder: '请输入电话',
|
153
|
|
- },
|
154
|
|
- {
|
155
|
|
- name: 'recommendPersonName',
|
156
|
|
- label: '推荐人',
|
157
|
|
- placeholder: '请输入推荐人姓名',
|
158
|
|
- },
|
159
|
|
- {
|
160
|
|
- name: 'recommendPhone',
|
161
|
|
- label: '推荐人电话',
|
162
|
|
- placeholder: '请输入推荐人电话电话',
|
163
|
|
- },
|
164
|
|
- {
|
165
|
|
- name: 'status',
|
166
|
|
- label: '状态',
|
167
|
|
- placeholder: '请选择状态',
|
168
|
|
- type: 'select',
|
169
|
|
- options: [
|
170
|
|
- {label: '未到访', value: '1'},
|
171
|
|
- {label: '已到访', value: '2'},
|
172
|
|
- {label: '无效', value: '3'}
|
173
|
|
- ]
|
174
|
|
- },
|
175
|
|
- ]
|
176
|
|
-
|
177
|
|
- const actionRender = () => {
|
178
|
|
-
|
179
|
|
- return (
|
180
|
|
- <Button type="danger" loading={exportLoding} onClick={() => exportRecommendCustomer()}>
|
181
|
|
- 导出
|
182
|
|
- </Button>
|
183
|
|
- );
|
184
|
|
-};
|
185
|
|
-
|
186
|
|
- return (
|
187
|
|
- <>
|
188
|
|
- <QueryTable
|
189
|
|
- rowKey="recommendCustomer"
|
190
|
|
- api={apis.customer.recommender}
|
191
|
|
- searchFields={searchFields}
|
192
|
|
- columns={columns}
|
193
|
|
- postData={data => {
|
194
|
|
- data.type='customer'
|
195
|
|
- return data;
|
196
|
|
- }}
|
197
|
|
- actionRender={actionRender}
|
198
|
|
- />
|
199
|
|
-
|
200
|
|
- </>
|
201
|
|
- );
|
202
|
|
-}
|
203
|
|
-
|
204
|
|
-export default Recommend
|
|
1
|
+import React, { useState } from 'react';
|
|
2
|
+import { Avatar, Button, message } from 'antd';
|
|
3
|
+import moment from 'moment';
|
|
4
|
+import request from '@/utils/request';
|
|
5
|
+import apis from '@/services/apis';
|
|
6
|
+import QueryTable from '@/components/QueryTable'
|
|
7
|
+import { router } from 'umi';
|
|
8
|
+import AuthButton from '@/components/AuthButton';
|
|
9
|
+import BuildingSelect from '@/components/SelectButton/BuildSelect';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+/**
|
|
14
|
+ *
|
|
15
|
+ *
|
|
16
|
+ * @param {*} props
|
|
17
|
+ * @returns
|
|
18
|
+ */
|
|
19
|
+function Recommend (props) {
|
|
20
|
+ const [exportLoding, setExportLoding] = useState(false)
|
|
21
|
+
|
|
22
|
+ function toAudit (cuurentId) {
|
|
23
|
+ router.push({
|
|
24
|
+ pathname: '/customer/recommend/customer/audit',
|
|
25
|
+ query: {
|
|
26
|
+ id: cuurentId,
|
|
27
|
+ },
|
|
28
|
+ })
|
|
29
|
+ }
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+ /**
|
|
33
|
+ *导出数据(推荐用户)
|
|
34
|
+ *
|
|
35
|
+ */
|
|
36
|
+ function exportRecommendCustomer () {
|
|
37
|
+ setExportLoding(true)
|
|
38
|
+ request({
|
|
39
|
+ ...apis.customer.customerRecommendRecommenderExport,
|
|
40
|
+ responseType: 'blob',
|
|
41
|
+ }).then(response => {
|
|
42
|
+ console.log('exportRecommendCustomer: ', response)
|
|
43
|
+ download(response)
|
|
44
|
+ }).catch(error => {
|
|
45
|
+
|
|
46
|
+ })
|
|
47
|
+ }
|
|
48
|
+
|
|
49
|
+ function download (data) {
|
|
50
|
+ if (!data) {
|
|
51
|
+ return
|
|
52
|
+ }
|
|
53
|
+ const url = window.URL.createObjectURL(new Blob([data]))
|
|
54
|
+ const link = document.createElement('a')
|
|
55
|
+ link.style.display = 'none'
|
|
56
|
+ link.href = url
|
|
57
|
+ link.setAttribute('download', '推荐客户.xlsx')
|
|
58
|
+ document.body.append(link)
|
|
59
|
+ link.click()
|
|
60
|
+ setExportLoding(false)
|
|
61
|
+ }
|
|
62
|
+
|
|
63
|
+ const columns = [
|
|
64
|
+ // {
|
|
65
|
+ // title: '头像',
|
|
66
|
+ // dataIndex: 'picture',
|
|
67
|
+ // key: 'picture',
|
|
68
|
+ // render: (_, record) => <Avatar shape="square" src={record.picture} size={64} icon="user" />,
|
|
69
|
+ // },
|
|
70
|
+ {
|
|
71
|
+ title: '姓名',
|
|
72
|
+ dataIndex: 'name',
|
|
73
|
+ key: 'name',
|
|
74
|
+ },
|
|
75
|
+ {
|
|
76
|
+ title: '电话',
|
|
77
|
+ dataIndex: 'phone',
|
|
78
|
+ key: 'phone',
|
|
79
|
+ },
|
|
80
|
+ {
|
|
81
|
+ title: '性别',
|
|
82
|
+ dataIndex: 'sex',
|
|
83
|
+ key: 'sex',
|
|
84
|
+ // eslint-disable-next-line no-nested-ternary
|
|
85
|
+ render: (_, record) => <><span>{record.sex === 1 ? '男' : record.sex === 2 ? '女' : '未知'}</span></>,
|
|
86
|
+ },
|
|
87
|
+ {
|
|
88
|
+ title: '意向项目',
|
|
89
|
+ dataIndex: 'buildingName',
|
|
90
|
+ key: 'buildingName',
|
|
91
|
+ },
|
|
92
|
+ {
|
|
93
|
+ title: '推荐人',
|
|
94
|
+ dataIndex: 'recommendPersonName',
|
|
95
|
+ key: 'recommendPersonName',
|
|
96
|
+ render: (_, record) => {
|
|
97
|
+ const phone = record.recommendPhone ? ` ${record.recommendPhone}` : ''
|
|
98
|
+ return <span>{`${record.recommendPersonName}${phone}`}</span>
|
|
99
|
+ },
|
|
100
|
+ },
|
|
101
|
+ {
|
|
102
|
+ title: '推荐时间',
|
|
103
|
+ dataIndex: 'createDate',
|
|
104
|
+ key: 'createDate',
|
|
105
|
+ render: (_, record) => <><span>{record.createDate && moment(record.createDate).format('YYYY-MM-DD')}</span></>,
|
|
106
|
+ },
|
|
107
|
+ {
|
|
108
|
+ title: '状态',
|
|
109
|
+ dataIndex: 'status',
|
|
110
|
+ key: 'status',
|
|
111
|
+ render: (_, record) => <><span>{record.status === '1' ? '未到访' : record.status === '2' ? '已到访' : record.status === '3' ? '无效' : ''}</span></>,
|
|
112
|
+ },
|
|
113
|
+ {
|
|
114
|
+ title: '操作',
|
|
115
|
+ dataIndex: 'customerId',
|
|
116
|
+ key: 'customerId',
|
|
117
|
+ render: (_, record) => (
|
|
118
|
+ <>{record.status === '1' ? (
|
|
119
|
+ <AuthButton name="customer.channel.verify">
|
|
120
|
+ <Button type='link' onClick={() => toAudit(record.channelCustomerId)}>审核</Button>
|
|
121
|
+ </AuthButton>
|
|
122
|
+ ) : (
|
|
123
|
+ <Button type='link' onClick={() => toAudit(record.channelCustomerId)}>查看详情</Button>
|
|
124
|
+ )
|
|
125
|
+
|
|
126
|
+ }
|
|
127
|
+ {/* {
|
|
128
|
+ <AuthButton name="admin.customer.recommend.verify.id.put" noRight={null}>
|
|
129
|
+ {record.verifyStatus === 0 ? <span style={{ color: 'rgba(239,39,58,1)', cursor: 'pointer' }} onClick={() => toAudit(record.customerId)}>审核</span> : ''}
|
|
130
|
+ </AuthButton>
|
|
131
|
+ } */}
|
|
132
|
+ </>
|
|
133
|
+ ),
|
|
134
|
+ },
|
|
135
|
+ ]
|
|
136
|
+
|
|
137
|
+ const searchFields = [
|
|
138
|
+ {
|
|
139
|
+ name: 'buildingId',
|
|
140
|
+ label: '项目',
|
|
141
|
+ placeholder: '项目',
|
|
142
|
+ render: () => <BuildingSelect style={{ width: 160 }} />
|
|
143
|
+ },
|
|
144
|
+ {
|
|
145
|
+ name: 'name',
|
|
146
|
+ label: '姓名',
|
|
147
|
+ placeholder: '请输入姓名',
|
|
148
|
+ },
|
|
149
|
+ {
|
|
150
|
+ name: 'phone',
|
|
151
|
+ label: '电话',
|
|
152
|
+ placeholder: '请输入电话',
|
|
153
|
+ },
|
|
154
|
+ {
|
|
155
|
+ name: 'recommendPersonName',
|
|
156
|
+ label: '推荐人',
|
|
157
|
+ placeholder: '请输入推荐人姓名',
|
|
158
|
+ },
|
|
159
|
+ {
|
|
160
|
+ name: 'recommendPhone',
|
|
161
|
+ label: '推荐人电话',
|
|
162
|
+ placeholder: '请输入推荐人电话电话',
|
|
163
|
+ },
|
|
164
|
+ {
|
|
165
|
+ name: 'status',
|
|
166
|
+ label: '状态',
|
|
167
|
+ placeholder: '请选择状态',
|
|
168
|
+ type: 'select',
|
|
169
|
+ options: [
|
|
170
|
+ { label: '未到访', value: '1' },
|
|
171
|
+ { label: '已到访', value: '2' },
|
|
172
|
+ { label: '无效', value: '3' }
|
|
173
|
+ ]
|
|
174
|
+ },
|
|
175
|
+ ]
|
|
176
|
+
|
|
177
|
+ const actionRender = () => {
|
|
178
|
+
|
|
179
|
+ return (
|
|
180
|
+ <Button type="danger" loading={exportLoding} onClick={() => exportRecommendCustomer()}>
|
|
181
|
+ 导出
|
|
182
|
+ </Button>
|
|
183
|
+ );
|
|
184
|
+ };
|
|
185
|
+
|
|
186
|
+ return (
|
|
187
|
+ <>
|
|
188
|
+ <QueryTable
|
|
189
|
+ rowKey="recommendCustomer"
|
|
190
|
+ api={apis.customer.recommender}
|
|
191
|
+ searchFields={searchFields}
|
|
192
|
+ columns={columns}
|
|
193
|
+ postData={data => {
|
|
194
|
+ data.type = 'customer'
|
|
195
|
+ return data;
|
|
196
|
+ }}
|
|
197
|
+ actionRender={actionRender}
|
|
198
|
+ />
|
|
199
|
+
|
|
200
|
+ </>
|
|
201
|
+ );
|
|
202
|
+}
|
|
203
|
+
|
|
204
|
+export default Recommend
|