浏览代码

Merge branch 'v3.5' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager into v3.5

周立森 5 年前
父节点
当前提交
45e90b3bce

+ 5
- 5
src/pages/activity/helpActivity/edithelpActivity.jsx 查看文件

206
     const submitPoster = () => {
206
     const submitPoster = () => {
207
       if (helpActivityId) {
207
       if (helpActivityId) {
208
         if (posterId) {
208
         if (posterId) {
209
-          request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: helpActivityId, targetType: 'helPactivity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
209
+          request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: helpActivityId, targetType: 'helpActivity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
210
             message.info("保存成功")
210
             message.info("保存成功")
211
           }).catch((err) => {
211
           }).catch((err) => {
212
             message.info(err.msg || err.message)
212
             message.info(err.msg || err.message)
213
           })
213
           })
214
         } else {
214
         } else {
215
-          request({ ...apis.activity.addPoster, data: { targetId: helpActivityId, targetType: 'helPactivity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
215
+          request({ ...apis.activity.addPoster, data: { targetId: helpActivityId, targetType: 'helpActivity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
216
             setPosterId(data.posterId)
216
             setPosterId(data.posterId)
217
             message.info("保存成功")
217
             message.info("保存成功")
218
           }).catch((err) => {
218
           }).catch((err) => {
293
 
293
 
294
     if (helpActivityId) {
294
     if (helpActivityId) {
295
       useEffect(() => {
295
       useEffect(() => {
296
-        request({ ...apis.activity.shareContent, params: { targetId: helpActivityId, targetType: 'helPactivity' }, }).then((data) => {
296
+        request({ ...apis.activity.shareContent, params: { targetId: helpActivityId, targetType: 'helpActivity' }, }).then((data) => {
297
           console.log(data, "2222")
297
           console.log(data, "2222")
298
           if (data.length > 0) {
298
           if (data.length > 0) {
299
             setShareContentId(data[0].shareContentId)
299
             setShareContentId(data[0].shareContentId)
309
     const submitShare = () => {
309
     const submitShare = () => {
310
       if (helpActivityId) {
310
       if (helpActivityId) {
311
         if (shareContentId) {
311
         if (shareContentId) {
312
-          request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: helpActivityId, shareContentType: 'helPactivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
312
+          request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: helpActivityId, shareContentType: 'helpActivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
313
             message.info("保存成功")
313
             message.info("保存成功")
314
           }).catch((err) => {
314
           }).catch((err) => {
315
             message.info(err.msg || err.message)
315
             message.info(err.msg || err.message)
316
           })
316
           })
317
         } else {
317
         } else {
318
-          request({ ...apis.activity.addShareContent, data: { targetId: helpActivityId, shareContentType: 'helPactivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
318
+          request({ ...apis.activity.addShareContent, data: { targetId: helpActivityId, shareContentType: 'helpActivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
319
             setShareContentId(data.shareContentId)
319
             setShareContentId(data.shareContentId)
320
             message.info("保存成功")
320
             message.info("保存成功")
321
           }).catch((err) => {
321
           }).catch((err) => {

+ 58
- 66
src/pages/activity/helpActivity/helpRecord.jsx 查看文件

20
     super(props);
20
     super(props);
21
     this.state = {
21
     this.state = {
22
       dataSource: { records: [] },
22
       dataSource: { records: [] },
23
-      visibleData: { visible: false, customerId: '', realtyConsultant: '' },
23
+      visibleData: { visible: false, helpId: '', realtyConsultant: '' },
24
     }
24
     }
25
   }
25
   }
26
 
26
 
27
   // 挂载之后
27
   // 挂载之后
28
   componentDidMount () {
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
   componentDidUpdate (preProps, preState) {
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
       this.setState({ visibleData: this.props.visibleData });
38
       this.setState({ visibleData: this.props.visibleData });
38
     }
39
     }
39
   }
40
   }
41
   // 弹框确定按钮
42
   // 弹框确定按钮
42
   // eslint-disable-next-line react/sort-comp
43
   // eslint-disable-next-line react/sort-comp
43
   handleOk () {
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
   handleCancel () {
49
   handleCancel () {
49
-    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
50
+    this.setState({ visibleData: { visible: false, helpId: '', realtyConsultant: '' } })
50
   }
51
   }
51
 
52
 
52
   getList (params) {
53
   getList (params) {
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
   onChange (pageNum) {
91
   onChange (pageNum) {
70
     this.getList({ pageNumber: pageNum, pageSize: 5 })
92
     this.getList({ pageNumber: pageNum, pageSize: 5 })
104
           onCancel={(e) => this.handleCancel(e)}
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
           <Table rowKey="independent" dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
132
           <Table rowKey="independent" dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
109
         </Modal>
133
         </Modal>
110
       </>
134
       </>
114
 
138
 
115
 
139
 
116
 /**
140
 /**
117
- * 助力者弹框
141
+ * 核销弹框
118
  */
142
  */
119
 class Verifier extends React.Component {
143
 class Verifier extends React.Component {
120
   constructor(props) {
144
   constructor(props) {
121
     super(props);
145
     super(props);
122
     this.state = {
146
     this.state = {
123
       verification: { verificationCode: '' },
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
   componentDidMount () {
153
   componentDidMount () {
130
-    const { customerId } = this.state.visibleData
154
+    const { helpId } = this.state.visibleData
131
   }
155
   }
132
 
156
 
133
   componentDidUpdate (preProps, preState) {
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
   // eslint-disable-next-line react/sort-comp
165
   // eslint-disable-next-line react/sort-comp
142
   handleOk () {
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
   handleCancel () {
171
   handleCancel () {
148
-    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
172
+    this.setState({ visibleData: { visible: false, helpId: '', helpRecordInitiateId: '', verificationCode: '' } })
149
   }
173
   }
150
 
174
 
151
   // eslint-disable-next-line class-methods-use-this
175
   // eslint-disable-next-line class-methods-use-this
168
 
192
 
169
   // eslint-disable-next-line class-methods-use-this
193
   // eslint-disable-next-line class-methods-use-this
170
   verify(e) {
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
   // eslint-disable-next-line class-methods-use-this
198
   // eslint-disable-next-line class-methods-use-this
175
   verification(e) {
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
   render () {
203
   render () {
205
     return (
204
     return (
206
       <>
205
       <>
214
           onCancel={(e) => this.handleCancel(e)}
213
           onCancel={(e) => this.handleCancel(e)}
215
         >
214
         >
216
           <div><span>核销码:<input onChange={this.verify.bind(this)}/></span>
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
           </div>
217
           </div>
219
         </Modal>
218
         </Modal>
220
       </>
219
       </>
229
  * @returns
228
  * @returns
230
  */
229
  */
231
 function body(props) {
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
   const { getFieldDecorator, getFieldsValue } = props.form
236
   const { getFieldDecorator, getFieldsValue } = props.form
237
 
237
 
246
 
246
 
247
   // 调整归属 ============  start
247
   // 调整归属 ============  start
248
   // eslint-disable-next-line react-hooks/rules-of-hooks
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
   // 变更状态 ============= end
252
   // 变更状态 ============= end
276
   }
276
   }
277
 
277
 
278
   function displayNone() {
278
   function displayNone() {
279
-    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
279
+    setGVisibleData({ visible: false, helpId: '', realtyConsultant: '' })
280
   }
280
   }
281
 
281
 
282
   // 提交事件
282
   // 提交事件
306
 
306
 
307
   // 助力成功/进行中/助力失败
307
   // 助力成功/进行中/助力失败
308
   function radioButtonHandleSizeChange(e) {
308
   function radioButtonHandleSizeChange(e) {
309
-    setGInviteData({ visible: false, customerId: '', realtyConsultant: '' })
309
+    setGInviteData({ visible: false, helpId: '', realtyConsultant: '' })
310
+    setVerifierData({ visible: false, helpId: '', helpRecordInitiateId: '', verificationCode: '' })
310
     displayNone()
311
     displayNone()
311
 
312
 
312
     const { value } = e.target
313
     const { value } = e.target
355
 
356
 
356
 // 助力记录弹框
357
 // 助力记录弹框
357
 function helpRecord(row) {
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
  function helpInitiateRecordVerify(row) {
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
   const publicColumns = [
372
   const publicColumns = [
455
     },
449
     },
456
     {
450
     {
457
       title: '操作',
451
       title: '操作',
458
-      dataIndex: 'customerId',
459
-      key: 'customerId',
460
       align: 'center',
452
       align: 'center',
461
       width: '25%',
453
       width: '25%',
462
       render: (x, row) => (
454
       render: (x, row) => (
512
         <Table dataSource={dataSource.list} columns={privateColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> :
504
         <Table dataSource={dataSource.list} columns={privateColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> :
513
         <Table dataSource={dataSource.list} columns={publicColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> 
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
 }

+ 21
- 13
src/pages/activity/helpActivity/list.jsx 查看文件

59
       dataIndex: 'startDate',
59
       dataIndex: 'startDate',
60
       key: 'startDate',
60
       key: 'startDate',
61
       align: 'center',
61
       align: 'center',
62
-      render: (x, row) => <><span>{`${moment(row.startDate).format('YYYY-MM-DD')} —— ${moment(row.endDate).format('YYYY-MM-DD')}`}</span></>
62
+      render: (x, row) => <><span>{`${moment(row.startDate).format('YYYY-MM-DD HH:mm')} —— ${moment(row.endDate).format('YYYY-MM-DD HH:mm')}`}</span></>,
63
     },
63
     },
64
     {
64
     {
65
       title: '已参加人数',
65
       title: '已参加人数',
79
       key: 'isEnlist',
79
       key: 'isEnlist',
80
       align: 'center',
80
       align: 'center',
81
       render: (text, records) => {
81
       render: (text, records) => {
82
-        if (records.activityStatus === 0) { return '未开始' }
83
-        if (records.activityStatus === 1) { return '进行中' }
82
+        if (records.activityStatus === 1) { return '未开始' }
83
+        if (records.activityStatus === 0) { return '进行中' }
84
         if (records.activityStatus === 2) { return '已结束' }
84
         if (records.activityStatus === 2) { return '已结束' }
85
       },
85
       },
86
     },
86
     },
197
 const handleSubmit = (e, props) => {
197
 const handleSubmit = (e, props) => {
198
     e.preventDefault();
198
     e.preventDefault();
199
     props.form.validateFields((err, values) => {
199
     props.form.validateFields((err, values) => {
200
+      const startDate = values.startTime === undefined ? null : moment(values.startTime).format('YYYY-MM-DD')
201
+      const endDate = values.endTime === undefined ? null : moment(values.endTime).format('YYYY-MM-DD')
202
+      // 删除时间会传默认值 Invalid date
203
+
200
       if (!err) {
204
       if (!err) {
201
         console.log('提交数据: ', values)
205
         console.log('提交数据: ', values)
202
-        getList({ pageNum: 1, pageSize: 10, ...values })
206
+        getList({ pageNum: 1, pageSize: 10, ...values, endDate, startDate })
203
       }
207
       }
204
     });
208
     });
205
   }
209
   }
206
-
207
-   //重置搜索
210
+   // 重置搜索
208
    function handleReset() {
211
    function handleReset() {
209
     props.form.resetFields();
212
     props.form.resetFields();
210
   }
213
   }
233
             />,
236
             />,
234
           )}
237
           )}
235
         </Form.Item>
238
         </Form.Item>
236
-        {/* <Form.Item>
237
-          {getFieldDecorator('time')(
238
-            <DatePicker />
239
+        <Form.Item>
240
+          {getFieldDecorator('startTime')(
241
+            <DatePicker placeholder="活动开始时间"/>,
239
           )}
242
           )}
240
-        </Form.Item> */}
243
+        </Form.Item>
244
+        <Form.Item>
245
+          {getFieldDecorator('endTime')(
246
+            <DatePicker placeholder="活动结束时间"/>,
247
+          )}
248
+        </Form.Item>
241
         <Form.Item>
249
         <Form.Item>
242
-          {getFieldDecorator('status')(
250
+          {getFieldDecorator('activityStatus')(
243
             <Select style={{ width: '180px' }} placeholder="活动状态">
251
             <Select style={{ width: '180px' }} placeholder="活动状态">
244
-              <Option value="0">未开始</Option>
245
-              <Option value="1">进行中</Option>
252
+              <Option value="1">未开始</Option>
253
+              <Option value="0">进行中</Option>
246
               <Option value="2">已结束</Option>
254
               <Option value="2">已结束</Option>
247
             </Select>,
255
             </Select>,
248
           )}
256
           )}

+ 5
- 0
src/services/apis.js 查看文件

755
     method: 'get',
755
     method: 'get',
756
     action: 'admin.taRole.get',
756
     action: 'admin.taRole.get',
757
   },
757
   },
758
+  gethelpRecordExport: {
759
+    url: `${prefix}/helpRecord/export`,
760
+    method: 'get',
761
+    action: 'admin.taRole.get',
762
+  },
758
  },
763
  },
759
  groupActivity: {
764
  groupActivity: {
760
   list: {
765
   list: {