|
@@ -1,786 +0,0 @@
|
1
|
|
-import React, { useState, useEffect } from 'react';
|
2
|
|
-import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions, message } from 'antd';
|
3
|
|
-import moment from 'moment';
|
4
|
|
-import request from '../../../utils/request';
|
5
|
|
-import apis from '../../../services/apis';
|
6
|
|
-import Styles from './style.less';
|
7
|
|
-import router from 'umi/router';
|
8
|
|
-import withActions from '@/components/ActionList';
|
9
|
|
-import Attribution from './components/attribution'
|
10
|
|
-import AssistConsultant from './components/assistConsultant'
|
11
|
|
-import BatchAssistConsultant from './components/BatchAssistConsultant'
|
12
|
|
-import IntegralRecord from './components/integralRecord'
|
13
|
|
-import ModalRecommendRecord from './components/recommend'
|
14
|
|
-import ChangeStatus from './components/changeStatus'
|
15
|
|
-import BuildSelect from '../../../components/SelectButton/BuildSelect'
|
16
|
|
-import AuthButton from '@/components/AuthButton';
|
17
|
|
-import Navigate from '@/components/Navigate';
|
18
|
|
-import WxDictSelect from '@/components/SelectButton/WxDictSelect';
|
19
|
|
-import Prompt from 'umi/prompt';
|
20
|
|
-import EditIcon from '@/components/EditIcon';
|
21
|
|
-
|
22
|
|
-
|
23
|
|
-const { Option } = Select;
|
24
|
|
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
25
|
|
-const { Meta } = Card;
|
26
|
|
-
|
27
|
|
-/**
|
28
|
|
- *
|
29
|
|
- *
|
30
|
|
- * @param {*} props
|
31
|
|
- * @returns
|
32
|
|
- */
|
33
|
|
-function body(props) {
|
34
|
|
- const { getFieldDecorator, getFieldsValue } = props.form
|
35
|
|
-
|
36
|
|
- // eslint-disable-next-line react-hooks/rules-of-hooks
|
37
|
|
- const [dataSource, setDataSource] = useState({ records: [] })
|
38
|
|
- // eslint-disable-next-line react-hooks/rules-of-hooks
|
39
|
|
- const [dataPub, setDataPub] = useState({ records: [] })
|
40
|
|
- // 默认私客
|
41
|
|
- // eslint-disable-next-line react-hooks/rules-of-hooks
|
42
|
|
- const [customerType, setCustomerType] = useState('private')
|
43
|
|
-
|
44
|
|
- // 调整归属 ============ start
|
45
|
|
- // eslint-disable-next-line react-hooks/rules-of-hooks
|
46
|
|
- const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
47
|
|
- // 调整归属 ============= end
|
48
|
|
-
|
49
|
|
- // 积分记录 ============ start
|
50
|
|
- // eslint-disable-next-line react-hooks/rules-of-hooks
|
51
|
|
- const [recordVisibleData, setRecordVisibleData] = useState({ visible: false, customerId: '' })
|
52
|
|
- // 积分记录 ============= end
|
53
|
|
-
|
54
|
|
- // 变更状态 ============ start
|
55
|
|
- // eslint-disable-next-line react-hooks/rules-of-hooks
|
56
|
|
- const [statusVisibleData, setStatusVisibleData] = useState({ visible: false, customerId: '', status: '' })
|
57
|
|
- // 变更状态 ============= end
|
58
|
|
-
|
59
|
|
- // 推荐客户
|
60
|
|
- const [recommendVisibleData, setRecommendVisibleData] = useState({ visible: false, customerId: '' })
|
61
|
|
-
|
62
|
|
- const [assistVisibleData, setAssistVisibleData] = useState({ visible: false, customerId: '', buildingId: '' })
|
63
|
|
-
|
64
|
|
- const [loadingStatus, setLoadingStatus] = useState(false)
|
65
|
|
-
|
66
|
|
- // 选中的公客信息
|
67
|
|
- const [personInfo, setPersonInfo] = useState([])
|
68
|
|
-
|
69
|
|
- const [batchAssistVisibleData, setBatchAssistVisibleData] = useState({ visible: false, customerId: [], buildingId: '' })
|
70
|
|
-
|
71
|
|
- const [currentSelectedRows, setSelectedRows] = useState([])
|
72
|
|
-
|
73
|
|
- const [selectedRowKeys, setSelectedRowKeys] = useState([])
|
74
|
|
-
|
75
|
|
- // eslint-disable-next-line react-hooks/rules-of-hooks
|
76
|
|
- useEffect(() => {
|
77
|
|
- // localStorage.setItem("state", JSON.stringify({ value }))
|
78
|
|
- if (localStorage.getItem("state")) {
|
79
|
|
- console.log(localStorage.getItem("state"), 'state')
|
80
|
|
- if (JSON.parse(localStorage.getItem("state")) == 'private') {
|
81
|
|
- const localStorageValue = JSON.parse(localStorage.getItem('priPageParams'))
|
82
|
|
- localStorageValue.startCreateDate = localStorageDate(localStorageValue.startCreateDate)
|
83
|
|
- localStorageValue.endCreateDate = localStorageDate(localStorageValue.endCreateDate)
|
84
|
|
- props.form.setFieldsValue(localStorageValue);
|
85
|
|
- getList({ pageNumber: 1, pageSize: 10, ...JSON.parse(localStorage.getItem("priPageParams")) })
|
86
|
|
- } else {
|
87
|
|
- setCustomerType('public')
|
88
|
|
- const localStorageValue = JSON.parse(localStorage.getItem("pubPageParams"))
|
89
|
|
- localStorageValue.startCreateDate = localStorageDate(localStorageValue.startCreateDate)
|
90
|
|
- localStorageValue.endCreateDate = localStorageDate(localStorageValue.endCreateDate)
|
91
|
|
- props.form.setFieldsValue(localStorageValue);
|
92
|
|
- getList({ pageNumber: 1, pageSize: 10, ...JSON.parse(localStorage.getItem("pubPageParams")) })
|
93
|
|
- }
|
94
|
|
-
|
95
|
|
- } else {
|
96
|
|
- localStorage.setItem("priPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType }))
|
97
|
|
- getList({ pageNumber: 1, pageSize: 10, customerType })
|
98
|
|
- }
|
99
|
|
- }, [])
|
100
|
|
-
|
101
|
|
- function getList(params) {
|
102
|
|
- // 网路请求
|
103
|
|
- if (params.startCreateDate) {
|
104
|
|
- params.startCreateDate = moment(params.startCreateDate).format('YYYY-MM-DD HH:mm:ss');
|
105
|
|
- }
|
106
|
|
- if (params.endCreateDate) {
|
107
|
|
- params.endCreateDate = moment(params.endCreateDate).format('YYYY-MM-DD HH:mm:ss');
|
108
|
|
- }
|
109
|
|
- request({ ...apis.customer.customerRecommend, params: { ...params } }).then(res => {
|
110
|
|
- if (params.customerType === 'private') {
|
111
|
|
- setDataSource(res)
|
112
|
|
- } else {
|
113
|
|
- setDataPub(res)
|
114
|
|
- }
|
115
|
|
- }).catch(err => {
|
116
|
|
- // eslint-disable-next-line no-unused-expressions
|
117
|
|
- <Alert
|
118
|
|
- style={{
|
119
|
|
- marginBottom: 24,
|
120
|
|
- }}
|
121
|
|
- message={err}
|
122
|
|
- type="error"
|
123
|
|
- showIcon
|
124
|
|
- />
|
125
|
|
- })
|
126
|
|
- }
|
127
|
|
-
|
128
|
|
- function displayNone() {
|
129
|
|
- setRecordVisibleData({ visible: false, customerId: '' })
|
130
|
|
- setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
|
131
|
|
- setStatusVisibleData({ visible: false, customerId: '', status: '' })
|
132
|
|
- setRecommendVisibleData({ visible: false, customerId: '' })
|
133
|
|
- }
|
134
|
|
-
|
135
|
|
- // 提交事件
|
136
|
|
- function handleSubmit(e) {
|
137
|
|
- displayNone()
|
138
|
|
-
|
139
|
|
- setPersonInfo([])
|
140
|
|
- setSelectedRowKeys([])
|
141
|
|
-
|
142
|
|
- e.preventDefault();
|
143
|
|
- props.form.validateFields((err, values) => {
|
144
|
|
- if (!err) {
|
145
|
|
- if (values.startCreateDate) {
|
146
|
|
- values.startCreateDate = moment(values.startCreateDate).format('YYYY-MM-DD HH:mm:ss');
|
147
|
|
- }
|
148
|
|
- if (values.endCreateDate) {
|
149
|
|
- values.endCreateDate = moment(values.endCreateDate).format('YYYY-MM-DD HH:mm:ss');
|
150
|
|
- }
|
151
|
|
- if (customerType === 'private') {
|
152
|
|
- localStorage.setItem("priPageParams", JSON.stringify({ customerType: 'private', ...values }))
|
153
|
|
- getList(JSON.parse(localStorage.getItem("priPageParams")))
|
154
|
|
- } else {
|
155
|
|
- localStorage.setItem("pubPageParams", JSON.stringify({ customerType: 'public', ...values }))
|
156
|
|
- getList(JSON.parse(localStorage.getItem("pubPageParams")))
|
157
|
|
- }
|
158
|
|
- // getList({ pageNum: 1, pageSize: 10, customerType, ...values })
|
159
|
|
-
|
160
|
|
-
|
161
|
|
- }
|
162
|
|
- });
|
163
|
|
- }
|
164
|
|
-
|
165
|
|
- // Change 事件
|
166
|
|
- function handleSelectChange(e) {
|
167
|
|
- // eslint-disable-next-line no-console
|
168
|
|
- console.log(e)
|
169
|
|
- }
|
170
|
|
-
|
171
|
|
- const localStorageDate = (date) => date ? moment(date) : ''
|
172
|
|
-
|
173
|
|
- // 分页
|
174
|
|
- function onChange(pageNum) {
|
175
|
|
- // eslint-disable-next-line react-hooks/rules-of-hooks
|
176
|
|
- props.form.validateFields((err, values) => {
|
177
|
|
- if (!err) {
|
178
|
|
- localStorage.setItem("state", JSON.stringify(customerType))
|
179
|
|
- if (customerType === 'private') {
|
180
|
|
- localStorage.setItem("priPageParams", JSON.stringify({ pageNumber: pageNum, pageSize: 10, customerType: 'private', ...props.form.getFieldsValue() }))
|
181
|
|
- getList(JSON.parse(localStorage.getItem("priPageParams")))
|
182
|
|
- } else {
|
183
|
|
- localStorage.setItem("pubPageParams", JSON.stringify({ pageNumber: pageNum, pageSize: 10, customerType: 'public', ...props.form.getFieldsValue() }))
|
184
|
|
- getList(JSON.parse(localStorage.getItem("pubPageParams")))
|
185
|
|
- }
|
186
|
|
-
|
187
|
|
-
|
188
|
|
- }
|
189
|
|
- });
|
190
|
|
- }
|
191
|
|
-
|
192
|
|
- // 私客/公客切换
|
193
|
|
- function radioButtonHandleSizeChange(e) {
|
194
|
|
-
|
195
|
|
- displayNone()
|
196
|
|
-
|
197
|
|
- props.form.resetFields();
|
198
|
|
- const { value } = e.target
|
199
|
|
- setCustomerType(value)
|
200
|
|
- localStorage.setItem("state", JSON.stringify(value))
|
201
|
|
- if (value === 'private') {
|
202
|
|
- if (localStorage.getItem("priPageParams")) {
|
203
|
|
- const localStorageValue = JSON.parse(localStorage.getItem("priPageParams"))
|
204
|
|
- localStorageValue.startCreateDate = localStorageDate(localStorageValue.startCreateDate)
|
205
|
|
- localStorageValue.endCreateDate = localStorageDate(localStorageValue.endCreateDate)
|
206
|
|
- props.form.setFieldsValue(localStorageValue);
|
207
|
|
- getList(JSON.parse(localStorage.getItem("priPageParams")))
|
208
|
|
- } else {
|
209
|
|
- localStorage.setItem("priPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType: value }))
|
210
|
|
- getList({ pageNumber: 1, pageSize: 10, customerType: value })
|
211
|
|
- }
|
212
|
|
-
|
213
|
|
- } else {
|
214
|
|
-
|
215
|
|
- if (localStorage.getItem("pubPageParams")) {
|
216
|
|
- const localStorageValue = JSON.parse(localStorage.getItem("pubPageParams"))
|
217
|
|
- localStorageValue.startCreateDate = localStorageDate(localStorageValue.startCreateDate)
|
218
|
|
- localStorageValue.endCreateDate = localStorageDate(localStorageValue.endCreateDate)
|
219
|
|
- props.form.setFieldsValue(localStorageValue);
|
220
|
|
-
|
221
|
|
- getList({ pageNumber: 1, pageSize: 10, customerType, ...JSON.parse(localStorage.getItem("pubPageParams")) })
|
222
|
|
- } else {
|
223
|
|
- localStorage.setItem("pubPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType: 'public' }))
|
224
|
|
- getList({ pageNumber: 1, pageSize: 10, customerType: 'public' })
|
225
|
|
- }
|
226
|
|
- }
|
227
|
|
-
|
228
|
|
- //setColumns(value === 'private' ? privateColumns : publicColumns)
|
229
|
|
-
|
230
|
|
- }
|
231
|
|
-
|
232
|
|
- function handleReset() {
|
233
|
|
- props.form.resetFields();
|
234
|
|
- if (customerType === 'private') {
|
235
|
|
- localStorage.setItem("priPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType: 'private' }));
|
236
|
|
- getList(JSON.parse(localStorage.getItem("priPageParams")))
|
237
|
|
- } else {
|
238
|
|
- localStorage.setItem("pubPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType: 'public' }))
|
239
|
|
- getList(JSON.parse(localStorage.getItem("pubPageParams")))
|
240
|
|
- }
|
241
|
|
-
|
242
|
|
- }
|
243
|
|
-
|
244
|
|
-
|
245
|
|
- // 这里有个 Bug, 就是 Modal 弹框,会联动出现, 比如 我点击 调整归属的Model弹框, 那么 积分记录的Model弹框莫名其妙的也显示了
|
246
|
|
- // 所有这里临时解决方法是,弹出一个Modal对话框的时候,把其他的对话框给隐藏
|
247
|
|
-
|
248
|
|
- function showGM(record) {
|
249
|
|
- setGVisibleData({ visible: true, customerId: record.customerId, realtyConsultant: record.realtyConsultant, buildingId: record.buildingId })
|
250
|
|
- setRecordVisibleData({ visible: false, customerId: '' })
|
251
|
|
- setStatusVisibleData({ visible: false, customerId: '' })
|
252
|
|
- setRecommendVisibleData({ visible: false, customerId: '' })
|
253
|
|
- setBatchAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
|
254
|
|
- }
|
255
|
|
-
|
256
|
|
- function showRecord(record) {
|
257
|
|
- setRecordVisibleData({ visible: true, customerId: record.personId })
|
258
|
|
- setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
259
|
|
- setStatusVisibleData({ visible: false, customerId: '' })
|
260
|
|
- setRecommendVisibleData({ visible: false, customerId: '' })
|
261
|
|
- setBatchAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
|
262
|
|
- }
|
263
|
|
-
|
264
|
|
- function showStatus(record) {
|
265
|
|
- setRecordVisibleData({ visible: false, customerId: '' })
|
266
|
|
- setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
267
|
|
- setRecommendVisibleData({ visible: false, customerId: '' })
|
268
|
|
- setStatusVisibleData({ visible: true, customerId: record.customerId, status: record.status })
|
269
|
|
- setBatchAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
|
270
|
|
- }
|
271
|
|
-
|
272
|
|
- // 推荐客户
|
273
|
|
- function showRecommend(personId) {
|
274
|
|
- setRecordVisibleData({ visible: false, customerId: '' })
|
275
|
|
- setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
276
|
|
- setStatusVisibleData({ visible: false, customerId: '', status: '' })
|
277
|
|
- setRecommendVisibleData({ visible: true, customerId: personId })
|
278
|
|
- setBatchAssistVisibleData({ visible: false, customerId: '' })
|
279
|
|
- }
|
280
|
|
-
|
281
|
|
- //分配置业顾问
|
282
|
|
- function assistConsultant(personId, buildingId) {
|
283
|
|
- setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
284
|
|
- setRecordVisibleData({ visible: false, customerId: '' })
|
285
|
|
- setStatusVisibleData({ visible: false, customerId: '' })
|
286
|
|
- setRecommendVisibleData({ visible: false, customerId: '' })
|
287
|
|
- setAssistVisibleData({ visible: true, customerId: personId, buildingId: buildingId })
|
288
|
|
- setBatchAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
|
289
|
|
- }
|
290
|
|
-
|
291
|
|
- function batchAssistConsultant() {
|
292
|
|
- console.log(personInfo, 'personInfo')
|
293
|
|
- console.log(personInfo.length)
|
294
|
|
- if (personInfo.length <= 0) {
|
295
|
|
- return message.info('请至少选择一条数据');
|
296
|
|
- }
|
297
|
|
-
|
298
|
|
- const compareSet = new Set();
|
299
|
|
- personInfo.filter(record => {
|
300
|
|
- compareSet.add(record.buildingName)
|
301
|
|
- })
|
302
|
|
-
|
303
|
|
- if (compareSet.size != 1) {
|
304
|
|
- return message.info('选中的公客存在于不同项目中,请分开进行分配置业顾问操作');
|
305
|
|
- }
|
306
|
|
-
|
307
|
|
- // const newSelectedRows = personInfo.filter()
|
308
|
|
-
|
309
|
|
- // console.log(newSelectedRows,'newSelectedRows')
|
310
|
|
-
|
311
|
|
- setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
312
|
|
- setRecordVisibleData({ visible: false, customerId: '' })
|
313
|
|
- setStatusVisibleData({ visible: false, customerId: '' })
|
314
|
|
- setRecommendVisibleData({ visible: false, customerId: '' })
|
315
|
|
- setAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
|
316
|
|
- setBatchAssistVisibleData({ visible: true, customerId: personInfo, buildingId: personInfo[0].buildingId })
|
317
|
|
- }
|
318
|
|
-
|
319
|
|
- function toCustomerDateil(record) {
|
320
|
|
- router.push({
|
321
|
|
- pathname: '/customer/customerlist/customerDetail',
|
322
|
|
- query: {
|
323
|
|
- id: record.customerId,
|
324
|
|
- },
|
325
|
|
- });
|
326
|
|
- }
|
327
|
|
- // 私客详情
|
328
|
|
- function publicCustomerDetail(record) {
|
329
|
|
- router.push({
|
330
|
|
- pathname: '/customer/customerlist/publicCustomerDetail',
|
331
|
|
- query: {
|
332
|
|
- id: record.personId,
|
333
|
|
- },
|
334
|
|
- });
|
335
|
|
- }
|
336
|
|
-
|
337
|
|
- function exportCustomer() {
|
338
|
|
- setLoadingStatus(true)
|
339
|
|
- const fieldsValue = getFieldsValue()
|
340
|
|
- if (fieldsValue.startCreateDate) {
|
341
|
|
- fieldsValue.startCreateDate = moment(fieldsValue.startCreateDate).format('YYYY-MM-DD HH:mm:ss');
|
342
|
|
- }
|
343
|
|
- if (fieldsValue.endCreateDate) {
|
344
|
|
- fieldsValue.endCreateDate = moment(fieldsValue.endCreateDate).format('YYYY-MM-DD HH:mm:ss');
|
345
|
|
- }
|
346
|
|
- request({ ...apis.customer.customerRecommendExport, responseType: 'blob', params: { ...fieldsValue, customerType } })
|
347
|
|
- .then(response => {
|
348
|
|
- download(response)
|
349
|
|
- setLoadingStatus(false)
|
350
|
|
- }).catch(error => {
|
351
|
|
- message.err('连接超时');
|
352
|
|
- setLoadingStatus(false)
|
353
|
|
- })
|
354
|
|
- }
|
355
|
|
-
|
356
|
|
- function download(data) {
|
357
|
|
- if (!data) {
|
358
|
|
- return
|
359
|
|
- }
|
360
|
|
- const url = window.URL.createObjectURL(new Blob([data]))
|
361
|
|
- const link = document.createElement('a')
|
362
|
|
- link.style.display = 'none'
|
363
|
|
- link.href = url
|
364
|
|
- link.setAttribute('download', '客户列表.xlsx')
|
365
|
|
- document.body.append(link)
|
366
|
|
- link.click()
|
367
|
|
- }
|
368
|
|
-
|
369
|
|
- // 关闭调整归属的窗口
|
370
|
|
- function closeAttribution() {
|
371
|
|
- setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
372
|
|
- if (customerType === 'private') {
|
373
|
|
- getList(JSON.parse(localStorage.getItem('priPageParams')))
|
374
|
|
- } else {
|
375
|
|
- getList(JSON.parse(localStorage.getItem('pubPageParams')))
|
376
|
|
- }
|
377
|
|
- }
|
378
|
|
- // 回调关闭所有弹框
|
379
|
|
- function closeAll() {
|
380
|
|
- setRecordVisibleData({ visible: false, customerId: '' })
|
381
|
|
- setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
382
|
|
- setStatusVisibleData({ visible: false, customerId: '', status: '' })
|
383
|
|
- setRecommendVisibleData({ visible: false, customerId: '' })
|
384
|
|
- setAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
|
385
|
|
- setBatchAssistVisibleData({ visible: false, customerId: '' })
|
386
|
|
- if (customerType === 'private') {
|
387
|
|
-
|
388
|
|
- getList(JSON.parse(localStorage.getItem("priPageParams")))
|
389
|
|
- } else {
|
390
|
|
-
|
391
|
|
- getList(JSON.parse(localStorage.getItem("pubPageParams")))
|
392
|
|
- }
|
393
|
|
- // getList({ pageNum: 1, pageSize: 10, customerType, ...props.form.getFieldsValue() })
|
394
|
|
- }
|
395
|
|
-
|
396
|
|
- const rowSelection = {
|
397
|
|
- selectedRowKeys,
|
398
|
|
- onChange: (selectedRowKeys, selectedRows) => {
|
399
|
|
- console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
|
400
|
|
- setSelectedRowKeys(selectedRowKeys)
|
401
|
|
- const newSelectedRows = personInfo.filter(x => !selectedRows.some(y => x.customerId === y.customerId)) // 去重
|
402
|
|
- .concat(selectedRows) // 新增选择
|
403
|
|
- .filter(x => selectedRowKeys.some(y => y === x.customerId)) // 去掉未选的数据
|
404
|
|
-
|
405
|
|
- // setSelectedRows(newSelectedRows)
|
406
|
|
- console.log(newSelectedRows, "33333333333333333333")
|
407
|
|
- setPersonInfo(newSelectedRows)
|
408
|
|
- },
|
409
|
|
- };
|
410
|
|
-
|
411
|
|
- const publicColumns = [
|
412
|
|
- {
|
413
|
|
- title: '头像',
|
414
|
|
- dataIndex: 'picture',
|
415
|
|
- key: 'picture',
|
416
|
|
- align: 'center',
|
417
|
|
- width: '10%',
|
418
|
|
- // render: (_, record) => <Avatar shape="square" style={{ color: 'blue', cursor: 'pointer' }} onClick={() => publicCustomerDetail(record)} src={customerType === 'private' ? record.picture : record.avatarurl} size={64} icon="user" />,
|
419
|
|
- render: (_, record) => <Avatar shape="square" style={{ color: 'blue', cursor: 'pointer' }} onClick={() => publicCustomerDetail(record)} src={record.picture} size={64} icon="user" />,
|
420
|
|
- },
|
421
|
|
- {
|
422
|
|
- title: '姓名',
|
423
|
|
- dataIndex: 'name',
|
424
|
|
- key: 'name',
|
425
|
|
- align: 'center',
|
426
|
|
- width: '10%',
|
427
|
|
- // eslint-disable-next-line no-nested-ternary
|
428
|
|
- render: (_, record) => <><Navigate onClick={() => publicCustomerDetail(record)}>{record.name || record.nickname}</Navigate></>,
|
429
|
|
- },
|
430
|
|
- {
|
431
|
|
- title: '电话',
|
432
|
|
- dataIndex: 'phone',
|
433
|
|
- key: 'phone',
|
434
|
|
- align: 'center',
|
435
|
|
- width: '15%',
|
436
|
|
- },
|
437
|
|
- {
|
438
|
|
- title: '是否归属项目',
|
439
|
|
- dataIndex: '',
|
440
|
|
- key: '',
|
441
|
|
- align: 'center',
|
442
|
|
- width: '10%',
|
443
|
|
- render: (_, record) => <><span>{record.buildingId != null ? '是' : '否'}</span></>,
|
444
|
|
- },
|
445
|
|
- {
|
446
|
|
- title: '归属项目',
|
447
|
|
- dataIndex: 'buildingName',
|
448
|
|
- key: 'buildingName',
|
449
|
|
- align: 'center',
|
450
|
|
- width: '15%',
|
451
|
|
- },
|
452
|
|
- {
|
453
|
|
- title: '推广人员',
|
454
|
|
- dataIndex: 'sharePersonName',
|
455
|
|
- key: 'sharePersonName',
|
456
|
|
- align: 'center',
|
457
|
|
- width: '10%',
|
458
|
|
- },
|
459
|
|
- {
|
460
|
|
- title: '性别',
|
461
|
|
- dataIndex: 'sex',
|
462
|
|
- key: 'sex',
|
463
|
|
- align: 'center',
|
464
|
|
- width: '10%',
|
465
|
|
- // eslint-disable-next-line no-nested-ternary
|
466
|
|
- render: (_, record) => <><span>{record.sex === 1 ? '男' : record.sex === 2 ? '女' : '未知'}</span></>,
|
467
|
|
- },
|
468
|
|
- {
|
469
|
|
- title: '操作',
|
470
|
|
- dataIndex: 'customerId',
|
471
|
|
- key: 'customerId',
|
472
|
|
- align: 'center',
|
473
|
|
- width: '20%',
|
474
|
|
- render: withActions((text, record) => [
|
475
|
|
- <EditIcon color="#FF4A4A" text="查看详情" onClick={() => publicCustomerDetail(record)} />,
|
476
|
|
- <AuthButton name="admin.customer.recommend" noRight={null}>
|
477
|
|
- <Button className={customerType === 'private' ? Styles.displayS : Styles.text} type="link" onClick={() => showRecommend(record.personId)}>推荐客户</Button>
|
478
|
|
- </AuthButton>,
|
479
|
|
- <AuthButton name="admin.customer.assign" noRight={null}>
|
480
|
|
- <Button className={customerType === 'private' ? Styles.displayS : Styles.text} type="link" onClick={() => assistConsultant(record.customerId, record.buildingId)}>分配置业顾问</Button>
|
481
|
|
- </AuthButton>,
|
482
|
|
- <AuthButton name="admin.mine.taPointsRecords.point.record" noRight={null}>
|
483
|
|
- <Button className={Styles.text} type="link" onClick={() => showRecord(record)}>积分记录</Button>
|
484
|
|
- </AuthButton>
|
485
|
|
- ]),
|
486
|
|
- // render: (_, record) => (
|
487
|
|
- // <>
|
488
|
|
- // {/* <AuthButton name="admin.customer.public.detail" noRight={null}>
|
489
|
|
- // <Button className={customerType === 'private' ? Styles.displayS : Styles.text } type="link" onClick={() => publicCustomerDetail(record)}>查看详情</Button>
|
490
|
|
- // </AuthButton>
|
491
|
|
- // */}
|
492
|
|
- // <AuthButton name="admin.customer.recommend" noRight={null}>
|
493
|
|
- // <Button className={customerType === 'private' ? Styles.displayS : Styles.text} type="link" onClick={() => showRecommend(record.personId)}>推荐客户</Button>
|
494
|
|
- // </AuthButton>
|
495
|
|
- // <AuthButton name="admin.customer.assign" noRight={null}>
|
496
|
|
- // <Button className={customerType === 'private' ? Styles.displayS : Styles.text} type="link" onClick={() => assistConsultant(record.customerId, record.buildingId)}>分配置业顾问</Button>
|
497
|
|
- // </AuthButton>
|
498
|
|
- // <AuthButton name="admin.mine.taPointsRecords.point.record" noRight={null}>
|
499
|
|
- // <Button className={Styles.text} type="link" onClick={() => showRecord(record)}>积分记录</Button>
|
500
|
|
- // </AuthButton>
|
501
|
|
- // </>
|
502
|
|
- // ),
|
503
|
|
- },
|
504
|
|
- ]
|
505
|
|
-
|
506
|
|
- const privateColumns = [
|
507
|
|
- {
|
508
|
|
- title: '头像',
|
509
|
|
- dataIndex: 'picture',
|
510
|
|
- key: 'picture',
|
511
|
|
- align: 'center',
|
512
|
|
- width: '10%',
|
513
|
|
- render: (_, record) => <Avatar shape="square" style={{ color: 'blue', cursor: 'pointer' }} onClick={() => toCustomerDateil(record)} src={customerType === 'private' ? record.picture : record.avatarurl} size={64} icon="user" />,
|
514
|
|
- },
|
515
|
|
- {
|
516
|
|
- title: '姓名',
|
517
|
|
- dataIndex: 'name',
|
518
|
|
- key: 'name',
|
519
|
|
- align: 'center',
|
520
|
|
- width: '10%',
|
521
|
|
- // eslint-disable-next-line no-nested-ternary
|
522
|
|
- render: (_, record) => <><Navigate onClick={() => toCustomerDateil(record)}>{customerType === 'private' ? record.name : record.nickname}</Navigate></>,
|
523
|
|
- },
|
524
|
|
- {
|
525
|
|
- title: '电话',
|
526
|
|
- dataIndex: 'phone',
|
527
|
|
- key: 'phone',
|
528
|
|
- align: 'center',
|
529
|
|
- width: '10%',
|
530
|
|
- },
|
531
|
|
- {
|
532
|
|
- title: '性别',
|
533
|
|
- dataIndex: 'sex',
|
534
|
|
- key: 'sex',
|
535
|
|
- align: 'center',
|
536
|
|
- width: '10%',
|
537
|
|
- // eslint-disable-next-line no-nested-ternary
|
538
|
|
- render: (_, record) => <><span>{record.sex === 1 ? '男' : record.sex === 2 ? '女' : '未知'}</span></>,
|
539
|
|
- },
|
540
|
|
- {
|
541
|
|
- title: '置业顾问',
|
542
|
|
- dataIndex: 'consultantName',
|
543
|
|
- key: 'consultantName',
|
544
|
|
- align: 'center',
|
545
|
|
- width: '10%',
|
546
|
|
- // eslint-disable-next-line no-nested-ternary
|
547
|
|
- render: (_, record) => (
|
548
|
|
- <>
|
549
|
|
- <span>{record.consultantName}</span>
|
550
|
|
- <br />
|
551
|
|
- <span>{record.consultTel}</span>
|
552
|
|
- </>
|
553
|
|
- ),
|
554
|
|
- },
|
555
|
|
- {
|
556
|
|
- title: '归属项目',
|
557
|
|
- dataIndex: 'buildingName',
|
558
|
|
- key: 'buildingName',
|
559
|
|
- align: 'center',
|
560
|
|
- width: '10%',
|
561
|
|
- },
|
562
|
|
- {
|
563
|
|
- title: '推广人员',
|
564
|
|
- dataIndex: 'sharePersonName',
|
565
|
|
- key: 'sharePersonName',
|
566
|
|
- align: 'center',
|
567
|
|
- width: '10%',
|
568
|
|
- },
|
569
|
|
- {
|
570
|
|
- title: '客户状态',
|
571
|
|
- dataIndex: 'reportRecommendStatus',
|
572
|
|
- key: 'reportRecommendStatus',
|
573
|
|
- align: 'center',
|
574
|
|
- width: '10%',
|
575
|
|
- // eslint-disable-next-line no-nested-ternary
|
576
|
|
- render: (text, records) => {
|
577
|
|
- if (records.status === 1) { return '报备' }
|
578
|
|
- if (records.status === 2) { return '到访' }
|
579
|
|
- if (records.status === 3) { return '认购' }
|
580
|
|
- if (records.status === 4) { return '签约' }
|
581
|
|
- },
|
582
|
|
- },
|
583
|
|
- {
|
584
|
|
- title: '操作',
|
585
|
|
- dataIndex: 'customerId',
|
586
|
|
- key: 'customerId',
|
587
|
|
- align: 'center',
|
588
|
|
- width: '20%',
|
589
|
|
- render: withActions((text, record) => [
|
590
|
|
- <EditIcon color="#FF4A4A" text="查看详情" onClick={() => toCustomerDateil(record)} />,
|
591
|
|
- <AuthButton name="admin.customer.recommend.edit.id.put" noRight={null}>
|
592
|
|
- <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showStatus(record)}>变更状态</Button>
|
593
|
|
- </AuthButton>,
|
594
|
|
-
|
595
|
|
- <AuthButton name="admin.customer.recommend.belong" noRight={null}>
|
596
|
|
- <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showGM(record)}>调整归属</Button>
|
597
|
|
- </AuthButton>,
|
598
|
|
-
|
599
|
|
- <AuthButton name="admin.mine.taPointsRecords.point.record" noRight={null}>
|
600
|
|
- <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showRecord(record)}>积分记录</Button>
|
601
|
|
- </AuthButton>,
|
602
|
|
-
|
603
|
|
- <AuthButton name="admin.mine.taPointsRecords.id.get" noRight={null}>
|
604
|
|
- <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showRecommend(record.personId)}>推荐客户</Button>
|
605
|
|
- </AuthButton>
|
606
|
|
- ]),
|
607
|
|
- // render: (_, record) => (
|
608
|
|
- // <>
|
609
|
|
- // <AuthButton name="admin.customer.recommend.edit.id.put" noRight={null}>
|
610
|
|
- // <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showStatus(record)}>变更状态</Button>
|
611
|
|
- // </AuthButton>
|
612
|
|
- // <AuthButton name="admin.customer.recommend.belong" noRight={null}>
|
613
|
|
- // <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showGM(record)}>调整归属</Button>
|
614
|
|
- // </AuthButton>
|
615
|
|
-
|
616
|
|
- // {/* <AuthButton name="admin.customer.recommend.get" noRight={null}>
|
617
|
|
- // <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => toCustomerDateil(record)}>查看详情</Button>
|
618
|
|
- // </AuthButton>
|
619
|
|
- // */}
|
620
|
|
- // <AuthButton name="admin.mine.taPointsRecords.point.record" noRight={null}>
|
621
|
|
- // <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showRecord(record)}>积分记录</Button>
|
622
|
|
- // </AuthButton>
|
623
|
|
- // <AuthButton name="admin.mine.taPointsRecords.id.get" noRight={null}>
|
624
|
|
- // <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showRecommend(record.personId)}>推荐客户</Button>
|
625
|
|
- // </AuthButton>
|
626
|
|
-
|
627
|
|
- // </>
|
628
|
|
- // ),
|
629
|
|
- },
|
630
|
|
- ]
|
631
|
|
-
|
632
|
|
- return (
|
633
|
|
- <>
|
634
|
|
- <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
|
635
|
|
- {customerType === 'public' && <Form.Item>
|
636
|
|
- {getFieldDecorator('belongStatus')(
|
637
|
|
- <Select style={{ width: '180px' }} placeholder="是否归属项目" onChange={handleSelectChange}>
|
638
|
|
- <Option value={1}>是</Option>
|
639
|
|
- <Option value={0}>否</Option>
|
640
|
|
- </Select>,
|
641
|
|
- )}
|
642
|
|
- </Form.Item>}
|
643
|
|
- <Form.Item>
|
644
|
|
- {getFieldDecorator('buildingId')(
|
645
|
|
- <BuildSelect />,
|
646
|
|
- )}
|
647
|
|
- </Form.Item>
|
648
|
|
- {customerType === 'private' && <Form.Item>
|
649
|
|
- {getFieldDecorator('status')(
|
650
|
|
- <Select style={{ width: '180px' }} placeholder="状态" onChange={handleSelectChange}>
|
651
|
|
- <Option value={1}>报备</Option>
|
652
|
|
- <Option value={2}>到访</Option>
|
653
|
|
- <Option value={3}>认筹</Option>
|
654
|
|
- <Option value={4}>签约</Option>
|
655
|
|
- </Select>,
|
656
|
|
- )}
|
657
|
|
- </Form.Item>}
|
658
|
|
- <Form.Item>
|
659
|
|
- {getFieldDecorator('name')(
|
660
|
|
- <Input
|
661
|
|
- prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
662
|
|
- placeholder="姓名"
|
663
|
|
- />,
|
664
|
|
- )}
|
665
|
|
- </Form.Item>
|
666
|
|
- <Form.Item>
|
667
|
|
- {getFieldDecorator('tel')(
|
668
|
|
- <Input
|
669
|
|
- prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
670
|
|
- placeholder="电话"
|
671
|
|
- />,
|
672
|
|
- )}
|
673
|
|
- </Form.Item>
|
674
|
|
- {customerType === 'private' && <Form.Item>
|
675
|
|
- {getFieldDecorator('consultName')(
|
676
|
|
- <Input placeholder="置业顾问" />,
|
677
|
|
- )}
|
678
|
|
- </Form.Item>}
|
679
|
|
- {customerType === 'private' && <Form.Item>
|
680
|
|
- {getFieldDecorator('consultTel')(
|
681
|
|
- <Input placeholder="置业顾问电话" />,
|
682
|
|
- )}
|
683
|
|
- </Form.Item>}
|
684
|
|
- <Form.Item >
|
685
|
|
- {getFieldDecorator('startCreateDate')(
|
686
|
|
- <DatePicker placeholder="注册开始时间" format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }} />)}
|
687
|
|
- </Form.Item>
|
688
|
|
- <Form.Item >
|
689
|
|
- {getFieldDecorator('endCreateDate')(
|
690
|
|
- <DatePicker placeholder="注册结束时间" format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }} />)}
|
691
|
|
- </Form.Item>
|
692
|
|
- <Form.Item>
|
693
|
|
- {getFieldDecorator('sceneType')(
|
694
|
|
- <WxDictSelect />,
|
695
|
|
- )}
|
696
|
|
- </Form.Item>
|
697
|
|
- <Form.Item>
|
698
|
|
- {getFieldDecorator('sharePersonName')(
|
699
|
|
- <Input placeholder="推广人" />,
|
700
|
|
- )}
|
701
|
|
- </Form.Item>
|
702
|
|
- <Form.Item>
|
703
|
|
- <AuthButton name="admin.customer.recommend.search" noRight={null}>
|
704
|
|
- <Button type="primary" htmlType="submit" >
|
705
|
|
- 搜索
|
706
|
|
- </Button>
|
707
|
|
- </AuthButton>
|
708
|
|
- <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
709
|
|
- 重置
|
710
|
|
- </Button>
|
711
|
|
- </Form.Item>
|
712
|
|
- </Form>
|
713
|
|
- {
|
714
|
|
- customerType === 'private' ?
|
715
|
|
- <AuthButton name="admin.customer.import" noRight={null}>
|
716
|
|
- <Button type="primary" loading={loadingStatus} onClick={() => exportCustomer()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
|
717
|
|
- 导出
|
718
|
|
- </Button>
|
719
|
|
- </AuthButton> :
|
720
|
|
- <>
|
721
|
|
- <AuthButton name="admin.customer.import" noRight={null}>
|
722
|
|
- <Button type="primary" onClick={() => batchAssistConsultant()} style={{ float: 'right', margin: '20px 0', marginLeft: '20px', zIndex: 1 }}>
|
723
|
|
- 批量分配置业顾问
|
724
|
|
- </Button>
|
725
|
|
- </AuthButton>
|
726
|
|
- <AuthButton name="admin.customer.import" noRight={null}>
|
727
|
|
- <Button type="primary" loading={loadingStatus} onClick={() => exportCustomer()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
|
728
|
|
- 导出
|
729
|
|
- </Button>
|
730
|
|
- </AuthButton>
|
731
|
|
- </>
|
732
|
|
- }
|
733
|
|
-
|
734
|
|
-
|
735
|
|
- <div style={{ margin: '20px 0' }}>
|
736
|
|
- <Radio.Group value={customerType} onChange={radioButtonHandleSizeChange} buttonStyle="solid">
|
737
|
|
- <Radio.Button value="private">私客</Radio.Button>
|
738
|
|
- <Radio.Button value="public">公客</Radio.Button>
|
739
|
|
- </Radio.Group>
|
740
|
|
- </div>
|
741
|
|
- {customerType === 'private' ?
|
742
|
|
- <Table
|
743
|
|
- // onRow={record => {
|
744
|
|
- // return {
|
745
|
|
- // onClick: () => toCustomerDateil(record),
|
746
|
|
- // };
|
747
|
|
- // }}
|
748
|
|
- dataSource={dataSource.records} columns={privateColumns} pagination={{ current: dataSource.current, total: dataSource.total, pageSize: dataSource.size, onChange }} rowKey={r => r.customerId} /> :
|
749
|
|
- <Table rowSelection={rowSelection}
|
750
|
|
- // onRow={record => {
|
751
|
|
- // return {
|
752
|
|
- // onClick: () => publicCustomerDetail(record),
|
753
|
|
- // };
|
754
|
|
- // }}
|
755
|
|
- dataSource={dataPub.records} columns={publicColumns} pagination={{ current: dataPub.current, total: dataPub.total, pageSize: dataPub.size, onChange }} rowKey={r => r.customerId} ></Table>
|
756
|
|
- }
|
757
|
|
-
|
758
|
|
- {/* 调整归属 */}
|
759
|
|
- <Attribution visibleData={gVisibleData} onCancel={() => closeAttribution()} />
|
760
|
|
-
|
761
|
|
- {/* 积分记录 */}
|
762
|
|
- <IntegralRecord visibleData={recordVisibleData} onCancel={() => closeAll()} />
|
763
|
|
-
|
764
|
|
- {/* 变更状态 */}
|
765
|
|
- <ChangeStatus visibleData={statusVisibleData} onCancel={() => closeAll()} />
|
766
|
|
-
|
767
|
|
- {/* 推荐客户 */}
|
768
|
|
- <ModalRecommendRecord visibleData={recommendVisibleData} onCancel={() => closeAll()} />
|
769
|
|
-
|
770
|
|
- {/* 分配置业顾问 */}
|
771
|
|
- <AssistConsultant visibleData={assistVisibleData} onCancel={() => closeAll()} />
|
772
|
|
-
|
773
|
|
- {/* 批量分配置业顾问 */}
|
774
|
|
- <BatchAssistConsultant visibleData={batchAssistVisibleData} onCancel={() => closeAll()} />
|
775
|
|
-
|
776
|
|
- <Prompt message={location =>
|
777
|
|
- location.pathname.startsWith("/customer/customerlist")
|
778
|
|
- ? true
|
779
|
|
- : (localStorage.removeItem("priPageParams"), localStorage.removeItem("pubPageParams"), localStorage.removeItem("state"))} />
|
780
|
|
- </>
|
781
|
|
- );
|
782
|
|
-}
|
783
|
|
-
|
784
|
|
-const WrappedBody = Form.create({ name: 'body' })(body);
|
785
|
|
-
|
786
|
|
-export default WrappedBody
|