dingxin 5 anos atrás
pai
commit
7338a65533

+ 17
- 0
config/routes.js Ver arquivo

@@ -263,6 +263,23 @@ export default [
263 263
                 hideInMenu: true,
264 264
                 component: './activity/SignList',
265 265
               },
266
+              {
267
+                path: '/activity/helpActivity/list',
268
+                name: '助力活动',
269
+                component: './activity/helpActivity/list',
270
+              },
271
+              {
272
+                path: '/activity/helpActivity/helpRecord',
273
+                name: '助力记录',
274
+                hideInMenu: true,
275
+                component: './activity/helpActivity/helpRecord',
276
+              },
277
+              {
278
+                path: '/activity/helpActivity/edithelpActivity',
279
+                name: '新增',
280
+                hideInMenu: true,
281
+                component: './activity/helpActivity/edithelpActivity',
282
+              },
266 283
             ],
267 284
           },
268 285
           {

+ 365
- 0
src/pages/activity/helpActivity/edithelpActivity.jsx Ver arquivo

@@ -0,0 +1,365 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../../style/GoodsList.less';
5
+import apis from '../../../services/apis';
6
+import moment from 'moment';
7
+import router from 'umi/router';
8
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
9
+import XForm, { FieldTypes } from '../../../components/XForm';
10
+import Wangedit from '../../../components/Wangedit/Wangedit'
11
+import request from '../../../utils/request'
12
+import yinhao from '../../../assets/yinhao.png'
13
+import ImageUploader from '../../../components/XForm/ImageUpload';
14
+import logo from '../../../assets/logo.png';
15
+import touxiang from '../../../assets/touxiang.jpg';
16
+import poster1 from '../../../assets/poster1.png';
17
+import poster2 from '../../../assets/poster2.png';
18
+import xiaochengxu from '../../../assets/xiaochengxu.png'
19
+
20
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
21
+const { TextArea } = Input;
22
+
23
+/**
24
+ *
25
+ *
26
+ * @param {*} props
27
+ * @returns
28
+ */
29
+const Edit = props => {
30
+  const [tab, changeTab] = useState('basic')
31
+  // 判断是否展示助力次数的输入框
32
+  // const [help, helpTab] = useState('1')
33
+  const { dynamicId } = props.location.query
34
+  const [dynamicData, setDynamicData] = useState({})
35
+  if (dynamicId) {
36
+    // eslint-disable-next-line react-hooks/rules-of-hooks
37
+    useEffect(() => {
38
+      // eslint-disable-next-line no-use-before-define
39
+      getDynamicData(dynamicId);
40
+    }, [])
41
+
42
+    // 查询列表
43
+    const getDynamicData = (dynamicId) => {
44
+      request({ ...apis.activity.details, params: { dynamicId } }).then((data) => {
45
+        console.log(data)
46
+        setDynamicData(data)
47
+      })
48
+    }
49
+  }
50
+
51
+  const cancelPage = () => {
52
+    router.push({
53
+      pathname: '/activity/ActivityList',
54
+    });
55
+  }
56
+
57
+  const Basic = props => {
58
+    const fields = [
59
+      {
60
+        label: '选择项目',
61
+        name: 'buildingId',
62
+        render: <BuildSelect />,
63
+        value: dynamicData.buildingId,
64
+        rules: [
65
+          { required: true, message: '请选择项目' },
66
+        ]
67
+      },
68
+      {
69
+        label: '活动标题',
70
+        name: 'title',
71
+        type: FieldTypes.Text,
72
+        value: dynamicData.title,
73
+        rules: [
74
+          { required: true, message: '请输入活动标题' },
75
+        ]
76
+      },
77
+      {
78
+        label: '活动主图',
79
+        name: 'img',
80
+        type: FieldTypes.ImageUploader,
81
+        value: dynamicData.img,
82
+        help: '建议图片尺寸:750px*560px',
83
+      },
84
+      {
85
+        label: '活动时间',
86
+        name: 'activityTime',
87
+        type: FieldTypes.RangePicker,
88
+        value: dynamicData.startDate != null ? [moment(dynamicData.startDate, 'YYYY-MM-DD HH:mm'), moment(dynamicData.endDate, 'YYYY-MM-DD HH:mm')] : null,
89
+        props: { showTime: { format: 'HH:mm' } },
90
+        rules: [
91
+          { required: true, message: '请选择活动时间' },
92
+        ],
93
+      },
94
+      {
95
+        label: '助力邀请人数',
96
+        name: 'personNum',
97
+        type: FieldTypes.Text,
98
+        value: dynamicData.persionNum,
99
+        rules: [
100
+          { required: true, message: '请输入活动人数' },
101
+        ]
102
+      },
103
+      {
104
+        label: '助力次数',
105
+        name: 'maxEnlistByPerson',
106
+        type: FieldTypes.Text,
107
+        value: dynamicData.helpNum,
108
+        rules: [
109
+          { required: true, message: '请选择是否助力' },
110
+        ],
111
+        render: <Radio.Group name="radiogroup">
112
+        <Radio value={1}>不限制</Radio>
113
+        <Radio value={0}>次数限制</Radio>
114
+      </Radio.Group>,
115
+      },
116
+      {
117
+        label: ' ',
118
+        name: 'personNum',
119
+        type: FieldTypes.Text,
120
+        value: dynamicData.personNum,
121
+        rules: [
122
+          { required: true, message: '请输入次数' },
123
+        ],
124
+      },
125
+      {
126
+        label: '活动说明',
127
+        name: 'activityInstructions',
128
+        type: FieldTypes.ImageUploader,
129
+        value: dynamicData.activityInstructions,
130
+        help: '建议图片尺寸:750px*560px',
131
+      },
132
+    ]
133
+
134
+    const handleSubmit = val => {
135
+      const { activityTime, signupTime, ...submitValue } = val
136
+      console.log('val', val)
137
+      const [startDate, endDate] = activityTime
138
+      submitValue.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
139
+      submitValue.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
140
+      // const [enlistStart, enlistEnd] = signupTime
141
+      // submitValue.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
142
+      // submitValue.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
143
+      console.log('submit data --->', submitValue)
144
+      // if (dynamicId) {
145
+      //   submitValue.dynamicId = dynamicId
146
+      //   request({ ...apis.activity.update, data: submitValue }).then((data) => {
147
+      //     message.info("保存成功")
148
+      //     cancelPage()
149
+      //   }).catch((err) => {
150
+      //     message.info(err.msg || err.message)
151
+      //   })
152
+      // } else {
153
+      //   request({ ...apis.activity.add, data: submitValue }).then((data) => {
154
+      //     message.info("保存成功")
155
+      //     cancelPage()
156
+      //   }).catch((err) => {
157
+      //     message.info(err.msg || err.message)
158
+      //   })
159
+      // }
160
+    }
161
+
162
+    return <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
163
+  }
164
+
165
+  const Poster = (props) => {
166
+    const [inputValue, changeInput] = useState('')
167
+    const [textAreaValue, changeTextArea] = useState('')
168
+    const [imgValue, changeImg] = useState('')
169
+    const [posterId, setPosterId] = useState('')
170
+
171
+    if (dynamicId) {
172
+      console.log(dynamicId, 'dynamicId')
173
+      useEffect(() => {
174
+        request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then((data) => {
175
+          console.log(data, "2222")
176
+          if (data.length > 0) {
177
+            setPosterId(data[0].posterId)
178
+            changeImg(data[0].posterImg)
179
+            changeTextArea(data[0].posterDescription)
180
+            changeInput(data[0].posterTitle)
181
+          }
182
+        }).catch((err) => {
183
+          message.info(err.msg || err.message)
184
+        })
185
+        getMiniappName()
186
+      }, [])
187
+    }else{
188
+      getMiniappName()
189
+    }
190
+    // 获取小程序名称
191
+    const [miniappName, setMiniappName] = useState('')
192
+    function getMiniappName() {
193
+      request({ ...apis.building.getMiniappName }).then(res => {
194
+        console.log(res, "0000000000000")
195
+        setMiniappName(res)
196
+      })
197
+    }
198
+
199
+    const submitPoster = () => {
200
+      if (dynamicId) {
201
+        if (posterId) {
202
+          request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
203
+            message.info("保存成功")
204
+          }).catch((err) => {
205
+            message.info(err.msg || err.message)
206
+          })
207
+        } else {
208
+          request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
209
+            setPosterId(data.posterId)
210
+            message.info("保存成功")
211
+          }).catch((err) => {
212
+            message.info(err.msg || err.message)
213
+          })
214
+        }
215
+      } else {
216
+        message.warn("请先保存基本信息数据")
217
+      }
218
+    }
219
+
220
+    return <div>
221
+      <div style={{ display: 'flex' }}>
222
+        <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
223
+          <div style={{ width: '375px', height: '700px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
224
+            <img style={{ width: '100%', height: '300px' }} src={imgValue ? imgValue : poster1} alt="" />
225
+            <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
226
+              <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
227
+              <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
228
+              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您阅读</span>
229
+              <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
230
+            </div>
231
+            <p style={{
232
+              margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
233
+              display: '-webkit-box', lineClamp: '3', height: '60px',
234
+              WebkitLineClamp: '2',
235
+              WebkitBoxOrient: 'vertical',
236
+              overflow: 'hidden',
237
+              textOverflow: 'ellipsis'
238
+            }}>{inputValue ? inputValue : '海报标题'}</p>
239
+
240
+            <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
241
+            <p style={{
242
+              margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
243
+              display: '-webkit-box', lineClamp: '3', height: '72px',
244
+              WebkitLineClamp: '3',
245
+              WebkitBoxOrient: 'vertical',
246
+              overflow: 'hidden',
247
+              textOverflow: 'ellipsis'
248
+            }}>{textAreaValue ? textAreaValue : '海报描述'}</p>
249
+            <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc', position: 'relative' }}>
250
+              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
251
+              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入<span style={{ margin: '0 5px', fontSize: '18px', color: '#333', fontWeight: '600' }}>{miniappName || '置业V顾问'}</span>报名活动</p>
252
+              <img style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }} src={xiaochengxu} alt="" />
253
+            </div>
254
+          </div>
255
+          <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
256
+        </div>
257
+
258
+        <div >
259
+          <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
260
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片1</p>
261
+            <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
262
+          </div>
263
+          <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
264
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题1</p>
265
+            <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
266
+          </div>
267
+          <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
268
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述1</p>
269
+            <TextArea rows={5} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
270
+          </div>
271
+
272
+        </div>
273
+      </div>
274
+      <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
275
+      <Button onClick={() => router.go(-1)}>取消</Button>
276
+    </div>
277
+
278
+  }
279
+
280
+
281
+
282
+  const Share = (props) => {
283
+    const [inputValue, changeInput] = useState('')
284
+    const [imgValue, changeImg] = useState('')
285
+    const [shareContentId, setShareContentId] = useState('')
286
+
287
+    if (dynamicId) {
288
+      useEffect(() => {
289
+        request({ ...apis.activity.shareContent, params: { targetId: dynamicId, targetType: 'activity' }, }).then((data) => {
290
+          console.log(data, "2222")
291
+          if (data.length > 0) {
292
+            setShareContentId(data[0].shareContentId)
293
+            changeImg(data[0].shareContentImg)
294
+            changeInput(data[0].shareContentTitle)
295
+          }
296
+        }).catch((err) => {
297
+          message.info(err.msg || err.message)
298
+        })
299
+      }, [])
300
+    }
301
+
302
+    const submitShare = () => {
303
+      if (dynamicId) {
304
+        if (shareContentId) {
305
+          request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
306
+            message.info("保存成功")
307
+          }).catch((err) => {
308
+            message.info(err.msg || err.message)
309
+          })
310
+        } else {
311
+          request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
312
+            setShareContentId(data.shareContentId)
313
+            message.info("保存成功")
314
+          }).catch((err) => {
315
+            message.info(err.msg || err.message)
316
+          })
317
+        }
318
+      } else {
319
+        message.warn("请先保存基本信息数据")
320
+      }
321
+    }
322
+
323
+    return <div style={{ padding: '20px' }}>
324
+      <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
325
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板1</p>
326
+        <div>
327
+          <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}><img src={logo} style={{ width: '22px', marginRight: '10px' }} />知与行互动</p>
328
+          <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '置业V客厅 精准获客平台'}</p>
329
+          <img style={{ width: '200px', height: '140px' }} src={imgValue ? imgValue : poster2} alt="" />
330
+        </div>
331
+      </div>
332
+      <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
333
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题1</p>
334
+        <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
335
+      </div>
336
+      <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
337
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片1</p>
338
+        <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
339
+      </div>
340
+      <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
341
+      <Button onClick={() => router.go(-1)}>取消</Button>
342
+    </div>
343
+  }
344
+
345
+  return (
346
+    <div>
347
+      <div>
348
+        <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
349
+          <Radio.Button value="basic">基本信息1</Radio.Button>
350
+          <Radio.Button value="poster">海报图片1</Radio.Button>
351
+          <Radio.Button value="share">分享设置1</Radio.Button>
352
+        </Radio.Group>
353
+      </div>
354
+      <div>
355
+        {tab === 'basic' && <Basic />}
356
+        {tab === 'poster' && <Poster />}
357
+        {tab === 'share' && <Share />}
358
+      </div>
359
+    </div>
360
+  );
361
+}
362
+
363
+
364
+
365
+export default Edit

+ 330
- 0
src/pages/activity/helpActivity/helpRecord.jsx Ver arquivo

@@ -0,0 +1,330 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../utils/request';
5
+import apis from '../../../services/apis';
6
+import router from 'umi/router';
7
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
8
+import AuthButton from '@/components/AuthButton';
9
+
10
+
11
+const { Option } = Select;
12
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
13
+const { Meta } = Card;
14
+
15
+/**
16
+ *
17
+ *
18
+ * @param {*} props
19
+ * @returns
20
+ */
21
+function body(props) {
22
+  const { getFieldDecorator, getFieldsValue } = props.form
23
+
24
+  // eslint-disable-next-line react-hooks/rules-of-hooks
25
+  const [dataSource, setDataSource] = useState({ records: [] })
26
+  // eslint-disable-next-line react-hooks/rules-of-hooks
27
+  // const [columns, setColumns] = useState(privateColumns)
28
+
29
+  // 默认私客
30
+  // eslint-disable-next-line react-hooks/rules-of-hooks
31
+  const [customerType, setCustomerType] = useState('private')
32
+
33
+  // 调整归属 ============  start
34
+  // eslint-disable-next-line react-hooks/rules-of-hooks
35
+  const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
36
+  // 调整归属 ============= end
37
+
38
+  // 积分记录 ============  start
39
+  // eslint-disable-next-line react-hooks/rules-of-hooks
40
+  const [recordVisibleData, setRecordVisibleData] = useState({ visible: false, customerId: '' })
41
+  // 积分记录 ============= end
42
+
43
+  // 变更状态 ============  start
44
+  // eslint-disable-next-line react-hooks/rules-of-hooks
45
+  const [statusVisibleData, setStatusVisibleData] = useState({ visible: false, customerId: '', status: '' })
46
+  // 变更状态 ============= end
47
+
48
+  // eslint-disable-next-line react-hooks/rules-of-hooks
49
+  useEffect(() => {
50
+    getList({ pageNumber: 1, pageSize: 10, customerType })
51
+  }, [])
52
+
53
+  function getList(params) {
54
+    // 网路请求
55
+    request({ ...apis.customer.customerRecommend, params: { ...params } }).then(res => {
56
+      setDataSource(res)
57
+    }).catch(err => {
58
+      // eslint-disable-next-line no-unused-expressions
59
+      <Alert
60
+        style={{
61
+          marginBottom: 24,
62
+        }}
63
+        message={err}
64
+        type="error"
65
+        showIcon
66
+      />
67
+    })
68
+  }
69
+
70
+  function displayNone() {
71
+    setRecordVisibleData({ visible: false, customerId: '' })
72
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
73
+    setStatusVisibleData({ visible: false, customerId: '', status: '' })
74
+  }
75
+
76
+  // 提交事件
77
+  function handleSubmit(e) {
78
+    displayNone()
79
+
80
+
81
+    e.preventDefault();
82
+    props.form.validateFields((err, values) => {
83
+      if (!err) {
84
+        getList({ pageNum: 1, pageSize: 10, customerType, ...values })
85
+      }
86
+    });
87
+  }
88
+
89
+  // Change 事件
90
+  function handleSelectChange(e) {
91
+    // eslint-disable-next-line no-console
92
+    console.log(e)
93
+  }
94
+
95
+  // 分页
96
+  function onChange(pageNum) {
97
+    // eslint-disable-next-line react-hooks/rules-of-hooks
98
+    getList({ pageNumber: pageNum, pageSize: 10, customerType })
99
+  }
100
+
101
+  // 私客/公客切换
102
+  function radioButtonHandleSizeChange(e) {
103
+    displayNone()
104
+
105
+    const { value } = e.target
106
+    setCustomerType(value)
107
+    //setColumns(value === 'private' ? privateColumns : publicColumns)
108
+    getList({ pageNumber: 1, pageSize: 10, customerType: value })
109
+  }
110
+
111
+  function handleReset() {
112
+    props.form.resetFields();
113
+    getList({ pageNumber: 1, pageSize: 10, customerType })
114
+  }
115
+
116
+
117
+  // 这里有个 Bug, 就是 Modal 弹框,会联动出现, 比如 我点击 调整归属的Model弹框, 那么 积分记录的Model弹框莫名其妙的也显示了
118
+  // 所有这里临时解决方法是,弹出一个Modal对话框的时候,把其他的对话框给隐藏
119
+
120
+  function showGM(record) {
121
+    setGVisibleData({ visible: true, customerId: record.customerId, realtyConsultant: record.realtyConsultant })
122
+    setRecordVisibleData({ visible: false, customerId: '' })
123
+    setStatusVisibleData({ visible: false, customerId: '' })
124
+  }
125
+
126
+  function showRecord(record) {
127
+    setRecordVisibleData({ visible: true, customerId: record.customerId })
128
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
129
+    setStatusVisibleData({ visible: false, customerId: '' })
130
+  }
131
+
132
+  function showStatus(record) {
133
+    setRecordVisibleData({ visible: false, customerId: '' })
134
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
135
+    setStatusVisibleData({ visible: true, customerId: record.customerId, status: record.status })
136
+  }
137
+  function toCustomerDateil(record) {
138
+    router.push({
139
+      pathname: '/customer/customerlist/customerDetail',
140
+      query: {
141
+        id: record.customerId,
142
+      },
143
+    });
144
+  }
145
+
146
+  function exportCustomer () {
147
+    const fieldsValue = getFieldsValue()
148
+    request({ ...apis.customer.customerRecommendExport, responseType: 'blob', params: { ...fieldsValue, customerType } })
149
+      .then(response => {
150
+        download(response)
151
+      }).catch(error => {
152
+
153
+      })
154
+  }
155
+
156
+  function download (data) {
157
+    if (!data) {
158
+      return
159
+    }
160
+    const url = window.URL.createObjectURL(new Blob([data]))
161
+    const link = document.createElement('a')
162
+    link.style.display = 'none'
163
+    link.href = url
164
+    link.setAttribute('download', '客户列表.xlsx')
165
+    document.body.append(link)
166
+    link.click()
167
+  }
168
+
169
+  const publicColumns = [
170
+    {
171
+      title: '头像',
172
+      dataIndex: 'picture',
173
+      key: 'picture',
174
+      align: 'center',
175
+      width: '15%',
176
+      render: (_, record) => <Avatar shape="square" src={customerType === 'private' ? record.picture : record.avatarurl} size={64} icon="user" />,
177
+    },
178
+    {
179
+      title: '姓名',
180
+      dataIndex: 'name',
181
+      key: 'name',
182
+      align: 'center',
183
+      width: '10%',
184
+      // eslint-disable-next-line no-nested-ternary
185
+      render: (_, record) => <><span>{customerType === 'private' ? record.name : record.nickname}</span></>,
186
+    },
187
+    {
188
+      title: '电话',
189
+      dataIndex: 'phone',
190
+      key: 'phone',
191
+      align: 'center',
192
+      width: '15%',
193
+    },
194
+    {
195
+      title: '推广人员',
196
+      dataIndex: 'sharePersonName',
197
+      key: 'sharePersonName',
198
+      align: 'center',
199
+      width: '15%',
200
+    },
201
+  ]
202
+
203
+  const privateColumns = [
204
+    {
205
+      title: '头像',
206
+      dataIndex: 'picture',
207
+      key: 'picture',
208
+      align: 'center',
209
+      width: '15%',
210
+      render: (_, record) => <Avatar shape="square" src={customerType === 'private' ? record.picture : record.avatarurl} size={64} icon="user" />,
211
+    },
212
+    {
213
+      title: '姓名',
214
+      dataIndex: 'name',
215
+      key: 'name',
216
+      align: 'center',
217
+      width: '10%',
218
+      // eslint-disable-next-line no-nested-ternary
219
+      render: (_, record) => <><span>{customerType === 'private' ? record.name : record.nickname}</span></>,
220
+    },
221
+    {
222
+      title: '电话',
223
+      dataIndex: 'phone',
224
+      key: 'phone',
225
+      align: 'center',
226
+      width: '15%',
227
+    },
228
+    {
229
+      title: '性别',
230
+      dataIndex: 'sex',
231
+      key: 'sex',
232
+      align: 'center',
233
+      width: '10%',
234
+      // eslint-disable-next-line no-nested-ternary
235
+      render: (_, record) => <><span>{record.sex === 1 ? '男' : record.sex === 2 ? '女' : '未知'}</span></>,
236
+    },
237
+    {
238
+      title: '置业顾问',
239
+      dataIndex: 'consultantName',
240
+      key: 'consultantName',
241
+      align: 'center',
242
+      width: '15%',
243
+      // eslint-disable-next-line no-nested-ternary
244
+      render: (_, record) => (
245
+        <>
246
+          <span>{record.consultantName}</span>
247
+          <br />
248
+          <span>{record.consultTel}</span>
249
+        </>
250
+      ),
251
+    },
252
+    {
253
+      title: '推广人员',
254
+      dataIndex: 'sharePersonName',
255
+      key: 'sharePersonName',
256
+      align: 'center',
257
+      width: '15%',
258
+    },
259
+    {
260
+      title: '客户状态',
261
+      dataIndex: 'reportRecommendStatus',
262
+      key: 'reportRecommendStatus',
263
+      align: 'center',
264
+      width: '10%',
265
+      // eslint-disable-next-line no-nested-ternary
266
+      render: (text, records) => {
267
+        if (records.status === 1) { return '报备' }
268
+        if (records.status === 2) { return '到访' }
269
+        if (records.status === 3) { return '认筹' }
270
+        if (records.status === 4) { return '签约' }
271
+      },
272
+    },
273
+    {
274
+      title: '操作',
275
+      dataIndex: 'customerId',
276
+      key: 'customerId',
277
+      align: 'center',
278
+      width: '25%',
279
+      // eslint-disable-next-line no-nested-ternary
280
+    },
281
+  ]
282
+
283
+  return (
284
+    <>
285
+    {console.log('customerType', customerType)}
286
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
287
+        <Form.Item>
288
+          {getFieldDecorator('tel')(
289
+            <Input
290
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
291
+              placeholder="电话"
292
+            />,
293
+          )}
294
+        </Form.Item>
295
+        <Form.Item>
296
+            <Button type="primary" htmlType="submit" >
297
+              查询
298
+            </Button>
299
+            <Button style={{ marginLeft: 8 }} onClick={handleReset}>
300
+              重置
301
+            </Button>
302
+            <Button style={{ marginLeft: 8 }} onClick={handleReset}>
303
+              返回
304
+            </Button>
305
+        </Form.Item>
306
+      </Form>
307
+      <Button type="primary" onClick={() => exportCustomer()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
308
+        导出
309
+      </Button>
310
+
311
+      <div style={{ margin: '20px 0'}}>
312
+        <AuthButton name="admin.customer.recommend.get" noRight={null}>
313
+          <Radio.Group value={customerType} onChange={radioButtonHandleSizeChange} buttonStyle="solid">
314
+            <Radio.Button value="private">助力成功</Radio.Button>
315
+            <Radio.Button value="public">进行中</Radio.Button>
316
+            <Radio.Button value="error ">助力失败</Radio.Button>
317
+          </Radio.Group>
318
+        </AuthButton>
319
+      </div>
320
+      {customerType === 'private' ? 
321
+        <Table dataSource={dataSource.records} columns={privateColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> :
322
+        <Table dataSource={dataSource.records} columns={publicColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> 
323
+      }
324
+    </>
325
+  );
326
+}
327
+
328
+const WrappedBody = Form.create({ name: 'body' })(body);
329
+
330
+export default WrappedBody

+ 261
- 0
src/pages/activity/helpActivity/list.jsx Ver arquivo

@@ -0,0 +1,261 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../../style/GoodsList.less';
5
+import router from 'umi/router';
6
+import moment from 'moment';
7
+import SelectCity from '../../../components/SelectButton/CitySelect'
8
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
9
+import apis from '../../../services/apis';
10
+import request from '../../../utils/request';
11
+import AuthButton from '@/components/AuthButton';
12
+
13
+const { Option } = Select;
14
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
15
+
16
+const header = (props) => {
17
+  const [ data, setData ] = useState({})
18
+//   const [page, changePage] = useState({})
19
+
20
+  useEffect(() => {
21
+    getList({ pageNum: 1, pageSize: 10 });
22
+  },[])
23
+
24
+  // 查询列表
25
+  const getList = (params) => {
26
+    request({ ...apis.helpActivity.list, params: { ...params } }).then((data) => {
27
+        console.log(data)
28
+        setData(data)
29
+    })
30
+  }
31
+
32
+  
33
+// 跳转到助力新增
34
+const toEditGoods = (dynamicId) => () => {
35
+    router.push({
36
+      pathname: '/activity/helpActivity/edithelpActivity',
37
+      query: {
38
+        dynamicId
39
+      },
40
+    });
41
+  }
42
+  
43
+  /**
44
+   *
45
+   *
46
+   * @param {*} props
47
+   * @returns
48
+   */
49
+  
50
+  const columns = [
51
+    {
52
+      title: '活动标题',
53
+      dataIndex: 'title',
54
+      key: 'title',
55
+      align: 'center',
56
+    },
57
+    {
58
+      title: '活动时间',
59
+      dataIndex: 'startDate',
60
+      key: 'startDate',
61
+      align: 'center',
62
+      render: (x, row) => <><span>{`${moment(row.startDate).format('YYYY-MM-DD')} —— ${moment(row.endDate).format('YYYY-MM-DD')}`}</span></>
63
+    },
64
+    {
65
+      title: '已参加人数',
66
+      dataIndex: 'enlistNum',
67
+      key: 'enlistNum',
68
+      align: 'center',
69
+    },
70
+    {
71
+      title: '助力成功数',
72
+      dataIndex: 'persionNum',
73
+      key: 'persionNum',
74
+      align: 'center',
75
+    },  
76
+    {
77
+      title: '状态',
78
+      dataIndex: 'isEnlist',
79
+      key: 'isEnlist',
80
+      align: 'center',
81
+      render: (text, records) => {
82
+        if (records.status === 0) { return '未开始' }
83
+        if (records.status === 1) { return '进行中' }
84
+        if (records.status === 2) { return '已结束' }
85
+      },
86
+    },
87
+    {
88
+      title: '操作',
89
+      dataIndex: 'handle',
90
+      key: 'handle',
91
+      align: 'center',
92
+      render: (x,row) => (
93
+        <>
94
+          <AuthButton name="admin.SignList.get" noRight={null}>
95
+            <span style={{ color: '#1990FF', cursor: 'pointer'}} onClick={getSignList.bind(this, row.dynamicId)}>{row.isEnlist == '1' || row.isEnlist == '2' ? "助力记录" : ""}<Icon type="snippets" className={styles.shoppingCart} /></span>
96
+          </AuthButton>
97
+          <AuthButton name="admin.buildingDynamic.send.dynamicId.put" noRight={null}>
98
+            <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={sendOrPublicDynamic.bind(this,row)}>{ row.status === 1 ? '取消发布' : '发布' }<Icon type="close-circle" className={styles.edit} /></span>
99
+          </AuthButton>
100
+          <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
101
+            {row.isEnlist != 2 && <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={finishDynamic.bind(this,row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>}
102
+          </AuthButton>
103
+          <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
104
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
105
+            {row.isEnlist != 2 && <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditGoods(row.dynamicId)}>编辑<Icon type="form" className={styles.edit} /></span>}
106
+          </AuthButton>
107
+        </>
108
+      )
109
+    },
110
+  ];
111
+  
112
+  const getSignList = (dynamicId) => {
113
+      router.push({
114
+          pathname: '/activity/helpActivity/helpRecord',
115
+          query: {
116
+              dynamicId
117
+          },
118
+        });
119
+  }
120
+  
121
+  const finishDynamic = (row) => {
122
+      Modal.confirm({
123
+          title: '结束以后将无法编辑, 是否继续?',
124
+          okText: '确定',
125
+          cancelText: '取消',
126
+          onOk() {
127
+              request({ ...apis.activity.finish, data: {dynamicId: row.dynamicId, top: ""} }).then((data) => {
128
+                  console.log(data)
129
+                  message.info('操作成功!')
130
+                  getList({ pageNum: 1, pageSize: 10 })
131
+              }).catch((err) => {
132
+                  console.log(err)
133
+                  message.info(err.msg || err.message)
134
+              })
135
+          },
136
+        });
137
+  }
138
+  
139
+//   置顶
140
+  const topDynamic = (row) => () => {
141
+      const weight = Math.abs(row.weight - 1)
142
+      request({ ...apis.activity.weight, params: {dynamicId: row.dynamicId, weight} }).then((data) => {
143
+          console.log(data)
144
+          message.info('操作成功!')
145
+          getList({ pageNum: 1, pageSize: 10 })
146
+      }).catch((err) => {
147
+          console.log(err)
148
+          message.info(err.msg || err.message)
149
+      })
150
+  }
151
+  
152
+  const sendOrPublicDynamic = (row) => {
153
+      if (row.status === 1) {
154
+          cancelDynamic(row)
155
+      } else {
156
+          sendDynamic(row)
157
+      }
158
+  }
159
+  
160
+  // 取消活动
161
+  const cancelDynamic = (row) => {
162
+      request({ ...apis.activity.cancel, urlData: {id: row.dynamicId}}).then((data) => {
163
+          message.info('操作成功!')
164
+          getList({ pageNum: 1, pageSize: 10 })
165
+      }).catch((err) => {
166
+          console.log(err)
167
+          message.info(err.msg || err.message)
168
+      })
169
+  }
170
+  
171
+  //发布活动
172
+  const sendDynamic = (row) => {
173
+      request({ ...apis.activity.send, urlData: {id: row.dynamicId}}).then((data) => {
174
+          message.info('操作成功!')
175
+          getList({ pageNum: 1, pageSize: 10 });
176
+      }).catch(err => {
177
+          console.log(err)
178
+          message.info(err.msg || err.message)
179
+      })
180
+  }
181
+  
182
+  const changePageNum = pageNumber => {
183
+      getList({ pageNum: pageNumber, pageSize: 10 })
184
+  }
185
+
186
+  // 提交事件
187
+const handleSubmit = (e, props) => {
188
+    e.preventDefault();
189
+    props.form.validateFields((err, values) => {
190
+      if (!err) {
191
+        console.log('提交数据: ', values)
192
+        getList({ pageNum: 1, pageSize: 10, ...values })
193
+      }
194
+    });
195
+  }
196
+
197
+   //重置搜索
198
+   function handleReset() {
199
+    props.form.resetFields();
200
+  }
201
+
202
+
203
+  const { getFieldDecorator } = props.form
204
+  return (
205
+
206
+    <>
207
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
208
+        <Form.Item>
209
+          {getFieldDecorator('cityId')(
210
+            <SelectCity />,
211
+          )}
212
+        </Form.Item>
213
+        <Form.Item>
214
+          {getFieldDecorator('buildingId')(
215
+            <BuildSelect />,
216
+          )}
217
+        </Form.Item>
218
+        <Form.Item>
219
+          {getFieldDecorator('title')(
220
+            <Input
221
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
222
+              placeholder="请输入标题"
223
+            />,
224
+          )}
225
+        </Form.Item>
226
+        {/* <Form.Item>
227
+          {getFieldDecorator('time')(
228
+            <DatePicker />
229
+          )}
230
+        </Form.Item> */}
231
+        <Form.Item>
232
+          {getFieldDecorator('isEnlist')(
233
+            <Select style={{ width: '180px' }} placeholder="活动状态">
234
+              <Option value="1">进行中</Option>
235
+              <Option value="2">未开始</Option>
236
+              <Option value="3">已结束</Option>
237
+            </Select>,
238
+          )}
239
+        </Form.Item>
240
+        <Form.Item>
241
+          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
242
+            搜索
243
+          </Button>
244
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
245
+              重置
246
+            </Button>
247
+        </Form.Item>
248
+      </Form>
249
+      <AuthButton name="admin.buildingDynamic.add.post" noRight={null}>
250
+        <Button type="danger" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
251
+      </AuthButton>
252
+      <Table dataSource={data.records} columns={columns} pagination={false} rowKey="activityList"/>
253
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
254
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
255
+      </div>
256
+    </>
257
+  )
258
+}
259
+const WrappedHeader = Form.create({ name: 'header' })(header);
260
+
261
+export default WrappedHeader

+ 7
- 0
src/services/apis.js Ver arquivo

@@ -678,4 +678,11 @@ export default {
678 678
     action: 'admin.updateAuthMenu.post',
679 679
   },
680 680
  },
681
+ helpActivity: {
682
+  list: {
683
+    url: `${prefix}/helpActivity/list`,
684
+    method: 'GET',
685
+    action: 'admin.taRole.get',
686
+  },
687
+ },
681 688
 }