浏览代码

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,13 +206,13 @@ const Edit = props => {
206 206
     const submitPoster = () => {
207 207
       if (helpActivityId) {
208 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 210
             message.info("保存成功")
211 211
           }).catch((err) => {
212 212
             message.info(err.msg || err.message)
213 213
           })
214 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 216
             setPosterId(data.posterId)
217 217
             message.info("保存成功")
218 218
           }).catch((err) => {
@@ -293,7 +293,7 @@ const Edit = props => {
293 293
 
294 294
     if (helpActivityId) {
295 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 297
           console.log(data, "2222")
298 298
           if (data.length > 0) {
299 299
             setShareContentId(data[0].shareContentId)
@@ -309,13 +309,13 @@ const Edit = props => {
309 309
     const submitShare = () => {
310 310
       if (helpActivityId) {
311 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 313
             message.info("保存成功")
314 314
           }).catch((err) => {
315 315
             message.info(err.msg || err.message)
316 316
           })
317 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 319
             setShareContentId(data.shareContentId)
320 320
             message.info("保存成功")
321 321
           }).catch((err) => {

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

@@ -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
 }

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

@@ -59,7 +59,7 @@ const toEditGoods = (helpActivityId) => () => {
59 59
       dataIndex: 'startDate',
60 60
       key: 'startDate',
61 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 65
       title: '已参加人数',
@@ -79,8 +79,8 @@ const toEditGoods = (helpActivityId) => () => {
79 79
       key: 'isEnlist',
80 80
       align: 'center',
81 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 84
         if (records.activityStatus === 2) { return '已结束' }
85 85
       },
86 86
     },
@@ -197,14 +197,17 @@ const toEditGoods = (helpActivityId) => () => {
197 197
 const handleSubmit = (e, props) => {
198 198
     e.preventDefault();
199 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 204
       if (!err) {
201 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 211
    function handleReset() {
209 212
     props.form.resetFields();
210 213
   }
@@ -233,16 +236,21 @@ const handleSubmit = (e, props) => {
233 236
             />,
234 237
           )}
235 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 249
         <Form.Item>
242
-          {getFieldDecorator('status')(
250
+          {getFieldDecorator('activityStatus')(
243 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 254
               <Option value="2">已结束</Option>
247 255
             </Select>,
248 256
           )}

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

@@ -755,6 +755,11 @@ export default {
755 755
     method: 'get',
756 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 764
  groupActivity: {
760 765
   list: {