dingxin пре 5 година
родитељ
комит
059c0b5e8c
2 измењених фајлова са 226 додато и 38 уклоњено
  1. 221
    38
      src/pages/activity/helpActivity/helpRecord.jsx
  2. 5
    0
      src/services/apis.js

+ 221
- 38
src/pages/activity/helpActivity/helpRecord.jsx Прегледај датотеку

13
 const { Meta } = Card;
13
 const { Meta } = Card;
14
 
14
 
15
 /**
15
 /**
16
- *
16
+ * 助力者弹框
17
+ */
18
+class InviteTable extends React.Component {
19
+  constructor(props) {
20
+    super(props);
21
+    this.state = {
22
+      dataSource: { records: [] },
23
+      visibleData: { visible: false, customerId: '', realtyConsultant: '' },
24
+    }
25
+  }
26
+
27
+  // 挂载之后
28
+  componentDidMount () {
29
+    const { customerId } = this.state.visibleData
30
+    this.getList({ helpRecordInitiateId: customerId, pageNumber: 1, pageSize: 5 })
31
+  }
32
+
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 })
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
+    request({ ...apis.helpActivity.helpPeopleDetails, params: { ...params } }).then(res => {
54
+      this.setState({ dataSource: res })
55
+    }).catch(err => {
56
+      // eslint-disable-next-line no-unused-expressions
57
+      <Alert
58
+        style={{
59
+          marginBottom: 24,
60
+        }}
61
+        message={err}
62
+        type="error"
63
+        showIcon
64
+      />
65
+    })
66
+  }
67
+
68
+  // 分页
69
+  onChange (pageNum) {
70
+    this.getList({ pageNumber: pageNum, pageSize: 5 })
71
+  }
72
+
73
+  render () {
74
+    const columns = [
75
+      {
76
+        title: '用户姓名',
77
+        dataIndex: 'name',
78
+        key: 'name',
79
+        align: 'center',
80
+      },
81
+      {
82
+        title: '手机号',
83
+        dataIndex: 'phone',
84
+        key: 'phone',
85
+        align: 'center',
86
+        render: text => <a>{text}</a>,
87
+      },
88
+      {
89
+        title: '助力时间',
90
+        dataIndex: 'createDate',
91
+        key: 'createDate',
92
+        align: 'center',
93
+      },
94
+    ]
95
+    return (
96
+      <>
97
+        <Modal
98
+          title="助力者"
99
+          destroyOnClose="true"
100
+          width={900}
101
+          footer={null}
102
+          visible={this.state.visibleData.visible}
103
+          // onOk={() => this.handleOk()}
104
+          onCancel={(e) => this.handleCancel(e)}
105
+        >
106
+          <Table rowKey="independent" dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
107
+        </Modal>
108
+      </>
109
+    );
110
+  }
111
+}
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+/**
120
+ * 助力者弹框
121
+ */
122
+class Verifier extends React.Component {
123
+  constructor(props) {
124
+    super(props);
125
+    this.state = {
126
+      helpRecordInitiateId: { id: '' },
127
+      visibleData: { visible: false, customerId: '', realtyConsultant: '', helpRecordInitiateId: '' },
128
+    }
129
+  }
130
+
131
+  // 挂载之后
132
+  componentDidMount () {
133
+    const { customerId } = this.state.visibleData
134
+    this.getList({ helpRecordInitiateId: customerId, pageNumber: 1, pageSize: 5 })
135
+  }
136
+
137
+  componentDidUpdate (preProps, preState) {
138
+    const { customerId } = this.state.visibleData
139
+    console.log('this.state.visibleData', this.state.visibleData)
140
+    if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
141
+      this.getList({ helpRecordInitiateId: customerId, pageNumber: 1, pageSize: 5 })
142
+      this.setState({ visibleData: this.props.visibleData });
143
+    }
144
+  }
145
+
146
+  // 弹框确定按钮
147
+  // eslint-disable-next-line react/sort-comp
148
+  handleOk () {
149
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
150
+  }
151
+
152
+  // 弹框取消按钮
153
+  handleCancel () {
154
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
155
+  }
156
+
157
+  getList (params) {
158
+    request({ ...apis.helpActivity.helpPeopleDetails, params: { ...params } }).then(res => {
159
+      this.setState({ dataSource: res })
160
+    }).catch(err => {
161
+      // eslint-disable-next-line no-unused-expressions
162
+      <Alert
163
+        style={{
164
+          marginBottom: 24,
165
+        }}
166
+        message={err}
167
+        type="error"
168
+        showIcon
169
+      />
170
+    })
171
+  }
172
+
173
+  // eslint-disable-next-line class-methods-use-this
174
+  verify(e) {
175
+    console.log('111', e.target.value)
176
+  }
177
+
178
+  // eslint-disable-next-line class-methods-use-this
179
+  verification(e) {
180
+    console.log('this.state.visibleData', this.state.visibleData)
181
+      alert(1)
182
+  }
183
+
184
+  render () {
185
+    return (
186
+      <>
187
+        <Modal
188
+          title="核销"
189
+          destroyOnClose="true"
190
+          width={300}
191
+          footer={null}
192
+          visible={this.state.visibleData.visible}
193
+          // onOk={() => this.handleOk()}
194
+          onCancel={(e) => this.handleCancel(e)}
195
+        >
196
+          <div><span>核销码:<input onChange={this.verify.bind(this)}/></span>
197
+           <Button onClick={(e) => this.verification(e)}>立即核销</Button>
198
+          </div>
199
+        </Modal>
200
+      </>
201
+    );
202
+  }
203
+}
204
+
205
+/**
206
+ *主体列表
17
  *
207
  *
18
  * @param {*} props
208
  * @param {*} props
19
  * @returns
209
  * @returns
20
  */
210
  */
21
 function body(props) {
211
 function body(props) {
212
+  const [gInviteData, setGInviteData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
213
+
214
+  const [gVerifierData, setVerifierData] = useState({ visible: false, customerId: '', realtyConsultant: '', helpRecordInitiateId: '' })
215
+
22
   const { getFieldDecorator, getFieldsValue } = props.form
216
   const { getFieldDecorator, getFieldsValue } = props.form
23
 
217
 
24
   // eslint-disable-next-line react-hooks/rules-of-hooks
218
   // eslint-disable-next-line react-hooks/rules-of-hooks
26
   // eslint-disable-next-line react-hooks/rules-of-hooks
220
   // eslint-disable-next-line react-hooks/rules-of-hooks
27
   // const [columns, setColumns] = useState(privateColumns)
221
   // const [columns, setColumns] = useState(privateColumns)
28
 
222
 
29
-  // 默认私客
223
+  // 默认成功
30
   // eslint-disable-next-line react-hooks/rules-of-hooks
224
   // eslint-disable-next-line react-hooks/rules-of-hooks
31
   const [customerType, setCustomerType] = useState('helpSucceed')
225
   const [customerType, setCustomerType] = useState('helpSucceed')
32
 
226
 
33
   // 调整归属 ============  start
227
   // 调整归属 ============  start
34
   // eslint-disable-next-line react-hooks/rules-of-hooks
228
   // eslint-disable-next-line react-hooks/rules-of-hooks
35
   const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
229
   const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
36
-  // 调整归属 ============= end
37
 
230
 
38
-  // 积分记录 ============  start
39
-  // eslint-disable-next-line react-hooks/rules-of-hooks
40
-  const [recordVisibleData, setRecordVisibleData] = useState({ visible: false, customerId: '' })
41
-  // 积分记录 ============= end
42
 
231
 
43
-  // 变更状态 ============  start
44
-  // eslint-disable-next-line react-hooks/rules-of-hooks
45
-  const [statusVisibleData, setStatusVisibleData] = useState({ visible: false, customerId: '', status: '' })
46
   // 变更状态 ============= end
232
   // 变更状态 ============= end
47
 
233
 
48
   // eslint-disable-next-line react-hooks/rules-of-hooks
234
   // eslint-disable-next-line react-hooks/rules-of-hooks
70
   }
256
   }
71
 
257
 
72
   function displayNone() {
258
   function displayNone() {
73
-    setRecordVisibleData({ visible: false, customerId: '' })
74
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
259
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
75
-    setStatusVisibleData({ visible: false, customerId: '', status: '' })
76
   }
260
   }
77
 
261
 
78
   // 提交事件
262
   // 提交事件
100
     getList({ pageNumber: pageNum, pageSize: 10, customerType })
284
     getList({ pageNumber: pageNum, pageSize: 10, customerType })
101
   }
285
   }
102
 
286
 
103
-  // 私客/公客切换
287
+  // 助力成功/进行中/助力失败
104
   function radioButtonHandleSizeChange(e) {
288
   function radioButtonHandleSizeChange(e) {
289
+    setGInviteData({ visible: true, customerId: '', realtyConsultant: '' })
105
     displayNone()
290
     displayNone()
106
 
291
 
107
     const { value } = e.target
292
     const { value } = e.target
115
     getList({ pageNumber: 1, pageSize: 10, customerType })
300
     getList({ pageNumber: 1, pageSize: 10, customerType })
116
   }
301
   }
117
 
302
 
118
-
119
-  // 这里有个 Bug, 就是 Modal 弹框,会联动出现, 比如 我点击 调整归属的Model弹框, 那么 积分记录的Model弹框莫名其妙的也显示了
120
-  // 所有这里临时解决方法是,弹出一个Modal对话框的时候,把其他的对话框给隐藏
121
-
122
-  function showGM(record) {
123
-    setGVisibleData({ visible: true, customerId: record.customerId, realtyConsultant: record.realtyConsultant })
124
-    setRecordVisibleData({ visible: false, customerId: '' })
125
-    setStatusVisibleData({ visible: false, customerId: '' })
126
-  }
127
-
128
-  function showRecord(record) {
129
-    setRecordVisibleData({ visible: true, customerId: record.customerId })
130
-    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
131
-    setStatusVisibleData({ visible: false, customerId: '' })
132
-  }
133
-
134
-  function showStatus(record) {
135
-    setRecordVisibleData({ visible: false, customerId: '' })
136
-    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
137
-    setStatusVisibleData({ visible: true, customerId: record.customerId, status: record.status })
138
-  }
139
   function toCustomerDateil(record) {
303
   function toCustomerDateil(record) {
140
     router.push({
304
     router.push({
141
       pathname: '/customer/customerlist/customerDetail',
305
       pathname: '/customer/customerlist/customerDetail',
168
     link.click()
332
     link.click()
169
   }
333
   }
170
 
334
 
335
+// 助力记录弹框
336
+function helpRecord(row) {
337
+// 关闭核销
338
+// eslint-disable-next-line max-len
339
+setVerifierData({ visible: false, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
340
+  // eslint-disable-next-line max-len
341
+  setGInviteData({ visible: true, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
342
+}
343
+ // 核销
344
+ function helpInitiateRecordVerify(row) {
345
+// 关闭助力记录弹框
346
+// eslint-disable-next-line max-len
347
+  setVerifierData({ visible: true, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
348
+  // eslint-disable-next-line max-len
349
+  setGInviteData({ visible: false, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
350
+ }
351
+
171
   const publicColumns = [
352
   const publicColumns = [
172
     {
353
     {
173
       title: '发起者',
354
       title: '发起者',
196
       key: 'helpCount',
377
       key: 'helpCount',
197
       align: 'center',
378
       align: 'center',
198
       width: '15%',
379
       width: '15%',
199
-      render: (text, record) => <a style={ { color: '#66B3FF' } } >{record.helpCount}/{record.persionNumCount}</a>,
380
+      render: (text, record) => <a style={ { color: '#66B3FF' } } onClick={() => helpRecord(record)}>{record.helpCount}/{record.persionNumCount}</a>,
200
     },
381
     },
201
   ]
382
   ]
202
 
383
 
232
       key: 'helpCount',
413
       key: 'helpCount',
233
       align: 'center',
414
       align: 'center',
234
       width: '15%',
415
       width: '15%',
235
-      render: (text, record) => <a style={ { color: '#66B3FF' } } >{record.helpCount}人</a>,
416
+      render: (text, record) => <a style={ { color: '#66B3FF' } } onClick={() => helpRecord(record)}>{record.helpCount}人</a>,
236
     },
417
     },
237
     {
418
     {
238
       title: '核销状态',
419
       title: '核销状态',
256
         <>
437
         <>
257
           {row.verificationStatus === 0 &&
438
           {row.verificationStatus === 0 &&
258
           <AuthButton name="admin.SignList.get" noRight={null}>
439
           <AuthButton name="admin.SignList.get" noRight={null}>
259
-           <span style={{ color: '#1990FF', cursor: 'pointer' }}>核销</span>
440
+           <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={() => helpInitiateRecordVerify(row)}>核销</span>
260
           </AuthButton>
441
           </AuthButton>
261
         }
442
         }
262
         </>
443
         </>
297
           <Radio.Group value={customerType} onChange={radioButtonHandleSizeChange} buttonStyle="solid">
478
           <Radio.Group value={customerType} onChange={radioButtonHandleSizeChange} buttonStyle="solid">
298
             <Radio.Button value="helpSucceed">助力成功</Radio.Button>
479
             <Radio.Button value="helpSucceed">助力成功</Radio.Button>
299
             <Radio.Button value="helpUnderway">进行中</Radio.Button>
480
             <Radio.Button value="helpUnderway">进行中</Radio.Button>
300
-            <Radio.Button value="helpUnfinished ">助力失败</Radio.Button>
481
+            <Radio.Button value="helpUnfinished">助力失败</Radio.Button>
301
           </Radio.Group>
482
           </Radio.Group>
302
         </AuthButton>
483
         </AuthButton>
303
       </div>
484
       </div>
305
         <Table dataSource={dataSource.list} columns={privateColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> :
486
         <Table dataSource={dataSource.list} columns={privateColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> :
306
         <Table dataSource={dataSource.list} columns={publicColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> 
487
         <Table dataSource={dataSource.list} columns={publicColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> 
307
       }
488
       }
489
+       <InviteTable visibleData={gInviteData} />
490
+       <Verifier visibleData={gVerifierData} />
308
     </>
491
     </>
309
   );
492
   );
310
 }
493
 }

+ 5
- 0
src/services/apis.js Прегледај датотеку

709
     method: 'get',
709
     method: 'get',
710
     action: 'admin.taRole.get',
710
     action: 'admin.taRole.get',
711
   },
711
   },
712
+  helpPeopleDetails: {
713
+    url: `${prefix}/taHelpRecord/details`,
714
+    method: 'get',
715
+    action: 'admin.taRole.get',
716
+  },
712
  },
717
  },
713
  third: {
718
  third: {
714
   thirdPartyMiniapp: {
719
   thirdPartyMiniapp: {