|
@@ -1,165 +1,211 @@
|
1
|
|
-import React, { useState, useEffect, useMemo, useRef } from 'react';
|
2
|
|
-import { Avatar } from 'antd';
|
3
|
|
-
|
|
1
|
+import React, { useState, useMemo, useRef } from 'react';
|
|
2
|
+import { Avatar, Button } from 'antd';
|
4
|
3
|
import QueryTable from '@/components/QueryTable';
|
5
|
|
-import request from '@/utils/request';
|
6
|
4
|
import apis from '@/services/apis';
|
7
|
|
-import Navigate from '@/components/Navigate';
|
8
|
|
-import getTableColumns from './tableColumns'
|
|
5
|
+import withActions from '@/components/ActionList';
|
|
6
|
+import AuthButton from '@/components/AuthButton';
|
|
7
|
+import Styles from '../style.less';
|
|
8
|
+import ChangeStatus from './components/ChangeStatus';
|
9
|
9
|
|
10
|
|
-function PrivateCustomer(props) {
|
11
|
|
- const ref = useRef()
|
12
|
|
- const [page, setPage] = useState({current: 1, pageSize: 10})
|
13
|
|
- const columns = [
|
14
|
|
- {
|
15
|
|
- title: '头像',
|
16
|
|
- dataIndex: 'picture',
|
17
|
|
- key: 'picture',
|
18
|
|
- align: 'center',
|
19
|
|
- width: '10%',
|
20
|
|
- render: (_, record) => (
|
21
|
|
- <Avatar
|
22
|
|
- shape="square"
|
23
|
|
- style={{ color: 'blue', cursor: 'pointer' }}
|
24
|
|
- onClick={() => toCustomerDateil(record)}
|
25
|
|
- src={record.picture}
|
26
|
|
- size={64}
|
27
|
|
- icon="user"
|
28
|
|
- />
|
29
|
|
- ),
|
30
|
|
- },
|
31
|
|
- {
|
32
|
|
- title: '姓名',
|
33
|
|
- dataIndex: 'name',
|
34
|
|
- key: 'name',
|
35
|
|
- align: 'center',
|
36
|
|
- width: '10%',
|
37
|
|
- // eslint-disable-next-line no-nested-ternary
|
38
|
|
- render: (_, record) => (
|
39
|
|
- <>
|
40
|
|
- <Navigate onClick={() => toCustomerDateil(record)}>{record.name}</Navigate>
|
41
|
|
- </>
|
42
|
|
- ),
|
43
|
|
- },
|
44
|
|
- {
|
45
|
|
- title: '电话',
|
46
|
|
- dataIndex: 'phone',
|
47
|
|
- key: 'phone',
|
48
|
|
- align: 'center',
|
49
|
|
- width: '10%',
|
50
|
|
- },
|
51
|
|
- {
|
52
|
|
- title: '性别',
|
53
|
|
- dataIndex: 'sex',
|
54
|
|
- key: 'sex',
|
55
|
|
- align: 'center',
|
56
|
|
- width: '10%',
|
57
|
|
- // eslint-disable-next-line no-nested-ternary
|
58
|
|
- render: (_, record) => (
|
59
|
|
- <>
|
60
|
|
- <span>{record.sex === 1 ? '男' : record.sex === 2 ? '女' : '未知'}</span>
|
61
|
|
- </>
|
62
|
|
- ),
|
63
|
|
- },
|
64
|
|
- {
|
65
|
|
- title: '置业顾问',
|
66
|
|
- dataIndex: 'consultantName',
|
67
|
|
- key: 'consultantName',
|
68
|
|
- align: 'center',
|
69
|
|
- width: '10%',
|
70
|
|
- // eslint-disable-next-line no-nested-ternary
|
71
|
|
- render: (_, record) => (
|
72
|
|
- <>
|
73
|
|
- <span>{record.consultantName}</span>
|
74
|
|
- <br />
|
75
|
|
- <span>{record.consultTel}</span>
|
76
|
|
- </>
|
77
|
|
- ),
|
78
|
|
- },
|
79
|
|
- {
|
80
|
|
- title: '归属项目',
|
81
|
|
- dataIndex: 'buildingName',
|
82
|
|
- key: 'buildingName',
|
83
|
|
- align: 'center',
|
84
|
|
- width: '10%',
|
85
|
|
- },
|
86
|
|
- {
|
87
|
|
- title: '推广人员',
|
88
|
|
- dataIndex: 'sharePersonName',
|
89
|
|
- key: 'sharePersonName',
|
90
|
|
- align: 'center',
|
91
|
|
- width: '10%',
|
92
|
|
- },
|
93
|
|
- {
|
94
|
|
- title: '客户状态',
|
95
|
|
- dataIndex: 'reportRecommendStatus',
|
96
|
|
- key: 'reportRecommendStatus',
|
97
|
|
- align: 'center',
|
98
|
|
- width: '10%',
|
99
|
|
- // eslint-disable-next-line no-nested-ternary
|
100
|
|
- render: (text, records) => {
|
101
|
|
- if (records.status === 1) {
|
102
|
|
- return '报备';
|
103
|
|
- }
|
104
|
|
- if (records.status === 2) {
|
105
|
|
- return '到访';
|
106
|
|
- }
|
107
|
|
- if (records.status === 3) {
|
108
|
|
- return '认购';
|
109
|
|
- }
|
110
|
|
- if (records.status === 4) {
|
111
|
|
- return '签约';
|
112
|
|
- }
|
113
|
|
- },
|
114
|
|
- },
|
115
|
|
- {
|
116
|
|
- title: '操作',
|
117
|
|
- dataIndex: 'customerId',
|
118
|
|
- key: 'customerId',
|
119
|
|
- align: 'center',
|
120
|
|
- width: '20%',
|
121
|
|
- // render: withActions((text, record) => [
|
122
|
|
- // <EditIcon color="#FF4A4A" text="查看详情" onClick={() => toCustomerDateil(record)} />,
|
123
|
|
- // <AuthButton name="admin.customer.recommend.edit.id.put" noRight={null}>
|
124
|
|
- // <Button className={Styles.text} type="link" onClick={() => showStatus(record)}>变更状态</Button>
|
125
|
|
- // </AuthButton>,
|
|
10
|
+const actionList = {
|
|
11
|
+ changeStatus: 'changeStatus', // 变更状态
|
|
12
|
+};
|
126
|
13
|
|
127
|
|
- // <AuthButton name="admin.customer.recommend.belong" noRight={null}>
|
128
|
|
- // <Button className={Styles.text} type="link" onClick={() => showGM(record)}>调整归属</Button>
|
129
|
|
- // </AuthButton>,
|
|
14
|
+const PrivateCustomer = () => {
|
|
15
|
+ const ref = useRef();
|
130
|
16
|
|
131
|
|
- // <AuthButton name="admin.mine.taPointsRecords.point.record" noRight={null}>
|
132
|
|
- // <Button className={ Styles.text } type="link" onClick={() => showRecord(record)}>积分记录</Button>
|
133
|
|
- // </AuthButton>,
|
|
17
|
+ const [showModel, SetShowModel] = useState({
|
|
18
|
+ // changeStatus: { visible: true, data: {} },
|
|
19
|
+ });
|
134
|
20
|
|
135
|
|
- // <AuthButton name="admin.mine.taPointsRecords.id.get" noRight={null}>
|
136
|
|
- // <Button className={ Styles.text} type="link" onClick={() => showRecommend(record.personId)}>推荐客户</Button>
|
137
|
|
- // </AuthButton>
|
138
|
|
- // ]),
|
139
|
|
- },
|
140
|
|
- ];
|
|
21
|
+ const handShowModel = (record, actionType) => {
|
|
22
|
+ SetShowModel({
|
|
23
|
+ [actionList[actionType]]: {
|
|
24
|
+ visible: true,
|
|
25
|
+ data: record,
|
|
26
|
+ },
|
|
27
|
+ });
|
|
28
|
+ };
|
|
29
|
+ const columns = useMemo(() => {
|
|
30
|
+ return [
|
|
31
|
+ {
|
|
32
|
+ title: '头像',
|
|
33
|
+ dataIndex: 'picture',
|
|
34
|
+ key: 'picture',
|
|
35
|
+ align: 'center',
|
|
36
|
+ width: '10%',
|
|
37
|
+ render: (_, record) => (
|
|
38
|
+ <Avatar
|
|
39
|
+ shape="square"
|
|
40
|
+ style={{ color: 'blue' }}
|
|
41
|
+ src={record.picture}
|
|
42
|
+ size={64}
|
|
43
|
+ icon="user"
|
|
44
|
+ />
|
|
45
|
+ ),
|
|
46
|
+ },
|
|
47
|
+ {
|
|
48
|
+ title: '姓名',
|
|
49
|
+ dataIndex: 'name',
|
|
50
|
+ key: 'name',
|
|
51
|
+ align: 'center',
|
|
52
|
+ width: '10%',
|
|
53
|
+ // eslint-disable-next-line no-nested-ternary
|
|
54
|
+ // render: (_, record) => (
|
|
55
|
+ // <>
|
|
56
|
+ // <Navigate onClick={() => toCustomerDateil(record)}>{record.name}</Navigate>
|
|
57
|
+ // </>
|
|
58
|
+ // ),
|
|
59
|
+ },
|
|
60
|
+ {
|
|
61
|
+ title: '电话',
|
|
62
|
+ dataIndex: 'phone',
|
|
63
|
+ key: 'phone',
|
|
64
|
+ align: 'center',
|
|
65
|
+ width: '10%',
|
|
66
|
+ },
|
|
67
|
+ {
|
|
68
|
+ title: '性别',
|
|
69
|
+ dataIndex: 'sex',
|
|
70
|
+ key: 'sex',
|
|
71
|
+ align: 'center',
|
|
72
|
+ width: '10%',
|
|
73
|
+ // eslint-disable-next-line no-nested-ternary
|
|
74
|
+ render: (_, record) => (
|
|
75
|
+ <>
|
|
76
|
+ <span>{record.sex === 1 ? '男' : record.sex === 2 ? '女' : '未知'}</span>
|
|
77
|
+ </>
|
|
78
|
+ ),
|
|
79
|
+ },
|
|
80
|
+ {
|
|
81
|
+ title: '置业顾问',
|
|
82
|
+ dataIndex: 'consultantName',
|
|
83
|
+ key: 'consultantName',
|
|
84
|
+ align: 'center',
|
|
85
|
+ width: '10%',
|
|
86
|
+ // eslint-disable-next-line no-nested-ternary
|
|
87
|
+ render: (_, record) => (
|
|
88
|
+ <>
|
|
89
|
+ <span>{record.consultantName}</span>
|
|
90
|
+ <br />
|
|
91
|
+ <span>{record.consultTel}</span>
|
|
92
|
+ </>
|
|
93
|
+ ),
|
|
94
|
+ },
|
|
95
|
+ {
|
|
96
|
+ title: '归属项目',
|
|
97
|
+ dataIndex: 'buildingName',
|
|
98
|
+ key: 'buildingName',
|
|
99
|
+ align: 'center',
|
|
100
|
+ width: '10%',
|
|
101
|
+ },
|
|
102
|
+ {
|
|
103
|
+ title: '推广人员',
|
|
104
|
+ dataIndex: 'sharePersonName',
|
|
105
|
+ key: 'sharePersonName',
|
|
106
|
+ align: 'center',
|
|
107
|
+ width: '10%',
|
|
108
|
+ },
|
|
109
|
+ {
|
|
110
|
+ title: '客户状态',
|
|
111
|
+ dataIndex: 'reportRecommendStatus',
|
|
112
|
+ key: 'reportRecommendStatus',
|
|
113
|
+ align: 'center',
|
|
114
|
+ width: '10%',
|
|
115
|
+ // eslint-disable-next-line no-nested-ternary
|
|
116
|
+ render: (_, records) => {
|
|
117
|
+ if (records.status === 1) {
|
|
118
|
+ return '报备';
|
|
119
|
+ }
|
|
120
|
+ if (records.status === 2) {
|
|
121
|
+ return '到访';
|
|
122
|
+ }
|
|
123
|
+ if (records.status === 3) {
|
|
124
|
+ return '认购';
|
|
125
|
+ }
|
|
126
|
+ if (records.status === 4) {
|
|
127
|
+ return '签约';
|
|
128
|
+ }
|
|
129
|
+ },
|
|
130
|
+ },
|
|
131
|
+ {
|
|
132
|
+ title: '操作',
|
|
133
|
+ dataIndex: 'customerId',
|
|
134
|
+ key: 'customerId',
|
|
135
|
+ align: 'center',
|
|
136
|
+ width: '20%',
|
|
137
|
+ render: withActions((_, record) => [
|
|
138
|
+ <AuthButton name="admin.customer.recommend.edit.id.put" noRight={null}>
|
|
139
|
+ <Button
|
|
140
|
+ className={Styles.text}
|
|
141
|
+ type="link"
|
|
142
|
+ onClick={() => handShowModel(record, actionList.changeStatus)}
|
|
143
|
+ >
|
|
144
|
+ 变更状态
|
|
145
|
+ </Button>
|
|
146
|
+ </AuthButton>,
|
|
147
|
+
|
|
148
|
+ <AuthButton name="admin.customer.recommend.belong" noRight={null}>
|
|
149
|
+ <Button className={Styles.text} type="link" onClick={() => showGM(record)}>
|
|
150
|
+ 调整归属
|
|
151
|
+ </Button>
|
|
152
|
+ </AuthButton>,
|
141
|
153
|
|
142
|
|
- const tableColumns = useMemo(() => {
|
143
|
|
- return getTableColumns()
|
144
|
|
- }, [page])
|
|
154
|
+ <AuthButton name="admin.mine.taPointsRecords.point.record" noRight={null}>
|
|
155
|
+ <Button className={Styles.text} type="link" onClick={() => showRecord(record)}>
|
|
156
|
+ 积分记录
|
|
157
|
+ </Button>
|
|
158
|
+ </AuthButton>,
|
145
|
159
|
|
|
160
|
+ <AuthButton name="admin.mine.taPointsRecords.id.get" noRight={null}>
|
|
161
|
+ <Button
|
|
162
|
+ className={Styles.text}
|
|
163
|
+ type="link"
|
|
164
|
+ onClick={() => showRecommend(record.personId)}
|
|
165
|
+ >
|
|
166
|
+ 推荐客户
|
|
167
|
+ </Button>
|
|
168
|
+ </AuthButton>,
|
|
169
|
+ ]),
|
|
170
|
+ },
|
|
171
|
+ ];
|
|
172
|
+ }, []);
|
146
|
173
|
|
147
|
|
-// const tableColumns = useMemo(()=>columns, []);
|
|
174
|
+ const searchFields = [
|
|
175
|
+ {
|
|
176
|
+ name: 'name',
|
|
177
|
+ label: '姓名',
|
|
178
|
+ placeholder: '请输入姓名',
|
|
179
|
+ }
|
|
180
|
+ ];
|
|
181
|
+ //操作成功请求数据
|
|
182
|
+ const handleCancel = () => {
|
|
183
|
+ SetShowModel({})
|
|
184
|
+ ref.current.reload();
|
|
185
|
+ };
|
148
|
186
|
|
149
|
187
|
return (
|
150
|
188
|
<>
|
151
|
189
|
<QueryTable
|
152
|
|
- ref={ref}
|
|
190
|
+ ref={ref}
|
153
|
191
|
rowKey="customerId"
|
154
|
192
|
api={apis.customer.customerRecommend}
|
155
|
|
- // searchFields={{}}
|
156
|
|
- params={{ customerType: 'private' }}
|
157
|
|
- columns={tableColumns}
|
|
193
|
+ searchFields={searchFields}
|
|
194
|
+ params={{
|
|
195
|
+ customerType: 'private',
|
|
196
|
+ }}
|
|
197
|
+ columns={columns}
|
158
|
198
|
// actionRender={actionRender}
|
159
|
199
|
// onPageChange={(pg) => setPage(pg)}
|
160
|
200
|
/>
|
|
201
|
+
|
|
202
|
+ <ChangeStatus
|
|
203
|
+ modelProps={showModel[actionList.changeStatus]}
|
|
204
|
+ handleCancel={handleCancel}
|
|
205
|
+ onCancel={() => SetShowModel({})}
|
|
206
|
+ ></ChangeStatus>
|
161
|
207
|
</>
|
162
|
208
|
);
|
163
|
|
-}
|
|
209
|
+};
|
164
|
210
|
|
165
|
211
|
export default PrivateCustomer;
|