|
@@ -20,20 +20,21 @@ class InviteTable extends React.Component {
|
20
|
20
|
super(props);
|
21
|
21
|
this.state = {
|
22
|
22
|
dataSource: { records: [] },
|
23
|
|
- visibleData: { visible: false, customerId: '', realtyConsultant: '' },
|
|
23
|
+ visibleData: { visible: false, helpId: '', realtyConsultant: '' },
|
24
|
24
|
}
|
25
|
25
|
}
|
26
|
26
|
|
27
|
27
|
// 挂载之后
|
28
|
28
|
componentDidMount () {
|
29
|
|
- const { customerId } = this.state.visibleData
|
30
|
|
- this.getList({ helpRecordInitiateId: customerId, pageNumber: 1, pageSize: 5 })
|
|
29
|
+ const { helpId } = this.state.visibleData
|
|
30
|
+ this.getList({ helpRecordInitiateId: helpId, pageNumber: 1, pageSize: 5 })
|
31
|
31
|
}
|
32
|
32
|
|
33
|
33
|
componentDidUpdate (preProps, preState) {
|
34
|
|
- const { customerId } = this.state.visibleData
|
35
|
|
- if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
|
36
|
|
- this.getList({ helpRecordInitiateId: customerId, pageNumber: 1, pageSize: 5 })
|
|
34
|
+ const { helpId } = this.state.visibleData
|
|
35
|
+
|
|
36
|
+ if (this.props.visibleData.visible !== preState.visibleData.visible) {
|
|
37
|
+ this.getList({ helpRecordInitiateId: helpId, pageNumber: 1, pageSize: 5 })
|
37
|
38
|
this.setState({ visibleData: this.props.visibleData });
|
38
|
39
|
}
|
39
|
40
|
}
|
|
@@ -41,12 +42,12 @@ class InviteTable extends React.Component {
|
41
|
42
|
// 弹框确定按钮
|
42
|
43
|
// eslint-disable-next-line react/sort-comp
|
43
|
44
|
handleOk () {
|
44
|
|
- this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
|
|
45
|
+ this.setState({ visibleData: { visible: false, helpId: '', realtyConsultant: '' } })
|
45
|
46
|
}
|
46
|
47
|
|
47
|
48
|
// 弹框取消按钮
|
48
|
49
|
handleCancel () {
|
49
|
|
- this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
|
|
50
|
+ this.setState({ visibleData: { visible: false, helpId: '', realtyConsultant: '' } })
|
50
|
51
|
}
|
51
|
52
|
|
52
|
53
|
getList (params) {
|
|
@@ -65,6 +66,27 @@ class InviteTable extends React.Component {
|
65
|
66
|
})
|
66
|
67
|
}
|
67
|
68
|
|
|
69
|
+ // eslint-disable-next-line class-methods-use-this
|
|
70
|
+ exportHelp() {
|
|
71
|
+ console.log('this.state.25252464122', this.state.visibleData)
|
|
72
|
+ request({ ...apis.helpActivity.gethelpRecordExport, responseType: 'blob', params: { helpRecordInitiateId: this.state.visibleData.helpId } })
|
|
73
|
+ .then(data => {
|
|
74
|
+ if (!data) {
|
|
75
|
+ return
|
|
76
|
+ }
|
|
77
|
+ const url = window.URL.createObjectURL(new Blob([data]))
|
|
78
|
+ const link = document.createElement('a')
|
|
79
|
+ link.style.display = 'none'
|
|
80
|
+ link.href = url
|
|
81
|
+ link.setAttribute('download', '助力者记录.xlsx')
|
|
82
|
+ document.body.append(link)
|
|
83
|
+ link.click()
|
|
84
|
+ }).catch(() => {
|
|
85
|
+
|
|
86
|
+ })
|
|
87
|
+ }
|
|
88
|
+
|
|
89
|
+
|
68
|
90
|
// 分页
|
69
|
91
|
onChange (pageNum) {
|
70
|
92
|
this.getList({ pageNumber: pageNum, pageSize: 5 })
|
|
@@ -104,7 +126,9 @@ class InviteTable extends React.Component {
|
104
|
126
|
onCancel={(e) => this.handleCancel(e)}
|
105
|
127
|
>
|
106
|
128
|
|
107
|
|
-
|
|
129
|
+ <Button type="primary" onClick={() => this.exportHelp()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
|
|
130
|
+ 导出
|
|
131
|
+ </Button>
|
108
|
132
|
<Table rowKey="independent" dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
|
109
|
133
|
</Modal>
|
110
|
134
|
</>
|
|
@@ -114,38 +138,38 @@ class InviteTable extends React.Component {
|
114
|
138
|
|
115
|
139
|
|
116
|
140
|
/**
|
117
|
|
- * 助力者弹框
|
|
141
|
+ * 核销弹框
|
118
|
142
|
*/
|
119
|
143
|
class Verifier extends React.Component {
|
120
|
144
|
constructor(props) {
|
121
|
145
|
super(props);
|
122
|
146
|
this.state = {
|
123
|
147
|
verification: { verificationCode: '' },
|
124
|
|
- visibleData: { visible: false, customerId: '', realtyConsultant: '', helpRecordInitiateId: '', verificationCode: '' },
|
|
148
|
+ visibleData: { visible: false, helpId: '', helpRecordInitiateId: '', verificationCode: '' },
|
125
|
149
|
}
|
126
|
150
|
}
|
127
|
151
|
|
128
|
152
|
// 挂载之后
|
129
|
153
|
componentDidMount () {
|
130
|
|
- const { customerId } = this.state.visibleData
|
|
154
|
+ const { helpId } = this.state.visibleData
|
131
|
155
|
}
|
132
|
156
|
|
133
|
157
|
componentDidUpdate (preProps, preState) {
|
134
|
|
- const { customerId } = this.state.visibleData
|
135
|
|
- if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
|
136
|
|
- this.setState({ visibleData: { visible: this.props.visibleData.visible, customerId: this.props.visibleData.customerId, verificationCode: '' } })
|
|
158
|
+ const { helpId } = this.state.visibleData
|
|
159
|
+ if (this.props.visibleData.visible !== preState.visibleData.visible) {
|
|
160
|
+ this.setState({ visibleData: { visible: this.props.visibleData.visible, helpId: this.props.visibleData.helpId, helpRecordInitiateId: '', verificationCode: '' } })
|
137
|
161
|
}
|
138
|
162
|
}
|
139
|
163
|
|
140
|
164
|
// 弹框确定按钮
|
141
|
165
|
// eslint-disable-next-line react/sort-comp
|
142
|
166
|
handleOk () {
|
143
|
|
- this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
|
|
167
|
+ this.setState({ visibleData: { visible: false, helpId: '', helpRecordInitiateId: '', verificationCode: '' } })
|
144
|
168
|
}
|
145
|
169
|
|
146
|
170
|
// 弹框取消按钮
|
147
|
171
|
handleCancel () {
|
148
|
|
- this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
|
|
172
|
+ this.setState({ visibleData: { visible: false, helpId: '', helpRecordInitiateId: '', verificationCode: '' } })
|
149
|
173
|
}
|
150
|
174
|
|
151
|
175
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -168,39 +192,14 @@ class Verifier extends React.Component {
|
168
|
192
|
|
169
|
193
|
// eslint-disable-next-line class-methods-use-this
|
170
|
194
|
verify(e) {
|
171
|
|
- this.setState({ visibleData: { visible: true, customerId: this.props.visibleData.customerId, verificationCode: e.target.value } })
|
|
195
|
+ this.setState({ visibleData: { visible: true, helpId: this.props.visibleData.helpId, verificationCode: e.target.value } })
|
172
|
196
|
}
|
173
|
197
|
|
174
|
198
|
// eslint-disable-next-line class-methods-use-this
|
175
|
199
|
verification(e) {
|
176
|
|
- this.getList({ helpRecordInitiateId: this.state.visibleData.customerId, verifyCode: this.state.visibleData.verificationCode })
|
|
200
|
+ this.getList({ helpRecordInitiateId: this.state.visibleData.helpId, verifyCode: this.state.visibleData.verificationCode })
|
177
|
201
|
}
|
178
|
202
|
|
179
|
|
- // exportCustomer() {
|
180
|
|
- // const code = customerType === 'helpSucceed' ? 1 : 0
|
181
|
|
- // request({ ...apis.helpActivity.HelpInitiateRecordSucceed, responseType: 'blob', params: { ...fieldsValue, customerType, helpActivityId, code } })
|
182
|
|
- // .then(response => {
|
183
|
|
- // download(response)
|
184
|
|
- // }).catch(() => {
|
185
|
|
-
|
186
|
|
- // })
|
187
|
|
- // }
|
188
|
|
-
|
189
|
|
- // download(data) {
|
190
|
|
- // if (!data) {
|
191
|
|
- // return
|
192
|
|
- // }
|
193
|
|
- // const url = window.URL.createObjectURL(new Blob([data]))
|
194
|
|
- // const link = document.createElement('a')
|
195
|
|
- // link.style.display = 'none'
|
196
|
|
- // link.href = url
|
197
|
|
- // link.setAttribute('download', '助力记录.xlsx')
|
198
|
|
- // document.body.append(link)
|
199
|
|
- // link.click()
|
200
|
|
- // }
|
201
|
|
-
|
202
|
|
-
|
203
|
|
-
|
204
|
203
|
render () {
|
205
|
204
|
return (
|
206
|
205
|
<>
|
|
@@ -214,7 +213,7 @@ class Verifier extends React.Component {
|
214
|
213
|
onCancel={(e) => this.handleCancel(e)}
|
215
|
214
|
>
|
216
|
215
|
<div><span>核销码:<input onChange={this.verify.bind(this)}/></span>
|
217
|
|
- <Button onClick={(e) => this.verification(e)}>立即核销</Button>
|
|
216
|
+ <Button onClick={(e) => this.verification(e)} style={{ marginLeft: '80px' }}>立即核销</Button>
|
218
|
217
|
</div>
|
219
|
218
|
</Modal>
|
220
|
219
|
</>
|
|
@@ -229,9 +228,10 @@ class Verifier extends React.Component {
|
229
|
228
|
* @returns
|
230
|
229
|
*/
|
231
|
230
|
function body(props) {
|
232
|
|
- const [gInviteData, setGInviteData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
|
|
231
|
+ const [gInviteData, setGInviteData] = useState({ visible: false, helpId: '', realtyConsultant: '' })
|
233
|
232
|
|
234
|
|
- const [gVerifierData, setVerifierData] = useState({ visible: false, customerId: '', realtyConsultant: '', helpRecordInitiateId: '' })
|
|
233
|
+ // 核销码弹框
|
|
234
|
+ const [gVerifierData, setVerifierData] = useState({ visible: false, helpId: '', helpRecordInitiateId: '', verificationCode: '' })
|
235
|
235
|
|
236
|
236
|
const { getFieldDecorator, getFieldsValue } = props.form
|
237
|
237
|
|
|
@@ -246,7 +246,7 @@ function body(props) {
|
246
|
246
|
|
247
|
247
|
// 调整归属 ============ start
|
248
|
248
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
249
|
|
- const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
|
|
249
|
+ const [gVisibleData, setGVisibleData] = useState({ visible: false, helpId: '', realtyConsultant: '' })
|
250
|
250
|
|
251
|
251
|
|
252
|
252
|
// 变更状态 ============= end
|
|
@@ -276,7 +276,7 @@ function body(props) {
|
276
|
276
|
}
|
277
|
277
|
|
278
|
278
|
function displayNone() {
|
279
|
|
- setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
|
|
279
|
+ setGVisibleData({ visible: false, helpId: '', realtyConsultant: '' })
|
280
|
280
|
}
|
281
|
281
|
|
282
|
282
|
// 提交事件
|
|
@@ -306,7 +306,8 @@ function body(props) {
|
306
|
306
|
|
307
|
307
|
// 助力成功/进行中/助力失败
|
308
|
308
|
function radioButtonHandleSizeChange(e) {
|
309
|
|
- setGInviteData({ visible: false, customerId: '', realtyConsultant: '' })
|
|
309
|
+ setGInviteData({ visible: false, helpId: '', realtyConsultant: '' })
|
|
310
|
+ setVerifierData({ visible: false, helpId: '', helpRecordInitiateId: '', verificationCode: '' })
|
310
|
311
|
displayNone()
|
311
|
312
|
|
312
|
313
|
const { value } = e.target
|
|
@@ -355,24 +356,17 @@ function body(props) {
|
355
|
356
|
|
356
|
357
|
// 助力记录弹框
|
357
|
358
|
function helpRecord(row) {
|
358
|
|
-// 关闭核销
|
359
|
|
-console.log('gInviteData', gInviteData)
|
|
359
|
+ setVerifierData({ visible: false, helpId: row.helpRecordInitiateId, elpRecordInitiateId: '', verificationCode: '' })
|
|
360
|
+
|
|
361
|
+ setGInviteData({ visible: true, helpId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
|
360
|
362
|
|
361
|
|
-
|
362
|
|
- setGInviteData({ visible: true, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
|
363
|
|
-
|
364
|
|
- setVerifierData({ visible: false, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
|
365
|
363
|
}
|
366
|
364
|
// 核销
|
367
|
365
|
function helpInitiateRecordVerify(row) {
|
368
|
|
-
|
369
|
|
- console.log('gVerifierData', gVerifierData)
|
370
|
366
|
// 关闭助力记录弹框
|
371
|
|
- setGInviteData({ visible: false, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
|
372
|
|
-
|
373
|
|
- setVerifierData({ visible: true, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
|
374
|
|
-
|
|
367
|
+ setGInviteData({ visible: false, helpId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
|
375
|
368
|
|
|
369
|
+ setVerifierData({ visible: true, helpId: row.helpRecordInitiateId, elpRecordInitiateId: '', verificationCode: '' })
|
376
|
370
|
}
|
377
|
371
|
|
378
|
372
|
const publicColumns = [
|
|
@@ -455,8 +449,6 @@ console.log('gInviteData', gInviteData)
|
455
|
449
|
},
|
456
|
450
|
{
|
457
|
451
|
title: '操作',
|
458
|
|
- dataIndex: 'customerId',
|
459
|
|
- key: 'customerId',
|
460
|
452
|
align: 'center',
|
461
|
453
|
width: '25%',
|
462
|
454
|
render: (x, row) => (
|
|
@@ -512,8 +504,8 @@ console.log('gInviteData', gInviteData)
|
512
|
504
|
<Table dataSource={dataSource.list} columns={privateColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> :
|
513
|
505
|
<Table dataSource={dataSource.list} columns={publicColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" />
|
514
|
506
|
}
|
515
|
|
- <InviteTable visibleData={gInviteData} />
|
516
|
|
- <Verifier visibleData={gVerifierData} />
|
|
507
|
+ <Verifier visibleData={gVerifierData} />
|
|
508
|
+ <InviteTable visibleData={gInviteData} />
|
517
|
509
|
</>
|
518
|
510
|
);
|
519
|
511
|
}
|