|
@@ -5,140 +5,15 @@ import request from '../../../utils/request';
|
5
|
5
|
import apis from '../../../services/apis';
|
6
|
6
|
import Styles from './style.less';
|
7
|
7
|
|
|
8
|
+import Attribution from './components/attribution'
|
|
9
|
+import IntegralRecord from './components/integralRecord'
|
|
10
|
+import ChangeStatus from './components/changeStatus'
|
|
11
|
+
|
8
|
12
|
|
9
|
13
|
const { Option } = Select;
|
10
|
14
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
11
|
15
|
const { Meta } = Card;
|
12
|
16
|
|
13
|
|
-/**
|
14
|
|
- * 调整归属
|
15
|
|
- * (废弃, 后面研究)
|
16
|
|
- *
|
17
|
|
- * @param {*} props
|
18
|
|
- * @returns
|
19
|
|
- */
|
20
|
|
-class ModalTable extends React.Component {
|
21
|
|
- constructor(props) {
|
22
|
|
- super(props);
|
23
|
|
- this.state = {
|
24
|
|
- dataSource: { records: [] },
|
25
|
|
- visibleData: { visible: false, customerId: '', realtyConsultant: '' },
|
26
|
|
- }
|
27
|
|
- }
|
28
|
|
-
|
29
|
|
- // 挂载之后
|
30
|
|
- componentDidMount() {
|
31
|
|
- this.getList({ pageNumber: 1, pageSize: 5 })
|
32
|
|
- }
|
33
|
|
-
|
34
|
|
- componentDidUpdate(preProps, preState) {
|
35
|
|
- if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
|
36
|
|
- this.getList({ pageNumber: 1, pageSize: 5 })
|
37
|
|
- this.setState({ visibleData: this.props.visibleData });
|
38
|
|
- }
|
39
|
|
- }
|
40
|
|
-
|
41
|
|
- // 弹框确定按钮
|
42
|
|
- // eslint-disable-next-line react/sort-comp
|
43
|
|
- handleOk() {
|
44
|
|
- this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
|
45
|
|
- }
|
46
|
|
-
|
47
|
|
- // 弹框取消按钮
|
48
|
|
- handleCancel() {
|
49
|
|
- this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
|
50
|
|
- }
|
51
|
|
-
|
52
|
|
- getList(params) {
|
53
|
|
- // 网路请求
|
54
|
|
- request({ ...apis.customer.consultant, params: { ...params } }).then(res => {
|
55
|
|
- this.setState({ dataSource: res })
|
56
|
|
- }).catch(err => {
|
57
|
|
- // eslint-disable-next-line no-unused-expressions
|
58
|
|
- <Alert
|
59
|
|
- style={{
|
60
|
|
- marginBottom: 24,
|
61
|
|
- }}
|
62
|
|
- message={err}
|
63
|
|
- type="error"
|
64
|
|
- showIcon
|
65
|
|
- />
|
66
|
|
- })
|
67
|
|
- }
|
68
|
|
-
|
69
|
|
- // 分页
|
70
|
|
- onChange(pageNum) {
|
71
|
|
- this.getList({ pageNumber: pageNum, pageSize: 5 })
|
72
|
|
- }
|
73
|
|
-
|
74
|
|
- // 提交
|
75
|
|
- submitGm() {
|
76
|
|
- const { url, method } = apis.customer.recommendEdit
|
77
|
|
- const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(this.state.visibleData.customerId)
|
78
|
|
-
|
79
|
|
- // 网路请求
|
80
|
|
- request({ url: tempUrl, method, data: { ...this.state.visibleData } }).then(res => {
|
81
|
|
- this.handleCancel()
|
82
|
|
- }).catch(err => {
|
83
|
|
- // eslint-disable-next-line no-unused-expressions
|
84
|
|
- <Alert
|
85
|
|
- style={{
|
86
|
|
- marginBottom: 24,
|
87
|
|
- }}
|
88
|
|
- message={err}
|
89
|
|
- type="error"
|
90
|
|
- showIcon
|
91
|
|
- />
|
92
|
|
- })
|
93
|
|
- }
|
94
|
|
-
|
95
|
|
- render() {
|
96
|
|
- const columns = [
|
97
|
|
- {
|
98
|
|
- title: '姓名',
|
99
|
|
- dataIndex: 'name',
|
100
|
|
- key: 'name',
|
101
|
|
- },
|
102
|
|
- {
|
103
|
|
- title: '电话',
|
104
|
|
- dataIndex: 'phone',
|
105
|
|
- key: 'phone',
|
106
|
|
- },
|
107
|
|
- {
|
108
|
|
- title: '部门',
|
109
|
|
- dataIndex: 'department',
|
110
|
|
- key: 'department',
|
111
|
|
- },
|
112
|
|
- {
|
113
|
|
- title: '岗位',
|
114
|
|
- dataIndex: 'post',
|
115
|
|
- key: 'post',
|
116
|
|
- },
|
117
|
|
- {
|
118
|
|
- title: '操作',
|
119
|
|
- dataIndex: 'personId',
|
120
|
|
- key: 'personId',
|
121
|
|
- // eslint-disable-next-line no-nested-ternary
|
122
|
|
- render: (_, record) => <><Button className={Styles.SubmitButton} onClick={() => this.submitGm()}>确定</Button></>,
|
123
|
|
- },
|
124
|
|
- ]
|
125
|
|
- return (
|
126
|
|
- <>
|
127
|
|
- <Modal
|
128
|
|
- title="选择置业顾问"
|
129
|
|
- destroyOnClose="true"
|
130
|
|
- footer={null}
|
131
|
|
- visible={this.state.visibleData.visible}
|
132
|
|
- // onOk={() => this.handleOk()}
|
133
|
|
- onCancel={(e) => this.handleCancel(e)}
|
134
|
|
- >
|
135
|
|
- <Table dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
|
136
|
|
- </Modal>
|
137
|
|
- </>
|
138
|
|
- );
|
139
|
|
- }
|
140
|
|
-}
|
141
|
|
-
|
142
|
17
|
/**
|
143
|
18
|
*
|
144
|
19
|
*
|
|
@@ -158,9 +33,18 @@ function body(props) {
|
158
|
33
|
// 调整归属 ============ start
|
159
|
34
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
160
|
35
|
const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
|
161
|
|
-
|
162
|
36
|
// 调整归属 ============= end
|
163
|
37
|
|
|
38
|
+ // 积分记录 ============ start
|
|
39
|
+ // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
40
|
+ const [recordVisibleData, setRecordVisibleData] = useState({ visible: false, customerId: '' })
|
|
41
|
+ // 积分记录 ============= end
|
|
42
|
+
|
|
43
|
+ // 变更状态 ============ start
|
|
44
|
+ // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
45
|
+ const [statusVisibleData, setStatusVisibleData] = useState({ visible: false, customerId: '', status: '' })
|
|
46
|
+ // 变更状态 ============= end
|
|
47
|
+
|
164
|
48
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
165
|
49
|
useEffect(() => {
|
166
|
50
|
getList({ pageNumber: 1, pageSize: 10, customerType })
|
|
@@ -183,8 +67,17 @@ function body(props) {
|
183
|
67
|
})
|
184
|
68
|
}
|
185
|
69
|
|
|
70
|
+ function displayNone() {
|
|
71
|
+ setRecordVisibleData({ visible: false, customerId: '' })
|
|
72
|
+ setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
|
|
73
|
+ setStatusVisibleData({ visible: false, customerId: '', status: '' })
|
|
74
|
+ }
|
|
75
|
+
|
186
|
76
|
// 提交事件
|
187
|
77
|
function handleSubmit(e) {
|
|
78
|
+ displayNone()
|
|
79
|
+
|
|
80
|
+
|
188
|
81
|
e.preventDefault();
|
189
|
82
|
props.form.validateFields((err, values) => {
|
190
|
83
|
if (!err) {
|
|
@@ -207,17 +100,33 @@ function body(props) {
|
207
|
100
|
|
208
|
101
|
// 私客/公客切换
|
209
|
102
|
function radioButtonHandleSizeChange(e) {
|
|
103
|
+ displayNone()
|
|
104
|
+
|
210
|
105
|
const { value } = e.target
|
211
|
106
|
setCustomerType(value)
|
212
|
107
|
getList({ pageNumber: 1, pageSize: 10, customerType: value })
|
213
|
108
|
}
|
214
|
109
|
|
215
|
|
- // 调整归属 ============ start
|
216
|
|
- // 调整归属 显示
|
217
|
|
- function gM(row) {
|
218
|
|
- setGVisibleData({ visible: true, customerId: row.customerId, realtyConsultant: row.realtyConsultant })
|
|
110
|
+ // 这里有个 Bug, 就是 Modal 弹框,会联动出现, 比如 我点击 调整归属的Model弹框, 那么 积分记录的Model弹框莫名其妙的也显示了
|
|
111
|
+ // 所有这里临时解决方法是,弹出一个Modal对话框的时候,把其他的对话框给隐藏
|
|
112
|
+
|
|
113
|
+ function showGM(record) {
|
|
114
|
+ setGVisibleData({ visible: true, customerId: record.customerId, realtyConsultant: record.realtyConsultant })
|
|
115
|
+ setRecordVisibleData({ visible: false, customerId: '' })
|
|
116
|
+ setStatusVisibleData({ visible: false, customerId: '' })
|
|
117
|
+ }
|
|
118
|
+
|
|
119
|
+ function showRecord(record) {
|
|
120
|
+ setRecordVisibleData({ visible: true, customerId: record.customerId })
|
|
121
|
+ setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
|
|
122
|
+ setStatusVisibleData({ visible: false, customerId: '' })
|
|
123
|
+ }
|
|
124
|
+
|
|
125
|
+ function showStatus(record) {
|
|
126
|
+ setRecordVisibleData({ visible: false, customerId: '' })
|
|
127
|
+ setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
|
|
128
|
+ setStatusVisibleData({ visible: true, customerId: record.customerId, status: record.status })
|
219
|
129
|
}
|
220
|
|
- // 调整归属 ============ end
|
221
|
130
|
|
222
|
131
|
const columns = [
|
223
|
132
|
{
|
|
@@ -272,13 +181,13 @@ function body(props) {
|
272
|
181
|
// eslint-disable-next-line no-nested-ternary
|
273
|
182
|
render: (_, record) => (
|
274
|
183
|
<>
|
275
|
|
- <sapn className={ customerType === 'private' ? Styles.text : Styles.displayS }>变更状态</sapn>
|
|
184
|
+ <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link" onClick={() => showStatus(record)}>变更状态</Button>
|
276
|
185
|
|
277
|
|
- <sapn className={ customerType === 'private' ? Styles.text : Styles.displayS } onClick={() => gM(record)}>调整归属</sapn>
|
|
186
|
+ <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link" onClick={() => showGM(record)}>调整归属</Button>
|
278
|
187
|
<br/>
|
279
|
|
- <sapn className={ Styles.text }>查看详情</sapn>
|
|
188
|
+ <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link">查看详情</Button>
|
280
|
189
|
|
281
|
|
- <sapn className={ Styles.text }>积分记录</sapn>
|
|
190
|
+ <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link" onClick={ () => showRecord(record) }>积分记录</Button>
|
282
|
191
|
</>
|
283
|
192
|
),
|
284
|
193
|
},
|
|
@@ -330,7 +239,7 @@ function body(props) {
|
330
|
239
|
)}
|
331
|
240
|
</Form.Item>
|
332
|
241
|
<Form.Item>
|
333
|
|
- <Button type="primary" htmlType="submit" className={Styles.SubmitButton}>
|
|
242
|
+ <Button type="danger" htmlType="submit" >
|
334
|
243
|
搜索
|
335
|
244
|
</Button>
|
336
|
245
|
</Form.Item>
|
|
@@ -345,8 +254,13 @@ function body(props) {
|
345
|
254
|
<Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
|
346
|
255
|
|
347
|
256
|
{/* 调整归属 */}
|
348
|
|
- <ModalTable visibleData={gVisibleData} />
|
|
257
|
+ <Attribution visibleData={gVisibleData} />
|
|
258
|
+
|
|
259
|
+ {/* 积分记录 */}
|
|
260
|
+ <IntegralRecord visibleData={recordVisibleData} />
|
349
|
261
|
|
|
262
|
+ {/* 变更状态 */}
|
|
263
|
+ <ChangeStatus visibleData={statusVisibleData} />
|
350
|
264
|
</>
|
351
|
265
|
);
|
352
|
266
|
}
|