魏超 5 gadus atpakaļ
vecāks
revīzija
2b8509c0ac
2 mainītis faili ar 85 papildinājumiem un 50 dzēšanām
  1. 70
    50
      src/pages/activity/groupActivity/helpRecord.jsx
  2. 15
    0
      src/services/apis.js

+ 70
- 50
src/pages/activity/groupActivity/helpRecord.jsx Parādīt failu

@@ -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, groupActivityId: '', groupStatus: ''},
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 { groupActivityId } = this.state.visibleData
30
+    this.getList({ groupActivityId: groupActivityId, groupStatus:status,  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 { groupActivityId } = this.props.visibleData
35
+    console.log("groupActivityId",this.props.visibleData);
36
+    if (this.props.visibleData.visible !== preState.visibleData.visible) {
37
+      this.getList({ ...this.props.visibleData, pageNumber: 1, pageSize: 5 })
37 38
       this.setState({ visibleData: this.props.visibleData });
38 39
     }
39 40
   }
@@ -41,16 +42,17 @@ 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, groupActivityId: '', realtyConsultant: '' } })
45 46
   }
46 47
 
47 48
   // 弹框取消按钮
48 49
   handleCancel () {
49
-    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
50
+    this.setState({ visibleData: { visible: false, groupActivityId: '', realtyConsultant: '' } })
50 51
   }
51 52
 
52 53
   getList (params) {
53
-    request({ ...apis.groupActivity.shareSuccList, params: { ...params } }).then(res => {
54
+    console.log("params",params);
55
+    request({ ...apis.groupActivity.shareChildList, params: { ...params } }).then(res => {
54 56
       this.setState({ dataSource: res })
55 57
     }).catch(err => {
56 58
       // eslint-disable-next-line no-unused-expressions
@@ -70,12 +72,30 @@ class InviteTable extends React.Component {
70 72
     this.getList({ pageNumber: pageNum, pageSize: 5 })
71 73
   }
72 74
 
75
+  exportChildRecord(params) {
76
+    request({ ...apis.groupActivity.exportShareChildRecord, responseType: 'blob', params: { ...params} })
77
+      .then(data => {
78
+        if (!data) {
79
+          return
80
+        }
81
+        const url = window.URL.createObjectURL(new Blob([data]))
82
+        const link = document.createElement('a')
83
+        link.style.display = 'none'
84
+        link.href = url
85
+        link.setAttribute('download', '拼团发起记录.xlsx')
86
+        document.body.append(link)
87
+        link.click()
88
+      }).catch(() => {
89
+
90
+      })
91
+  }
92
+
73 93
   render () {
74 94
     const columns = [
75 95
       {
76 96
         title: '用户姓名',
77
-        dataIndex: 'name',
78
-        key: 'name',
97
+        dataIndex: 'nickname',
98
+        key: 'nickname',
79 99
         align: 'center',
80 100
       },
81 101
       {
@@ -87,8 +107,8 @@ class InviteTable extends React.Component {
87 107
       },
88 108
       {
89 109
         title: '开团时间',
90
-        dataIndex: 'createDate',
91
-        key: 'createDate',
110
+        dataIndex: 'createTime',
111
+        key: 'createTime',
92 112
         align: 'center',
93 113
       },
94 114
     ]
@@ -103,6 +123,10 @@ class InviteTable extends React.Component {
103 123
           // onOk={() => this.handleOk()}
104 124
           onCancel={(e) => this.handleCancel(e)}
105 125
         >
126
+          <Button type="primary" onClick={() => this.exportChildRecord({ ...this.props.visibleData, pageNumber: 1, pageSize: 5 })} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
127
+            导出
128
+          </Button>
129
+
106 130
           <Table rowKey="independent" dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
107 131
         </Modal>
108 132
       </>
@@ -111,13 +135,8 @@ class InviteTable extends React.Component {
111 135
 }
112 136
 
113 137
 
114
-
115
-
116
-
117
-
118
-
119 138
 /**
120
- * 拼团者弹框
139
+ * 核销弹框
121 140
  */
122 141
 class Verifier extends React.Component {
123 142
   constructor(props) {
@@ -146,12 +165,13 @@ class Verifier extends React.Component {
146 165
   // 弹框确定按钮
147 166
   // eslint-disable-next-line react/sort-comp
148 167
   handleOk () {
149
-    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
168
+    // this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
150 169
   }
151 170
 
152 171
   // 弹框取消按钮
153 172
   handleCancel () {
154
-    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
173
+    // this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
174
+    this.props.onCancel();
155 175
   }
156 176
 
157 177
   getList (params) {
@@ -210,9 +230,9 @@ class Verifier extends React.Component {
210 230
  * @returns
211 231
  */
212 232
 function body(props) {
213
-  const [gInviteData, setGInviteData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
233
+  const [gInviteData, setGInviteData] = useState({ visible: false, groupActivityId : '', recordId:'',  groupStatus: ''})
214 234
 
215
-  const [gVerifierData, setVerifierData] = useState({ visible: false, customerId: '', realtyConsultant: '', helpRecordInitiateId: '' })
235
+  const [gVerifierData, setVerifierData] = useState({ visible: false, groupActivityId: '', groupStatus: '' })
216 236
 
217 237
   const { getFieldDecorator, getFieldsValue } = props.form
218 238
 
@@ -227,7 +247,7 @@ function body(props) {
227 247
 
228 248
   // 调整归属 ============  start
229 249
   // eslint-disable-next-line react-hooks/rules-of-hooks
230
-  const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
250
+  const [gVisibleData, setGVisibleData] = useState({ visible: false})
231 251
 
232 252
 
233 253
   // 变更状态 ============= end
@@ -235,7 +255,7 @@ function body(props) {
235 255
   // eslint-disable-next-line react-hooks/rules-of-hooks
236 256
   const { groupActivityId } = props.location.query
237 257
   useEffect(() => {
238
-    getList({ pageNumber: 1, pageSize: 10, status: groupStatus, groupActivityId: groupActivityId })
258
+    getList({ pageNumber: 1, pageSize: 10, groupStatus: groupStatus, groupActivityId: groupActivityId })
239 259
   }, [])
240 260
 
241 261
   
@@ -258,9 +278,9 @@ function body(props) {
258 278
   }
259 279
 
260 280
   function getList(params) {
281
+    console.log(params);
261 282
     // 网路请求
262 283
     request({ ...apis.groupActivity.shareSuccList, params: { ...params } }).then(res => {
263
-        console.log(res);
264 284
       setDataSource(res)
265 285
     }).catch(err => {
266 286
       // eslint-disable-next-line no-unused-expressions
@@ -306,18 +326,17 @@ function body(props) {
306 326
 
307 327
   // 助力成功/进行中/助力失败
308 328
   function radioButtonHandleSizeChange(e) {
309
-    setGInviteData({ visible: true, customerId: '', realtyConsultant: '' })
329
+    setGInviteData({ visible: false})
310 330
     displayNone()
311 331
 
312 332
     const { value } = e.target
313 333
     setgroupStatus(value)
314
-    // setColumns(value === 'helpSucceed' ? privateColumns : publicColumns)
315 334
     if (value == 0) { 
316 335
         console.log("success", value)
317
-        getList({ pageNumber: 1, pageSize: 10, status: value, groupActivityId }) }
336
+        getList({ pageNumber: 1, pageSize: 10, groupStatus: value, groupActivityId: groupActivityId }) }
318 337
     if (value == 1 || value == 2) {
319 338
         console.log("faile", value)
320
-         getFailList({ pageNumber: 1, pageSize: 10, status: value, groupActivityId })
339
+         getFailList({ pageNumber: 1, pageSize: 10, groupStatus: value, groupActivityId: groupActivityId })
321 340
          }
322 341
   }
323 342
 
@@ -335,16 +354,6 @@ function body(props) {
335 354
     });
336 355
   }
337 356
 
338
-  function exportCustomer () {
339
-    const fieldsValue = getFieldsValue()
340
-    request({ ...apis.customer.customerRecommendExport, responseType: 'blob', params: { ...fieldsValue, groupStatus } })
341
-      .then(response => {
342
-        download(response)
343
-      }).catch(error => {
344
-
345
-      })
346
-  }
347
-
348 357
   function download (data) {
349 358
     if (!data) {
350 359
       return
@@ -353,26 +362,36 @@ function body(props) {
353 362
     const link = document.createElement('a')
354 363
     link.style.display = 'none'
355 364
     link.href = url
356
-    link.setAttribute('download', '客户列表.xlsx')
365
+    link.setAttribute('download', '拼团列表.xlsx')
357 366
     document.body.append(link)
358 367
     link.click()
359 368
   }
360 369
 
370
+  function exportRecord () {
371
+    request({ ...apis.groupActivity.exportShareRecord, responseType: 'blob', params: {groupActivityId: groupActivityId, groupStatus: groupStatus } })
372
+      .then(response => {
373
+        download(response)
374
+      }).catch(error => {
375
+
376
+      })
377
+  }
378
+
361 379
 // 助力记录弹框
362 380
 function helpRecord(row) {
363 381
 // 关闭核销
364 382
 // eslint-disable-next-line max-len
365
-setVerifierData({ visible: false, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
383
+  setVerifierData({ visible: false, helpRecordInitiateId: row.helpRecordInitiateId})
366 384
   // eslint-disable-next-line max-len
367
-  setGInviteData({ visible: true, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
385
+  console.log("tttttttttt",row);
386
+  setGInviteData({ visible: true, groupActivityId: row.groupActivityId, groupStatus: row.status, recordId: row.recordId})
368 387
 }
369 388
  // 核销
370 389
  function helpInitiateRecordVerify(row) {
371 390
 // 关闭助力记录弹框
372 391
 // eslint-disable-next-line max-len
373
-  setVerifierData({ visible: true, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
392
+  setVerifierData({ visible: true, helpRecordInitiateId: row.helpRecordInitiateId})
374 393
   // eslint-disable-next-line max-len
375
-  setGInviteData({ visible: false, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
394
+  setGInviteData({ visible: false, helpRecordInitiateId: row.helpRecordInitiateId})
376 395
  }
377 396
 
378 397
   const publicColumns = [
@@ -463,7 +482,7 @@ setVerifierData({ visible: false, customerId: row.helpRecordInitiateId, realtyCo
463 482
         <>
464 483
           {row.verificationStatus === 0 &&
465 484
           <AuthButton name="admin.SignList.get" noRight={null}>
466
-           <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={() => helpInitiateRecordVerify(row)}>核销</span>
485
+           <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={(e) => helpInitiateRecordVerify(row)}>核销</span>
467 486
           </AuthButton>
468 487
         }
469 488
         </>
@@ -480,7 +499,7 @@ setVerifierData({ visible: false, customerId: row.helpRecordInitiateId, realtyCo
480 499
     <>
481 500
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
482 501
         <Form.Item>
483
-          {getFieldDecorator('tel')(
502
+          {getFieldDecorator('phone')(
484 503
             <Input
485 504
               prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
486 505
               placeholder="电话"
@@ -499,7 +518,7 @@ setVerifierData({ visible: false, customerId: row.helpRecordInitiateId, realtyCo
499 518
             </Button>
500 519
         </Form.Item>
501 520
       </Form>
502
-      <Button type="primary" onClick={() => exportCustomer()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
521
+      <Button type="primary" onClick={() => exportRecord()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
503 522
         导出
504 523
       </Button>
505 524
 
@@ -517,8 +536,9 @@ setVerifierData({ visible: false, customerId: row.helpRecordInitiateId, realtyCo
517 536
         <Table dataSource={dataSource.records} columns={privateColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> :
518 537
         <Table dataSource={dataSource.records} columns={publicColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> 
519 538
       }
520
-       {/* <InviteTable visibleData={gInviteData} />
521
-       <Verifier visibleData={gVerifierData} /> */}
539
+       <InviteTable visibleData={gInviteData} />
540
+       {/* 核销 */}
541
+       <Verifier visibleData={gVerifierData} />
522 542
     </>
523 543
   );
524 544
 }

+ 15
- 0
src/services/apis.js Parādīt failu

@@ -801,6 +801,21 @@ export default {
801 801
     url: `${prefix}/taShareFailAndProcessingRecord`,
802 802
     method: 'get',
803 803
     action: 'admin.taRole.get',
804
+  },
805
+  shareChildList : {
806
+    url: `${prefix}/taShareChildRecord`,
807
+    method: 'get',
808
+    action: 'admin.taRole.get',
809
+  },
810
+  exportShareChildRecord: {
811
+    url: `${prefix}/taShareChildRecord/export`,
812
+    method: 'get',
813
+    action: 'admin.taRole.get',
814
+  },
815
+  exportShareRecord: {
816
+    url: `${prefix}/taShareRecord/export`,
817
+    method: 'get',
818
+    action: 'admin.taRole.get',
804 819
   }
805 820
  },
806 821
  third: {