浏览代码

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

周立森 5 年前
父节点
当前提交
151288cf62

+ 19
- 0
config/routes.js 查看文件

@@ -291,6 +291,25 @@ export default [
291 291
                 hideInMenu: true,
292 292
                 component: './activity/helpActivity/edithelpActivity',
293 293
               },
294
+              
295
+              {
296
+                path: '/activity/groupActivity/list',
297
+                name: '拼团活动',
298
+                component: './activity/groupActivity/list',
299
+              },
300
+              {
301
+                path: '/activity/groupActivity/helpRecord',
302
+                name: '拼团记录',
303
+                hideInMenu: true,
304
+                component: './activity/groupActivity/helpRecord',
305
+              },
306
+              {
307
+                path: '/activity/groupActivity/editgroupActivity',
308
+                name: '新增',
309
+                hideInMenu: true,
310
+                component: './activity/groupActivity/editgroupActivity',
311
+              },
312
+
294 313
             ],
295 314
           },
296 315
           {

+ 2
- 0
src/components/Wangedit/Wangedit.jsx 查看文件

@@ -33,7 +33,9 @@ class Wangedit extends React.Component {
33 33
       }
34 34
     }
35 35
     this.editor.customConfig.zIndex = 100
36
+    this.editor.customConfig.uploadImgShowBase64 = true   
36 37
     this.editor.create()
38
+    this.editor.customConfig.uploadImgShowBase64 = true
37 39
     this.editor.txt.html(this.props.value)
38 40
   }
39 41
 

+ 4
- 4
src/pages/activity/ActivityList.jsx 查看文件

@@ -87,10 +87,10 @@ const toEditGoods = dynamicId => () => {
87 87
     },
88 88
     {
89 89
       title: '状态',
90
-      dataIndex: 'isEnlist',
91
-      key: 'isEnlist',
90
+      dataIndex: 'activityStatus',
91
+      key: 'activityStatus',
92 92
       align: 'center',
93
-      render: isEnlist => <><span>{isEnlist == 0 ? "未开始" : isEnlist == 1 ? '进行中' : '已结束'}</span></>,
93
+      render: activityStatus => <><span>{activityStatus == 0 ? "进行中" : activityStatus == 1 ? '未开始' : '已结束'}</span></>,
94 94
     },
95 95
     {
96 96
       title: '操作',
@@ -106,7 +106,7 @@ const toEditGoods = dynamicId => () => {
106 106
             <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={sendOrPublicDynamic.bind(this,row)}>{ row.status === 1 ? '取消发布' : '发布' }<Icon type="close-circle" className={styles.edit} /></span>
107 107
           </AuthButton>
108 108
           <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
109
-            {row.isEnlist != 2 && <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={finishDynamic.bind(this,row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>}
109
+            {row.isEnlist == 1 && <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={finishDynamic.bind(this,row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>}
110 110
           </AuthButton>
111 111
           <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
112 112
             <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>

+ 196
- 152
src/pages/activity/editActivity.jsx 查看文件

@@ -20,163 +20,200 @@ import xiaochengxu from '../../assets/xiaochengxu.png'
20 20
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
21 21
 const { TextArea } = Input;
22 22
 
23
+const formItemLayout = {
24
+  labelCol: { span: 6 },
25
+  wrapperCol: { span: 14 },
26
+};
27
+
28
+const BasicForm = props => {
29
+  const [isEnlist, setIsEnlist] = useState(1)
30
+
31
+  const radioOnChange = e => {
32
+    // console.log(e.target.value)
33
+    setIsEnlist(e.target.value)
34
+  }
35
+
36
+  const { dynamicId } = props
37
+
38
+  // 查询详情
39
+  const getDynamicData = dynamicId => {
40
+    request({ ...apis.activity.details, params: { dynamicId } }).then((data) => {
41
+      console.log(data)
42
+      data.activityTime = [moment(data.startDate), moment(data.endDate)]
43
+      data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
44
+
45
+      setIsEnlist(data.isEnlist)
46
+      props.form.setFieldsValue(data)
47
+    })
48
+  }
49
+
50
+    // eslint-disable-next-line react-hooks/rules-of-hooks
51
+    useEffect(() => {
52
+      props.form.setFieldsValue({ isEnlist })
53
+      if (dynamicId) {
54
+        getDynamicData(dynamicId);
55
+      }
56
+    }, [])
57
+ 
58
+  const handleSubmit = e => {
59
+    e.preventDefault();
60
+    props.form.validateFields((err, values) => {
61
+      if (!err) {
62
+        console.log('Received values of form: ', values);
63
+        const { activityTime, signupTime } = values
64
+        const [startDate, endDate] = activityTime
65
+        values.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
66
+        values.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
67
+        if (signupTime) {
68
+          const [enlistStart, enlistEnd] = signupTime
69
+          values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
70
+          values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
71
+        }
72
+        
73
+        console.log('submit data --->', values)
74
+        if (dynamicId) {
75
+          values.dynamicId = dynamicId
76
+          request({ ...apis.activity.update, data: values }).then(data => {
77
+            message.info('保存成功')
78
+            router.go(-1)
79
+          }).catch((err) => {
80
+            message.info(err.msg || err.message)
81
+          })
82
+        } else {
83
+          request({ ...apis.activity.add, data: { ...values } }).then((data) => {
84
+            message.info('保存成功')
85
+            router.go(-1)
86
+          }).catch((err) => {
87
+            message.info(err.msg || err.message)
88
+          })
89
+        }
90
+      }
91
+    });
92
+  }
93
+
94
+  const { getFieldDecorator } = props.form;
95
+  return (
96
+    <>
97
+      <Form {...formItemLayout} onSubmit={handleSubmit}>
98
+        <Form.Item label="所属项目">
99
+        {getFieldDecorator('buildingId', {
100
+          rules: [
101
+            {
102
+              required: true,
103
+              message: '请选择所属项目',
104
+            },
105
+          ],
106
+        })(<BuildSelect />)}
107
+        </Form.Item>
108
+        <Form.Item label="主图">
109
+          {getFieldDecorator('imgUrl')(<ImageUploader />)}
110
+          <span>建议图片尺寸:750px*560px</span>
111
+        </Form.Item>
112
+        <Form.Item label="活动标题">
113
+        {getFieldDecorator('title', {
114
+          rules: [
115
+            {
116
+              required: true,
117
+              message: '请输入活动标题',
118
+            },
119
+          ],
120
+        })(<Input />)}
121
+        </Form.Item>
122
+        <Form.Item label="活动时间">
123
+        {getFieldDecorator('activityTime', {
124
+          rules: [
125
+            {
126
+              required: true,
127
+              message: '请选择活动时间',
128
+            },
129
+          ],
130
+        })(<RangePicker format="YYYY-MM-DD HH:mm" />)}
131
+        </Form.Item>
132
+        <Form.Item label="活动地点">
133
+        {getFieldDecorator('address', {
134
+          rules: [
135
+            {
136
+              required: true,
137
+              message: '请输入活动地点',
138
+            },
139
+          ],
140
+        })(<Input />)}
141
+        </Form.Item>
142
+        <Form.Item label="活动人数">
143
+        {getFieldDecorator('personNum', {
144
+          rules: [
145
+            {
146
+              required: true,
147
+              message: '请输入活动人数',
148
+            },
149
+          ],
150
+        })(<Input type="number" />)}
151
+        </Form.Item>
152
+        <Form.Item label="最大报名人数">
153
+        {getFieldDecorator('maxEnlistByPerson', {
154
+          rules: [
155
+            {
156
+              required: true,
157
+              message: '请输入最大报名人数',
158
+            },
159
+          ],
160
+        })(<Input type="number" />)}
161
+        </Form.Item>
162
+        <Form.Item label="活动详情">
163
+        {getFieldDecorator('desc')(<Wangedit />)}
164
+        </Form.Item>
165
+        <Form.Item label="是否需要报名">
166
+        {getFieldDecorator('isEnlist')(
167
+          <Radio.Group onChange={(e) => radioOnChange(e)}>
168
+            <Radio value={1}>是</Radio>
169
+            <Radio value={0}>否</Radio>
170
+          </Radio.Group>,
171
+        )}
172
+        </Form.Item>
173
+        {
174
+          isEnlist === 1 && (<Form.Item label="报名时间">
175
+          {getFieldDecorator('signupTime', {
176
+            rules: [
177
+              {
178
+                required: true,
179
+                message: '请选择报名时间',
180
+              },
181
+            ],
182
+          })(<RangePicker format="YYYY-MM-DD HH:mm" />)}
183
+          </Form.Item>)
184
+        }
185
+        <Form.Item wrapperCol={{ span: 12, offset: 8 }}>
186
+          <Button type="primary" htmlType="submit">
187
+            确认
188
+          </Button>
189
+          &nbsp;&nbsp;&nbsp;&nbsp;
190
+          <Button onClick={() => router.go(-1)}>
191
+            取消
192
+          </Button>
193
+        </Form.Item>
194
+      </Form>
195
+    </>
196
+  )
197
+}
198
+
199
+const Basic = Form.create({ name: 'BasicForm' })(BasicForm);
200
+
23 201
 /**
24 202
  *
25 203
  *
26 204
  * @param {*} props
27 205
  * @returns
28 206
  */
29
-const Edit = (props) => {
207
+const Edit = props => {
30 208
   const [tab, changeTab] = useState('basic')
31
-  const dynamicId = props.location.query.dynamicId
32
-  const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
33
-  if (dynamicId) {
34
-    useEffect(() => {
35
-      getDynamicData(dynamicId);
36
-    }, [])
37
-
38
-    // 查询列表
39
-    const getDynamicData = (dynamicId) => {
40
-      request({ ...apis.activity.details, params: { dynamicId } }).then((data) => {
41
-        console.log(data)
42
-        setDynamicData(data)
43
-      })
44
-    }
45
-  }
46
-
209
+  const { dynamicId } = props.location.query
210
+  
47 211
   const cancelPage = () => {
48 212
     router.push({
49 213
       pathname: '/activity/ActivityList',
50 214
     });
51 215
   }
52 216
 
53
-  const radioOnChange = e => {
54
-    console.log(e.target.value)
55
-    setDynamicData({ ...dynamicData, isEnlist: e.target.value })
56
-  }
57
-
58
-  const Basic = (props) => {
59
-    const fields = [
60
-      {
61
-        label: '所属项目',
62
-        name: 'buildingId',
63
-        render: <BuildSelect />,
64
-        value: dynamicData.buildingId,
65
-        rules: [
66
-          { required: true, message: '请选择所属项目' },
67
-        ]
68
-      },
69
-      {
70
-        label: '主图',
71
-        name: 'imgUrl',
72
-        type: FieldTypes.ImageUploader,
73
-        value: dynamicData.imgUrl,
74
-        help: '建议图片尺寸:750px*560px',
75
-      },
76
-      {
77
-        label: '活动标题',
78
-        name: 'title',
79
-        type: FieldTypes.Text,
80
-        value: dynamicData.title,
81
-        rules: [
82
-          { required: true, message: '请输入活动标题' },
83
-        ]
84
-      },
85
-      {
86
-        label: '活动时间',
87
-        name: 'activityTime',
88
-        type: FieldTypes.RangePicker,
89
-        value: dynamicData.startDate != null ? [moment(dynamicData.startDate, 'YYYY-MM-DD HH:mm'), moment(dynamicData.endDate, 'YYYY-MM-DD HH:mm')] : null,
90
-        props: {showTime:{ format: 'HH:mm' }},
91
-        rules: [
92
-          { required: true, message: '请选择活动时间' },
93
-        ]
94
-      },
95
-      {
96
-        label: '活动地点',
97
-        name: 'address',
98
-        type: FieldTypes.Text,
99
-        value: dynamicData.address,
100
-        rules: [
101
-          { required: true, message: '请输入活动地点' },
102
-        ]
103
-      },
104
-      {
105
-        label: '活动人数',
106
-        name: 'personNum',
107
-        type: FieldTypes.Text,
108
-        value: dynamicData.personNum,
109
-        rules: [
110
-          { required: true, message: '请输入活动人数' },
111
-        ]
112
-      },
113
-      {
114
-        label: '最大报名人数',
115
-        name: 'maxEnlistByPerson',
116
-        type: FieldTypes.Text,
117
-        value: dynamicData.maxEnlistByPerson,
118
-        rules: [
119
-          { required: true, message: '请输入最大报名人数' },
120
-        ]
121
-      },
122
-      {
123
-        label: '活动详情',
124
-        name: 'desc',
125
-        render: <Wangedit />,
126
-        value: dynamicData.desc,
127
-      },
128
-      {
129
-        label: '是否需要报名',
130
-        name: 'isEnlist',
131
-        render: <Radio.Group name="radiogroup" onChange={(e) => radioOnChange(e)}>
132
-          <Radio value={1}>是</Radio>
133
-          <Radio value={0}>否</Radio>
134
-        </Radio.Group>,
135
-        value: dynamicData.isEnlist != null ? dynamicData.isEnlist - 0 : 1,
136
-      },
137
-      {
138
-        label: '报名时间',
139
-        name: 'signupTime',
140
-        // type: FieldTypes.RangePicker,
141
-        render: dynamicData.isEnlist === 1 ? (<RangePicker format={ 'YYYY/MM/DD HH:mm' } style={{ width: '100%' }} />) : '',
142
-        value: dynamicData.enlistStart != null ? [moment(dynamicData.enlistStart, 'YYYY-MM-DD HH:mm'), moment(dynamicData.enlistEnd, 'YYYY-MM-DD HH:mm')] : null,
143
-        // props: {showTime:{ format: 'HH:mm' }},
144
-        rules: [
145
-          { required: true, message: '请选择报名时间' },
146
-        ]
147
-      },
148
-    ]
149
-
150
-    const handleSubmit = val => {
151
-      let { activityTime, signupTime, ...submitValue } = val
152
-      const [startDate, endDate] = activityTime
153
-      submitValue.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
154
-      submitValue.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
155
-      const [enlistStart, enlistEnd] = signupTime
156
-      submitValue.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
157
-      submitValue.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
158
-      console.log('submit data --->', submitValue)
159
-      if (dynamicId) {
160
-        submitValue.dynamicId = dynamicId
161
-        request({ ...apis.activity.update, data: submitValue }).then((data) => {
162
-          message.info("保存成功")
163
-          cancelPage()
164
-        }).catch((err) => {
165
-          message.info(err.msg || err.message)
166
-        })
167
-      } else {
168
-        request({ ...apis.activity.add, data: submitValue }).then((data) => {
169
-          message.info("保存成功")
170
-          cancelPage()
171
-        }).catch((err) => {
172
-          message.info(err.msg || err.message)
173
-        })
174
-      }
175
-    }
176
-
177
-    return <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
178
-  }
179
-
180 217
   const Poster = (props) => {
181 218
     const [inputValue, changeInput] = useState('')
182 219
     const [textAreaValue, changeTextArea] = useState('')
@@ -244,8 +281,13 @@ const Edit = (props) => {
244 281
               <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
245 282
             </div>
246 283
             <p style={{
247
-              margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
248
-              display: '-webkit-box', lineClamp: '3', height: '60px',
284
+              margin: '10px 20px',
285
+fontSize: '20px',
286
+color: '#222',
287
+fontWeight: '600',
288
+              display: '-webkit-box',
289
+lineClamp: '3',
290
+height: '60px',
249 291
               WebkitLineClamp: '2',
250 292
               WebkitBoxOrient: 'vertical',
251 293
               overflow: 'hidden',
@@ -254,8 +296,12 @@ const Edit = (props) => {
254 296
 
255 297
             <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
256 298
             <p style={{
257
-              margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
258
-              display: '-webkit-box', lineClamp: '3', height: '72px',
299
+              margin: '16px 20px 28px 20px',
300
+fontSize: '17px',
301
+color: '#999',
302
+              display: '-webkit-box',
303
+lineClamp: '3',
304
+height: '72px',
259 305
               WebkitLineClamp: '3',
260 306
               WebkitBoxOrient: 'vertical',
261 307
               overflow: 'hidden',
@@ -326,7 +372,7 @@ const Edit = (props) => {
326 372
           request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
327 373
             setShareContentId(data.shareContentId)
328 374
             message.info("保存成功")
329
-          }).catch((err) => {
375
+          }).catch(err => {
330 376
             message.info(err.msg || err.message)
331 377
           })
332 378
         }
@@ -367,7 +413,7 @@ const Edit = (props) => {
367 413
         </Radio.Group>
368 414
       </div>
369 415
       <div>
370
-        {tab === 'basic' && <Basic />}
416
+        {tab === 'basic' && <Basic dynamicId={dynamicId} />}
371 417
         {tab === 'poster' && <Poster />}
372 418
         {tab === 'share' && <Share />}
373 419
       </div>
@@ -375,6 +421,4 @@ const Edit = (props) => {
375 421
   );
376 422
 }
377 423
 
378
-
379
-
380 424
 export default Edit

+ 350
- 0
src/pages/activity/groupActivity/editGroupActivity.jsx 查看文件

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

+ 528
- 0
src/pages/activity/groupActivity/helpRecord.jsx 查看文件

@@ -0,0 +1,528 @@
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
+class InviteTable extends React.Component {
19
+  constructor(props) {
20
+    super(props);
21
+    this.state = {
22
+      dataSource: { records: [] },
23
+      visibleData: { visible: false, customerId: '', realtyConsultant: '' },
24
+    }
25
+  }
26
+
27
+  // 挂载之后
28
+  componentDidMount () {
29
+    const { customerId } = this.state.visibleData
30
+    this.getList({ helpRecordInitiateId: customerId, pageNumber: 1, pageSize: 5 })
31
+  }
32
+
33
+  componentDidUpdate (preProps, preState) {
34
+    const { customerId } = this.state.visibleData
35
+    if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
36
+      this.getList({ helpRecordInitiateId: customerId, pageNumber: 1, pageSize: 5 })
37
+      this.setState({ visibleData: this.props.visibleData });
38
+    }
39
+  }
40
+
41
+  // 弹框确定按钮
42
+  // eslint-disable-next-line react/sort-comp
43
+  handleOk () {
44
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
45
+  }
46
+
47
+  // 弹框取消按钮
48
+  handleCancel () {
49
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
50
+  }
51
+
52
+  getList (params) {
53
+    request({ ...apis.groupActivity.shareSuccList, params: { ...params } }).then(res => {
54
+      this.setState({ dataSource: res })
55
+    }).catch(err => {
56
+      // eslint-disable-next-line no-unused-expressions
57
+      <Alert
58
+        style={{
59
+          marginBottom: 24,
60
+        }}
61
+        message={err}
62
+        type="error"
63
+        showIcon
64
+      />
65
+    })
66
+  }
67
+
68
+  // 分页
69
+  onChange (pageNum) {
70
+    this.getList({ pageNumber: pageNum, pageSize: 5 })
71
+  }
72
+
73
+  render () {
74
+    const columns = [
75
+      {
76
+        title: '用户姓名',
77
+        dataIndex: 'name',
78
+        key: 'name',
79
+        align: 'center',
80
+      },
81
+      {
82
+        title: '手机号',
83
+        dataIndex: 'phone',
84
+        key: 'phone',
85
+        align: 'center',
86
+        render: text => <a>{text}</a>,
87
+      },
88
+      {
89
+        title: '开团时间',
90
+        dataIndex: 'createDate',
91
+        key: 'createDate',
92
+        align: 'center',
93
+      },
94
+    ]
95
+    return (
96
+      <>
97
+        <Modal
98
+          title="参团者"
99
+          destroyOnClose="true"
100
+          width={900}
101
+          footer={null}
102
+          visible={this.state.visibleData.visible}
103
+          // onOk={() => this.handleOk()}
104
+          onCancel={(e) => this.handleCancel(e)}
105
+        >
106
+          <Table rowKey="independent" dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
107
+        </Modal>
108
+      </>
109
+    );
110
+  }
111
+}
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+/**
120
+ * 拼团者弹框
121
+ */
122
+class Verifier extends React.Component {
123
+  constructor(props) {
124
+    super(props);
125
+    this.state = {
126
+      helpRecordInitiateId: { id: '' },
127
+      visibleData: { visible: false, customerId: '', realtyConsultant: '', helpRecordInitiateId: '' },
128
+    }
129
+  }
130
+
131
+  // 挂载之后
132
+  componentDidMount () {
133
+    const { customerId } = this.state.visibleData
134
+    this.getList({ helpRecordInitiateId: customerId, pageNumber: 1, pageSize: 5 })
135
+  }
136
+
137
+  componentDidUpdate (preProps, preState) {
138
+    const { customerId } = this.state.visibleData
139
+    console.log('this.state.visibleData', this.state.visibleData)
140
+    if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
141
+      this.getList({ helpRecordInitiateId: customerId, pageNumber: 1, pageSize: 5 })
142
+      this.setState({ visibleData: this.props.visibleData });
143
+    }
144
+  }
145
+
146
+  // 弹框确定按钮
147
+  // eslint-disable-next-line react/sort-comp
148
+  handleOk () {
149
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
150
+  }
151
+
152
+  // 弹框取消按钮
153
+  handleCancel () {
154
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
155
+  }
156
+
157
+  getList (params) {
158
+    request({ ...apis.groupActivity.shareSuccList, params: { ...params } }).then(res => {
159
+        console.log(res);
160
+      this.setState({ dataSource: res })
161
+    }).catch(err => {
162
+      // eslint-disable-next-line no-unused-expressions
163
+      <Alert
164
+        style={{
165
+          marginBottom: 24,
166
+        }}
167
+        message={err}
168
+        type="error"
169
+        showIcon
170
+      />
171
+    })
172
+  }
173
+
174
+  // eslint-disable-next-line class-methods-use-this
175
+  verify(e) {
176
+    console.log('111', e.target.value)
177
+  }
178
+
179
+  // eslint-disable-next-line class-methods-use-this
180
+  verification(e) {
181
+    console.log('this.state.visibleData', this.state.visibleData)
182
+      alert(1)
183
+  }
184
+
185
+  render () {
186
+    return (
187
+      <>
188
+        <Modal
189
+          title="核销"
190
+          destroyOnClose="true"
191
+          width={300}
192
+          footer={null}
193
+          visible={this.state.visibleData.visible}
194
+          // onOk={() => this.handleOk()}
195
+          onCancel={(e) => this.handleCancel(e)}
196
+        >
197
+          <div><span>核销码:<input onChange={this.verify.bind(this)}/></span>
198
+           <Button onClick={(e) => this.verification(e)}>立即核销</Button>
199
+          </div>
200
+        </Modal>
201
+      </>
202
+    );
203
+  }
204
+}
205
+
206
+/**
207
+ *主体列表
208
+ *
209
+ * @param {*} props
210
+ * @returns
211
+ */
212
+function body(props) {
213
+  const [gInviteData, setGInviteData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
214
+
215
+  const [gVerifierData, setVerifierData] = useState({ visible: false, customerId: '', realtyConsultant: '', helpRecordInitiateId: '' })
216
+
217
+  const { getFieldDecorator, getFieldsValue } = props.form
218
+
219
+  // eslint-disable-next-line react-hooks/rules-of-hooks
220
+  const [dataSource, setDataSource] = useState({ records: [] })
221
+  // eslint-disable-next-line react-hooks/rules-of-hooks
222
+  // const [columns, setColumns] = useState(privateColumns)
223
+
224
+  // 默认成功
225
+  // eslint-disable-next-line react-hooks/rules-of-hooks
226
+  const [groupStatus, setgroupStatus] = useState('0')
227
+
228
+  // 调整归属 ============  start
229
+  // eslint-disable-next-line react-hooks/rules-of-hooks
230
+  const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
231
+
232
+
233
+  // 变更状态 ============= end
234
+
235
+  // eslint-disable-next-line react-hooks/rules-of-hooks
236
+  const { groupActivityId } = props.location.query
237
+  useEffect(() => {
238
+    getList({ pageNumber: 1, pageSize: 10, status: groupStatus, groupActivityId: groupActivityId })
239
+  }, [])
240
+
241
+  
242
+  function getFailList(params) {
243
+    // 网路请求
244
+    request({ ...apis.groupActivity.shareFailList, params: { ...params } }).then(res => {
245
+        console.log(res);
246
+      setDataSource(res)
247
+    }).catch(err => {
248
+      // eslint-disable-next-line no-unused-expressions
249
+      <Alert
250
+        style={{
251
+          marginBottom: 24,
252
+        }}
253
+        message={err}
254
+        type="error"
255
+        showIcon
256
+      />
257
+    })
258
+  }
259
+
260
+  function getList(params) {
261
+    // 网路请求
262
+    request({ ...apis.groupActivity.shareSuccList, params: { ...params } }).then(res => {
263
+        console.log(res);
264
+      setDataSource(res)
265
+    }).catch(err => {
266
+      // eslint-disable-next-line no-unused-expressions
267
+      <Alert
268
+        style={{
269
+          marginBottom: 24,
270
+        }}
271
+        message={err}
272
+        type="error"
273
+        showIcon
274
+      />
275
+    })
276
+  }
277
+
278
+  function displayNone() {
279
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
280
+  }
281
+
282
+  // 提交事件
283
+  function handleSubmit(e) {
284
+    displayNone()
285
+
286
+
287
+    e.preventDefault();
288
+    props.form.validateFields((err, values) => {
289
+      if (!err) {
290
+        getList({ pageNum: 1, pageSize: 10, groupStatus, ...values })
291
+      }
292
+    });
293
+  }
294
+
295
+  // Change 事件
296
+  function handleSelectChange(e) {
297
+    // eslint-disable-next-line no-console
298
+    console.log(e)
299
+  }
300
+
301
+  // 分页
302
+  function onChange(pageNum) {
303
+    // eslint-disable-next-line react-hooks/rules-of-hooks
304
+    getList({ pageNumber: pageNum, pageSize: 10, groupStatus })
305
+  }
306
+
307
+  // 助力成功/进行中/助力失败
308
+  function radioButtonHandleSizeChange(e) {
309
+    setGInviteData({ visible: true, customerId: '', realtyConsultant: '' })
310
+    displayNone()
311
+
312
+    const { value } = e.target
313
+    setgroupStatus(value)
314
+    // setColumns(value === 'helpSucceed' ? privateColumns : publicColumns)
315
+    if (value == 0) { 
316
+        console.log("success", value)
317
+        getList({ pageNumber: 1, pageSize: 10, status: value, groupActivityId }) }
318
+    if (value == 1 || value == 2) {
319
+        console.log("faile", value)
320
+         getFailList({ pageNumber: 1, pageSize: 10, status: value, groupActivityId })
321
+         }
322
+  }
323
+
324
+  function handleReset() {
325
+    props.form.resetFields();
326
+    getList({ pageNumber: 1, pageSize: 10, groupStatus })
327
+  }
328
+
329
+  function toCustomerDateil(record) {
330
+    router.push({
331
+      pathname: '/customer/customerlist/customerDetail',
332
+      query: {
333
+        id: record.customerId,
334
+      },
335
+    });
336
+  }
337
+
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
+  function download (data) {
349
+    if (!data) {
350
+      return
351
+    }
352
+    const url = window.URL.createObjectURL(new Blob([data]))
353
+    const link = document.createElement('a')
354
+    link.style.display = 'none'
355
+    link.href = url
356
+    link.setAttribute('download', '客户列表.xlsx')
357
+    document.body.append(link)
358
+    link.click()
359
+  }
360
+
361
+// 助力记录弹框
362
+function helpRecord(row) {
363
+// 关闭核销
364
+// eslint-disable-next-line max-len
365
+setVerifierData({ visible: false, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
366
+  // eslint-disable-next-line max-len
367
+  setGInviteData({ visible: true, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
368
+}
369
+ // 核销
370
+ function helpInitiateRecordVerify(row) {
371
+// 关闭助力记录弹框
372
+// eslint-disable-next-line max-len
373
+  setVerifierData({ visible: true, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
374
+  // eslint-disable-next-line max-len
375
+  setGInviteData({ visible: false, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
376
+ }
377
+
378
+  const publicColumns = [
379
+    {
380
+      title: '拼团者',
381
+      dataIndex: 'nickname',
382
+      key: 'nickname',
383
+      align: 'center',
384
+      width: '15%',
385
+    },
386
+    {
387
+      title: '拼团者手机号',
388
+      dataIndex: 'phone',
389
+      key: 'phone',
390
+      align: 'center',
391
+      width: '10%',
392
+    },
393
+    {
394
+      title: '拼团时间',
395
+      dataIndex: 'createTime',
396
+      key: 'createTime',
397
+      align: 'center',
398
+      width: '15%',
399
+    },
400
+    {
401
+      title: '参团者',
402
+      dataIndex: 'helpCount',
403
+      key: 'helpCount',
404
+      align: 'center',
405
+      width: '15%',
406
+      render: (text, record) => <a style={ { color: '#66B3FF' } } onClick={() => helpRecord(record)}>{record.joinPeople}/{record.groupBuyPeople}</a>,
407
+    },
408
+  ]
409
+
410
+  const privateColumns = [
411
+    {
412
+      title: '拼团者',
413
+      dataIndex: 'nickname',
414
+      key: 'nickname',
415
+      align: 'center',
416
+      width: '15%',
417
+      // render: (_, record) => <Avatar shape="square" src={groupStatus === 'helpSucceed' ? record.picture : record.avatarurl} size={64} icon="user" />,
418
+    },
419
+    {
420
+      title: '手机号',
421
+      dataIndex: 'phone',
422
+      key: 'phone',
423
+      align: 'center',
424
+      width: '10%',
425
+      // eslint-disable-next-line no-nested-ternary
426
+      // render: (_, record) => <><span>{groupStatus === 'helpSucceed' ? record.name : record.nickname}</span></>,
427
+    },
428
+    {
429
+      title: '发起时间',
430
+      dataIndex: 'createTime',
431
+      key: 'createTime',
432
+      align: 'center',
433
+      width: '10%',
434
+      // eslint-disable-next-line no-nested-ternary
435
+    },
436
+    {
437
+        title: '成团时间',
438
+        dataIndex: 'endTime',
439
+        key: 'endTime',
440
+        align: 'center',
441
+        width: '10%',
442
+        // eslint-disable-next-line no-nested-ternary
443
+    },
444
+    {
445
+      title: '核销状态',
446
+      dataIndex: 'verificationStatus',
447
+      key: 'verificationStatus',
448
+      align: 'center',
449
+      width: '10%',
450
+      // eslint-disable-next-line no-nested-ternary
451
+      render: (text, records) => {
452
+        if (records.verificationStatus === 0) { return '未核销' }
453
+        if (records.verificationStatus === 1) { return '已核销' }
454
+      },
455
+    },
456
+    {
457
+      title: '操作',
458
+      dataIndex: 'customerId',
459
+      key: 'customerId',
460
+      align: 'center',
461
+      width: '25%',
462
+      render: (x, row) => (
463
+        <>
464
+          {row.verificationStatus === 0 &&
465
+          <AuthButton name="admin.SignList.get" noRight={null}>
466
+           <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={() => helpInitiateRecordVerify(row)}>核销</span>
467
+          </AuthButton>
468
+        }
469
+        </>
470
+      ),
471
+    },
472
+  ]
473
+
474
+  
475
+  const changePageNum = pageNumber => {
476
+    getList({ pageNum: pageNumber, pageSize: 10 })
477
+  }
478
+
479
+  return (
480
+    <>
481
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
482
+        <Form.Item>
483
+          {getFieldDecorator('tel')(
484
+            <Input
485
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
486
+              placeholder="电话"
487
+            />,
488
+          )}
489
+        </Form.Item>
490
+        <Form.Item>
491
+            <Button type="primary" htmlType="submit" >
492
+              查询
493
+            </Button>
494
+            <Button style={{ marginLeft: 8 }} onClick={handleReset}>
495
+              重置
496
+            </Button>
497
+            <Button style={{ marginLeft: 8 }} onClick={handleReset}>
498
+              返回
499
+            </Button>
500
+        </Form.Item>
501
+      </Form>
502
+      <Button type="primary" onClick={() => exportCustomer()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
503
+        导出
504
+      </Button>
505
+
506
+      <div style={{ margin: '20px 0' }}>
507
+        <AuthButton name="admin.customer.recommend.get" noRight={null}>
508
+          <Radio.Group value={groupStatus} onChange={radioButtonHandleSizeChange} buttonStyle="solid">
509
+            <Radio.Button value="0">拼团成功</Radio.Button>
510
+            <Radio.Button value="1">进行中</Radio.Button>
511
+            <Radio.Button value="2">拼团失败</Radio.Button>
512
+          </Radio.Group>
513
+        </AuthButton>
514
+      </div>
515
+
516
+      {groupStatus === '0' ?
517
+        <Table dataSource={dataSource.records} columns={privateColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> :
518
+        <Table dataSource={dataSource.records} columns={publicColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> 
519
+      }
520
+       {/* <InviteTable visibleData={gInviteData} />
521
+       <Verifier visibleData={gVerifierData} /> */}
522
+    </>
523
+  );
524
+}
525
+
526
+const WrappedBody = Form.create({ name: 'body' })(body);
527
+
528
+export default WrappedBody

+ 278
- 0
src/pages/activity/groupActivity/list.jsx 查看文件

@@ -0,0 +1,278 @@
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
+      console.log(params);
27
+    request({ ...apis.groupActivity.list, params: { ...params } }).then((data) => {
28
+        console.log(data)
29
+        setData(data)
30
+    })
31
+  }
32
+
33
+  
34
+// 跳转到拼团活动新增
35
+const toEditActivity = (groupActivityId) => () => {
36
+    router.push({
37
+      pathname: '/activity/groupActivity/editGroupActivity',
38
+      query: {
39
+        groupActivityId
40
+      },
41
+    });
42
+  }
43
+  
44
+  /**
45
+   *
46
+   *
47
+   * @param {*} props
48
+   * @returns
49
+   */
50
+  
51
+  const columns = [
52
+    {
53
+      title: '活动标题',
54
+      dataIndex: 'activityName',
55
+      key: 'activityName',
56
+      align: 'center',
57
+    },
58
+    {
59
+      title: '活动时间',
60
+      dataIndex: 'startTime',
61
+      key: 'startTime',
62
+      align: 'center',
63
+      render: (x, row) => <><span>{`${moment(row.startTime).format('YYYY-MM-DD hh:mm:ss')} —— ${moment(row.endTime).format('YYYY-MM-DD hh:mm:ss')}`}</span></>
64
+    },
65
+    {
66
+        title: '所需积分',
67
+        dataIndex: 'integral',
68
+        key: 'integral',
69
+        align: 'center',
70
+      },
71
+    {
72
+      title: '已参与人数',
73
+      dataIndex: 'joinPeople',
74
+      key: 'joinPeople',
75
+      align: 'center',
76
+    },
77
+    {
78
+      title: '成团数',
79
+      dataIndex: 'groupBuyPeople',
80
+      key: 'groupBuyPeople',
81
+      align: 'center',
82
+    },  
83
+    {
84
+      title: '状态',
85
+      dataIndex: 'activityStatus',
86
+      key: 'activityStatus',
87
+      align: 'center',
88
+      render: (text, records) => {
89
+        if (records.activityStatus === 0) { return '进行中' }
90
+        if (records.activityStatus === 1) { return '未开始' }
91
+        if (records.activityStatus === 2) { return '已结束' }
92
+      },
93
+    },
94
+    {
95
+      title: '操作',
96
+      dataIndex: 'handle',
97
+      key: 'handle',
98
+      align: 'center',
99
+      render: (x, row) => (
100
+        <>
101
+          {row.activityStatus === 0 &&
102
+          <AuthButton name="admin.SignList.get" noRight={null}>
103
+        
104
+            <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.groupActicityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span>
105
+            <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
106
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row, row.weight)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
107
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{ row.sort === true ? '取消推荐首页' : '推荐首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
108
+        </AuthButton> }
109
+
110
+          {row.activityStatus === 1 &&
111
+           <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
112
+                      <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditActivity(row.groupActicityId)}>编辑<Icon type="form" className={styles.edit} /></span>
113
+                      <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
114
+                      <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row, row.weight)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
115
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{ row.sort === true ? '取消推荐首页' : '推荐首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
116
+        </AuthButton>
117
+          }
118
+
119
+          {row.activityStatus === 2 &&
120
+        <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
121
+           <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.groupActicityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span>
122
+           <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row, row.weight)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
123
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{ row.sort === true ? '取消推荐首页' : '推荐首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
124
+        </AuthButton>
125
+          }
126
+        </>
127
+      ),
128
+    },
129
+  ];
130
+  const getSignList = groupActivityId => {
131
+      router.push({
132
+          pathname: '/activity/groupActivity/helpRecord',
133
+          query: {
134
+            groupActivityId,
135
+          },
136
+        });
137
+  }
138
+  
139
+  const finishDynamic = (row) => {
140
+      Modal.confirm({
141
+          title: '结束以后将无法编辑, 是否继续?',
142
+          okText: '确定',
143
+          cancelText: '取消',
144
+          onOk() {
145
+              request({ ...apis.activity.finish, data: {dynamicId: row.dynamicId, top: ""} }).then((data) => {
146
+                  console.log(data)
147
+                  message.info('操作成功!')
148
+                  getList({ pageNum: 1, pageSize: 10 })
149
+              }).catch((err) => {
150
+                  console.log(err)
151
+                  message.info(err.msg || err.message)
152
+              })
153
+          },
154
+        });
155
+  }
156
+  
157
+  //结束活动
158
+  const endGroupActivity = (row) => () => {
159
+      request({ ...apis.groupActivity.finish, urlData: { id: row.groupActicityId} }).then((data) => {
160
+          console.log(data)
161
+          message.info('操作成功!')
162
+          getList({ pageNum: 1, pageSize: 10 })
163
+      }).catch((err) => {
164
+          console.log(err)
165
+          message.info(err.msg || err.message)
166
+      })
167
+  }
168
+
169
+  //置顶
170
+  const topGroupActivity = (row, weight) => () => {
171
+    request({ ...apis.groupActivity.top, data: { groupActicityId: row.groupActicityId, weight: weight } }).then((data) => {
172
+        console.log(data)
173
+        message.info('操作成功!')
174
+        getList({ pageNum: 1, pageSize: 10 })
175
+    }).catch((err) => {
176
+        console.log(err)
177
+        message.info(err.msg || err.message)
178
+    })
179
+  }
180
+
181
+  //首页推荐
182
+  const recommendGroupActivity = (row, code) => () => {
183
+    request({ ...apis.groupActivity.top, data: { groupActicityId: row.groupActicityId, sort: row.sort } }).then((data) => {
184
+        console.log(data)
185
+        message.info('操作成功!')
186
+        getList({ pageNum: 1, pageSize: 10 })
187
+    }).catch((err) => {
188
+        console.log(err)
189
+        message.info(err.msg || err.message)
190
+    })
191
+  }
192
+    
193
+  //发布活动
194
+  const sendDynamic = (row) => {
195
+      request({ ...apis.activity.send, urlData: {id: row.dynamicId}}).then((data) => {
196
+          message.info('操作成功!')
197
+          getList({ pageNum: 1, pageSize: 10 });
198
+      }).catch(err => {
199
+          console.log(err)
200
+          message.info(err.msg || err.message)
201
+      })
202
+  }
203
+  
204
+  const changePageNum = pageNumber => {
205
+      getList({ pageNum: pageNumber, pageSize: 10 })
206
+  }
207
+
208
+  // 提交事件
209
+const handleSubmit = (e, props) => {
210
+    e.preventDefault();
211
+    props.form.validateFields((err, values) => {
212
+      if (!err) {
213
+        console.log('提交数据: ', values)
214
+        getList({ pageNum: 1, pageSize: 10, ...values })
215
+      }
216
+    });
217
+  }
218
+
219
+   //重置搜索
220
+   function handleReset() {
221
+    props.form.resetFields();
222
+  }
223
+
224
+
225
+  const { getFieldDecorator } = props.form
226
+  return (
227
+
228
+    <>
229
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
230
+        <Form.Item>
231
+          {getFieldDecorator('cityId')(
232
+            <SelectCity />,
233
+          )}
234
+        </Form.Item>
235
+        <Form.Item>
236
+          {getFieldDecorator('buildingId')(
237
+            <BuildSelect />,
238
+          )}
239
+        </Form.Item>
240
+        <Form.Item>
241
+          {getFieldDecorator('activityName')(
242
+            <Input
243
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
244
+              placeholder="请输入标题"
245
+            />,
246
+          )}
247
+        </Form.Item>
248
+        <Form.Item>
249
+          {getFieldDecorator('status')(
250
+            <Select style={{ width: '180px' }} placeholder="活动状态">
251
+              <Option value="0">进行中</Option>
252
+              <Option value="1">未开始</Option>
253
+              <Option value="2">已结束</Option>
254
+            </Select>,
255
+          )}
256
+        </Form.Item>
257
+        <Form.Item>
258
+          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
259
+            搜索
260
+          </Button>
261
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
262
+              重置
263
+            </Button>
264
+        </Form.Item>
265
+      </Form>
266
+      <AuthButton name="admin.buildingDynamic.add.post" noRight={null}>
267
+        <Button type="danger" className={styles.addBtn} onClick={toEditActivity()}>新增</Button>
268
+      </AuthButton>
269
+      <Table dataSource={data.records} columns={columns} pagination={false} rowKey="activityList"/>
270
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
271
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
272
+      </div>
273
+    </>
274
+  )
275
+}
276
+const WrappedHeader = Form.create({ name: 'header' })(header);
277
+
278
+export default WrappedHeader

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

@@ -30,18 +30,18 @@ const Edit = props => {
30 30
   const [tab, changeTab] = useState('basic')
31 31
   // 判断是否展示助力次数的输入框
32 32
   // const [help, helpTab] = useState('1')
33
-  const { dynamicId } = props.location.query
34
-  const [dynamicData, setDynamicData] = useState({})
35
-  if (dynamicId) {
33
+  const { helpActivityId } = props.location.query
34
+  const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
35
+  if (helpActivityId) {
36 36
     // eslint-disable-next-line react-hooks/rules-of-hooks
37 37
     useEffect(() => {
38 38
       // eslint-disable-next-line no-use-before-define
39
-      getDynamicData(dynamicId);
39
+      getDynamicData(helpActivityId);
40 40
     }, [])
41 41
 
42
-    // 查询列表
43
-    const getDynamicData = (dynamicId) => {
44
-      request({ ...apis.activity.details, params: { dynamicId } }).then((data) => {
42
+    // 详情
43
+    const getDynamicData = (helpActivityId) => {
44
+      request({ ...apis.helpActivity.details, params: { helpActivityId } }).then((data) => {
45 45
         console.log(data)
46 46
         setDynamicData(data)
47 47
       })
@@ -50,9 +50,13 @@ const Edit = props => {
50 50
 
51 51
   const cancelPage = () => {
52 52
     router.push({
53
-      pathname: '/activity/ActivityList',
53
+      pathname: '/activity/helpActivity/list',
54 54
     });
55 55
   }
56
+  const radioOnChange = e => {
57
+    console.log(e.target.value)
58
+    setDynamicData({ ...dynamicData, isEnlist: e.target.value })
59
+  }
56 60
 
57 61
   const Basic = props => {
58 62
     const fields = [
@@ -63,7 +67,7 @@ const Edit = props => {
63 67
         value: dynamicData.buildingId,
64 68
         rules: [
65 69
           { required: true, message: '请选择项目' },
66
-        ]
70
+        ],
67 71
       },
68 72
       {
69 73
         label: '活动标题',
@@ -93,7 +97,7 @@ const Edit = props => {
93 97
       },
94 98
       {
95 99
         label: '助力邀请人数',
96
-        name: 'personNum',
100
+        name: 'persionNum',
97 101
         type: FieldTypes.Text,
98 102
         value: dynamicData.persionNum,
99 103
         rules: [
@@ -102,25 +106,28 @@ const Edit = props => {
102 106
       },
103 107
       {
104 108
         label: '助力次数',
105
-        name: 'maxEnlistByPerson',
109
+        name: 'helpNumStatus',
106 110
         type: FieldTypes.Text,
107
-        value: dynamicData.helpNum,
111
+        value: dynamicData.isEnlist != null ? dynamicData.isEnlist - 0 : 1,
108 112
         rules: [
109 113
           { required: true, message: '请选择是否助力' },
110 114
         ],
111
-        render: <Radio.Group name="radiogroup">
112
-        <Radio value={1}>不限制</Radio>
113
-        <Radio value={0}>次数限制</Radio>
115
+        render: <Radio.Group name="radiogroup" onChange={(e) => radioOnChange(e)}>
116
+        <Radio value={0}>不限制</Radio>
117
+        <Radio value={1}>次数限制</Radio>
114 118
       </Radio.Group>,
115 119
       },
120
+
116 121
       {
117
-        label: ' ',
118
-        name: 'personNum',
119
-        type: FieldTypes.Text,
120
-        value: dynamicData.personNum,
121
-        rules: [
122
-          { required: true, message: '请输入次数' },
123
-        ],
122
+        label: '请输入助力人数',
123
+        name: 'helpNum',
124
+        // type: FieldTypes.RangePicker,
125
+        render: dynamicData.isEnlist === 1 ? (<Input/>) : '',
126
+        value: dynamicData.helpNum,
127
+        // props: {showTime:{ format: 'HH:mm' }},
128
+        // rules: [
129
+        //   { required: true, message: '请输入助力人数' },
130
+        // ],
124 131
       },
125 132
       {
126 133
         label: '活动说明',
@@ -141,22 +148,22 @@ const Edit = props => {
141 148
       // submitValue.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
142 149
       // submitValue.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
143 150
       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
-      // }
151
+      if (helpActivityId) {
152
+        submitValue.helpActivityId = helpActivityId
153
+        request({ ...apis.helpActivity.update, data: submitValue }).then((data) => {
154
+          message.info("保存成功")
155
+          cancelPage()
156
+        }).catch((err) => {
157
+          message.info(err.msg || err.message)
158
+        })
159
+      } else {
160
+        request({ ...apis.helpActivity.add, data: submitValue }).then((data) => {
161
+          message.info("保存成功")
162
+          cancelPage()
163
+        }).catch((err) => {
164
+          message.info(err.msg || err.message)
165
+        })
166
+      }
160 167
     }
161 168
 
162 169
     return <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
@@ -168,10 +175,10 @@ const Edit = props => {
168 175
     const [imgValue, changeImg] = useState('')
169 176
     const [posterId, setPosterId] = useState('')
170 177
 
171
-    if (dynamicId) {
172
-      console.log(dynamicId, 'dynamicId')
178
+    if (helpActivityId) {
179
+      console.log(helpActivityId, 'helpActivityId')
173 180
       useEffect(() => {
174
-        request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then((data) => {
181
+        request({ ...apis.activity.poster, params: { targetId: helpActivityId, targetType: 'helpActivity' } }).then((data) => {
175 182
           console.log(data, "2222")
176 183
           if (data.length > 0) {
177 184
             setPosterId(data[0].posterId)
@@ -197,15 +204,15 @@ const Edit = props => {
197 204
     }
198 205
 
199 206
     const submitPoster = () => {
200
-      if (dynamicId) {
207
+      if (helpActivityId) {
201 208
         if (posterId) {
202
-          request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', 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) => {
203 210
             message.info("保存成功")
204 211
           }).catch((err) => {
205 212
             message.info(err.msg || err.message)
206 213
           })
207 214
         } else {
208
-          request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', 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) => {
209 216
             setPosterId(data.posterId)
210 217
             message.info("保存成功")
211 218
           }).catch((err) => {
@@ -257,15 +264,15 @@ const Edit = props => {
257 264
 
258 265
         <div >
259 266
           <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>
267
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片</p>
261 268
             <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
262 269
           </div>
263 270
           <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>
271
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
265 272
             <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
266 273
           </div>
267 274
           <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>
275
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
269 276
             <TextArea rows={5} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
270 277
           </div>
271 278
 
@@ -284,9 +291,9 @@ const Edit = props => {
284 291
     const [imgValue, changeImg] = useState('')
285 292
     const [shareContentId, setShareContentId] = useState('')
286 293
 
287
-    if (dynamicId) {
294
+    if (helpActivityId) {
288 295
       useEffect(() => {
289
-        request({ ...apis.activity.shareContent, params: { targetId: dynamicId, targetType: 'activity' }, }).then((data) => {
296
+        request({ ...apis.activity.shareContent, params: { targetId: helpActivityId, targetType: 'helPactivity' }, }).then((data) => {
290 297
           console.log(data, "2222")
291 298
           if (data.length > 0) {
292 299
             setShareContentId(data[0].shareContentId)
@@ -300,15 +307,15 @@ const Edit = props => {
300 307
     }
301 308
 
302 309
     const submitShare = () => {
303
-      if (dynamicId) {
310
+      if (helpActivityId) {
304 311
         if (shareContentId) {
305
-          request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: dynamicId, shareContentType: 'activity', 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) => {
306 313
             message.info("保存成功")
307 314
           }).catch((err) => {
308 315
             message.info(err.msg || err.message)
309 316
           })
310 317
         } else {
311
-          request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
318
+          request({ ...apis.activity.addShareContent, data: { targetId: helpActivityId, shareContentType: 'helPactivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
312 319
             setShareContentId(data.shareContentId)
313 320
             message.info("保存成功")
314 321
           }).catch((err) => {
@@ -322,7 +329,7 @@ const Edit = props => {
322 329
 
323 330
     return <div style={{ padding: '20px' }}>
324 331
       <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>
332
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
326 333
         <div>
327 334
           <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}><img src={logo} style={{ width: '22px', marginRight: '10px' }} />知与行互动</p>
328 335
           <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '置业V客厅 精准获客平台'}</p>
@@ -330,11 +337,11 @@ const Edit = props => {
330 337
         </div>
331 338
       </div>
332 339
       <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
333
-        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题1</p>
340
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题</p>
334 341
         <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
335 342
       </div>
336 343
       <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
337
-        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片1</p>
344
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片</p>
338 345
         <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
339 346
       </div>
340 347
       <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
@@ -346,9 +353,9 @@ const Edit = props => {
346 353
     <div>
347 354
       <div>
348 355
         <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>
356
+          <Radio.Button value="basic">基本信息</Radio.Button>
357
+          <Radio.Button value="poster">海报图片</Radio.Button>
358
+          <Radio.Button value="share">分享设置</Radio.Button>
352 359
         </Radio.Group>
353 360
       </div>
354 361
       <div>
@@ -359,7 +366,4 @@ const Edit = props => {
359 366
     </div>
360 367
   );
361 368
 }
362
-
363
-
364
-
365 369
 export default Edit

+ 298
- 105
src/pages/activity/helpActivity/helpRecord.jsx 查看文件

@@ -1,5 +1,5 @@
1 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';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions, message } from 'antd';
3 3
 import moment from 'moment';
4 4
 import request from '../../../utils/request';
5 5
 import apis from '../../../services/apis';
@@ -13,12 +13,226 @@ const { Option } = Select;
13 13
 const { Meta } = Card;
14 14
 
15 15
 /**
16
- *
16
+ * 助力者弹框
17
+ */
18
+class InviteTable extends React.Component {
19
+  constructor(props) {
20
+    super(props);
21
+    this.state = {
22
+      dataSource: { records: [] },
23
+      visibleData: { visible: false, customerId: '', realtyConsultant: '' },
24
+    }
25
+  }
26
+
27
+  // 挂载之后
28
+  componentDidMount () {
29
+    const { customerId } = this.state.visibleData
30
+    this.getList({ helpRecordInitiateId: customerId, pageNumber: 1, pageSize: 5 })
31
+  }
32
+
33
+  componentDidUpdate (preProps, preState) {
34
+    const { customerId } = this.state.visibleData
35
+    if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
36
+      this.getList({ helpRecordInitiateId: customerId, pageNumber: 1, pageSize: 5 })
37
+      this.setState({ visibleData: this.props.visibleData });
38
+    }
39
+  }
40
+
41
+  // 弹框确定按钮
42
+  // eslint-disable-next-line react/sort-comp
43
+  handleOk () {
44
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
45
+  }
46
+
47
+  // 弹框取消按钮
48
+  handleCancel () {
49
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
50
+  }
51
+
52
+  getList (params) {
53
+    request({ ...apis.helpActivity.helpPeopleDetails, params: { ...params } }).then(res => {
54
+      this.setState({ dataSource: res })
55
+    }).catch(err => {
56
+      // eslint-disable-next-line no-unused-expressions
57
+      <Alert
58
+        style={{
59
+          marginBottom: 24,
60
+        }}
61
+        message={err}
62
+        type="error"
63
+        showIcon
64
+      />
65
+    })
66
+  }
67
+
68
+  // 分页
69
+  onChange (pageNum) {
70
+    this.getList({ pageNumber: pageNum, pageSize: 5 })
71
+  }
72
+
73
+  render () {
74
+    const columns = [
75
+      {
76
+        title: '用户姓名',
77
+        dataIndex: 'name',
78
+        key: 'name',
79
+        align: 'center',
80
+      },
81
+      {
82
+        title: '手机号',
83
+        dataIndex: 'phone',
84
+        key: 'phone',
85
+        align: 'center',
86
+        render: text => <a>{text}</a>,
87
+      },
88
+      {
89
+        title: '助力时间',
90
+        dataIndex: 'createDate',
91
+        key: 'createDate',
92
+        align: 'center',
93
+      },
94
+    ]
95
+    return (
96
+      <>
97
+        <Modal
98
+          title="助力者"
99
+          destroyOnClose="true"
100
+          width={900}
101
+          footer={null}
102
+          visible={this.state.visibleData.visible}
103
+          // onOk={() => this.handleOk()}
104
+          onCancel={(e) => this.handleCancel(e)}
105
+        >
106
+
107
+          
108
+          <Table rowKey="independent" dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
109
+        </Modal>
110
+      </>
111
+    );
112
+  }
113
+}
114
+
115
+
116
+/**
117
+ * 助力者弹框
118
+ */
119
+class Verifier extends React.Component {
120
+  constructor(props) {
121
+    super(props);
122
+    this.state = {
123
+      verification: { verificationCode: '' },
124
+      visibleData: { visible: false, customerId: '', realtyConsultant: '', helpRecordInitiateId: '', verificationCode: '' },
125
+    }
126
+  }
127
+
128
+  // 挂载之后
129
+  componentDidMount () {
130
+    const { customerId } = this.state.visibleData
131
+  }
132
+
133
+  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: '' } })
137
+    }
138
+  }
139
+
140
+  // 弹框确定按钮
141
+  // eslint-disable-next-line react/sort-comp
142
+  handleOk () {
143
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
144
+  }
145
+
146
+  // 弹框取消按钮
147
+  handleCancel () {
148
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
149
+  }
150
+
151
+  // eslint-disable-next-line class-methods-use-this
152
+  getList (params) {
153
+    request({ ...apis.helpActivity.verification, params: { ...params } }).then(res => {
154
+      // eslint-disable-next-line no-undef
155
+      message.info('核销成功')
156
+    }).catch(err => {
157
+      // eslint-disable-next-line no-unused-expressions
158
+      <Alert
159
+        style={{
160
+          marginBottom: 24,
161
+        }}
162
+        message={err}
163
+        type="error"
164
+        showIcon
165
+      />
166
+    })
167
+  }
168
+
169
+  // eslint-disable-next-line class-methods-use-this
170
+  verify(e) {
171
+    this.setState({ visibleData: { visible: true, customerId: this.props.visibleData.customerId, verificationCode: e.target.value } })
172
+  }
173
+
174
+  // eslint-disable-next-line class-methods-use-this
175
+  verification(e) {
176
+    this.getList({ helpRecordInitiateId: this.state.visibleData.customerId, verifyCode: this.state.visibleData.verificationCode })
177
+  }
178
+
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 () {
205
+    return (
206
+      <>
207
+        <Modal
208
+          title="核销"
209
+          destroyOnClose="true"
210
+          width={300}
211
+          footer={null}
212
+          visible={this.state.visibleData.visible}
213
+          // onOk={() => this.handleOk()}
214
+          onCancel={(e) => this.handleCancel(e)}
215
+        >
216
+          <div><span>核销码:<input onChange={this.verify.bind(this)}/></span>
217
+           <Button onClick={(e) => this.verification(e)}>立即核销</Button>
218
+          </div>
219
+        </Modal>
220
+      </>
221
+    );
222
+  }
223
+}
224
+
225
+/**
226
+ *主体列表
17 227
  *
18 228
  * @param {*} props
19 229
  * @returns
20 230
  */
21 231
 function body(props) {
232
+  const [gInviteData, setGInviteData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
233
+
234
+  const [gVerifierData, setVerifierData] = useState({ visible: false, customerId: '', realtyConsultant: '', helpRecordInitiateId: '' })
235
+
22 236
   const { getFieldDecorator, getFieldsValue } = props.form
23 237
 
24 238
   // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -26,33 +240,27 @@ function body(props) {
26 240
   // eslint-disable-next-line react-hooks/rules-of-hooks
27 241
   // const [columns, setColumns] = useState(privateColumns)
28 242
 
29
-  // 默认私客
243
+  // 默认成功
30 244
   // eslint-disable-next-line react-hooks/rules-of-hooks
31
-  const [customerType, setCustomerType] = useState('private')
245
+  const [customerType, setCustomerType] = useState('helpSucceed')
32 246
 
33 247
   // 调整归属 ============  start
34 248
   // eslint-disable-next-line react-hooks/rules-of-hooks
35 249
   const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
36
-  // 调整归属 ============= end
37 250
 
38
-  // 积分记录 ============  start
39
-  // eslint-disable-next-line react-hooks/rules-of-hooks
40
-  const [recordVisibleData, setRecordVisibleData] = useState({ visible: false, customerId: '' })
41
-  // 积分记录 ============= end
42 251
 
43
-  // 变更状态 ============  start
44
-  // eslint-disable-next-line react-hooks/rules-of-hooks
45
-  const [statusVisibleData, setStatusVisibleData] = useState({ visible: false, customerId: '', status: '' })
46 252
   // 变更状态 ============= end
47 253
 
48 254
   // eslint-disable-next-line react-hooks/rules-of-hooks
255
+  const { helpActivityId } = props.location.query
49 256
   useEffect(() => {
50
-    getList({ pageNumber: 1, pageSize: 10, customerType })
257
+    console.log('customerType', customerType)
258
+    getList({ pageNumber: 1, pageSize: 10, status: customerType, helpActivityId })
51 259
   }, [])
52 260
 
53 261
   function getList(params) {
54 262
     // 网路请求
55
-    request({ ...apis.customer.customerRecommend, params: { ...params } }).then(res => {
263
+    request({ ...apis.helpActivity.record, params: { ...params } }).then(res => {
56 264
       setDataSource(res)
57 265
     }).catch(err => {
58 266
       // eslint-disable-next-line no-unused-expressions
@@ -68,9 +276,7 @@ function body(props) {
68 276
   }
69 277
 
70 278
   function displayNone() {
71
-    setRecordVisibleData({ visible: false, customerId: '' })
72 279
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
73
-    setStatusVisibleData({ visible: false, customerId: '', status: '' })
74 280
   }
75 281
 
76 282
   // 提交事件
@@ -98,14 +304,15 @@ function body(props) {
98 304
     getList({ pageNumber: pageNum, pageSize: 10, customerType })
99 305
   }
100 306
 
101
-  // 私客/公客切换
307
+  // 助力成功/进行中/助力失败
102 308
   function radioButtonHandleSizeChange(e) {
309
+    setGInviteData({ visible: false, customerId: '', realtyConsultant: '' })
103 310
     displayNone()
104 311
 
105 312
     const { value } = e.target
106 313
     setCustomerType(value)
107
-    //setColumns(value === 'private' ? privateColumns : publicColumns)
108
-    getList({ pageNumber: 1, pageSize: 10, customerType: value })
314
+    // setColumns(value === 'helpSucceed' ? privateColumns : publicColumns)
315
+    getList({ pageNumber: 1, pageSize: 10, status: value, helpActivityId })
109 316
   }
110 317
 
111 318
   function handleReset() {
@@ -113,27 +320,6 @@ function body(props) {
113 320
     getList({ pageNumber: 1, pageSize: 10, customerType })
114 321
   }
115 322
 
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 323
   function toCustomerDateil(record) {
138 324
     router.push({
139 325
       pathname: '/customer/customerlist/customerDetail',
@@ -145,7 +331,8 @@ function body(props) {
145 331
 
146 332
   function exportCustomer () {
147 333
     const fieldsValue = getFieldsValue()
148
-    request({ ...apis.customer.customerRecommendExport, responseType: 'blob', params: { ...fieldsValue, customerType } })
334
+    const code = customerType === 'helpSucceed' ? 1 : 0
335
+    request({ ...apis.helpActivity.HelpInitiateRecordSucceed, responseType: 'blob', params: { ...fieldsValue, customerType, helpActivityId, code } })
149 336
       .then(response => {
150 337
         download(response)
151 338
       }).catch(error => {
@@ -161,113 +348,109 @@ function body(props) {
161 348
     const link = document.createElement('a')
162 349
     link.style.display = 'none'
163 350
     link.href = url
164
-    link.setAttribute('download', '客户列表.xlsx')
351
+    link.setAttribute('download', '助力记录.xlsx')
165 352
     document.body.append(link)
166 353
     link.click()
167 354
   }
168 355
 
356
+// 助力记录弹框
357
+function helpRecord(row) {
358
+// 关闭核销
359
+console.log('gInviteData', gInviteData)
360
+
361
+
362
+  setGInviteData({ visible: true, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
363
+
364
+  setVerifierData({ visible: false, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
365
+}
366
+ // 核销
367
+ function helpInitiateRecordVerify(row) {
368
+
369
+  console.log('gVerifierData', gVerifierData)
370
+// 关闭助力记录弹框
371
+  setGInviteData({ visible: false, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
372
+
373
+  setVerifierData({ visible: true, customerId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
374
+
375
+
376
+ }
377
+
169 378
   const publicColumns = [
170 379
     {
171
-      title: '头像',
172
-      dataIndex: 'picture',
173
-      key: 'picture',
380
+      title: '发起者',
381
+      dataIndex: 'name',
382
+      key: 'name',
174 383
       align: 'center',
175 384
       width: '15%',
176
-      render: (_, record) => <Avatar shape="square" src={customerType === 'private' ? record.picture : record.avatarurl} size={64} icon="user" />,
177 385
     },
178 386
     {
179
-      title: '姓名',
180
-      dataIndex: 'name',
181
-      key: 'name',
387
+      title: '发起者手机号',
388
+      dataIndex: 'phone',
389
+      key: 'phone',
182 390
       align: 'center',
183 391
       width: '10%',
184
-      // eslint-disable-next-line no-nested-ternary
185
-      render: (_, record) => <><span>{customerType === 'private' ? record.name : record.nickname}</span></>,
186 392
     },
187 393
     {
188
-      title: '电话',
189
-      dataIndex: 'phone',
190
-      key: 'phone',
394
+      title: '发起时间',
395
+      dataIndex: 'createDate',
396
+      key: 'createDate',
191 397
       align: 'center',
192 398
       width: '15%',
193 399
     },
194 400
     {
195
-      title: '推广人员',
196
-      dataIndex: 'sharePersonName',
197
-      key: 'sharePersonName',
401
+      title: '助力者',
402
+      dataIndex: 'helpCount',
403
+      key: 'helpCount',
198 404
       align: 'center',
199 405
       width: '15%',
406
+      render: (text, record) => <a style={ { color: '#66B3FF' } } onClick={() => helpRecord(record)}>{record.helpCount}/{record.persionNumCount}</a>,
200 407
     },
201 408
   ]
202 409
 
203 410
   const privateColumns = [
204 411
     {
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: '姓名',
412
+      title: '发起者',
214 413
       dataIndex: 'name',
215 414
       key: 'name',
216 415
       align: 'center',
217
-      width: '10%',
218
-      // eslint-disable-next-line no-nested-ternary
219
-      render: (_, record) => <><span>{customerType === 'private' ? record.name : record.nickname}</span></>,
416
+      width: '15%',
417
+      // render: (_, record) => <Avatar shape="square" src={customerType === 'helpSucceed' ? record.picture : record.avatarurl} size={64} icon="user" />,
220 418
     },
221 419
     {
222
-      title: '电话',
420
+      title: '手机号',
223 421
       dataIndex: 'phone',
224 422
       key: 'phone',
225 423
       align: 'center',
226
-      width: '15%',
227
-    },
228
-    {
229
-      title: '性别',
230
-      dataIndex: 'sex',
231
-      key: 'sex',
232
-      align: 'center',
233 424
       width: '10%',
234 425
       // eslint-disable-next-line no-nested-ternary
235
-      render: (_, record) => <><span>{record.sex === 1 ? '男' : record.sex === 2 ? '女' : '未知'}</span></>,
426
+      // render: (_, record) => <><span>{customerType === 'helpSucceed' ? record.name : record.nickname}</span></>,
236 427
     },
237 428
     {
238
-      title: '置业顾问',
239
-      dataIndex: 'consultantName',
240
-      key: 'consultantName',
429
+      title: '发起时间',
430
+      dataIndex: 'createDate',
431
+      key: 'createDate',
241 432
       align: 'center',
242
-      width: '15%',
433
+      width: '10%',
243 434
       // 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 435
     },
252 436
     {
253
-      title: '推广人员',
254
-      dataIndex: 'sharePersonName',
255
-      key: 'sharePersonName',
437
+      title: '助力者',
438
+      dataIndex: 'helpCount',
439
+      key: 'helpCount',
256 440
       align: 'center',
257 441
       width: '15%',
442
+      render: (text, record) => <a style={ { color: '#66B3FF' } } onClick={() => helpRecord(record)}>{record.helpCount}人</a>,
258 443
     },
259 444
     {
260
-      title: '客户状态',
445
+      title: '核销状态',
261 446
       dataIndex: 'reportRecommendStatus',
262 447
       key: 'reportRecommendStatus',
263 448
       align: 'center',
264 449
       width: '10%',
265 450
       // eslint-disable-next-line no-nested-ternary
266 451
       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 '签约' }
452
+        if (records.verificationStatus === 0) { return '未核销' }
453
+        if (records.verificationStatus === 1) { return '已核销' }
271 454
       },
272 455
     },
273 456
     {
@@ -276,7 +459,15 @@ function body(props) {
276 459
       key: 'customerId',
277 460
       align: 'center',
278 461
       width: '25%',
279
-      // eslint-disable-next-line no-nested-ternary
462
+      render: (x, row) => (
463
+        <>
464
+          {row.verificationStatus === 0 &&
465
+          <AuthButton name="admin.SignList.get" noRight={null}>
466
+           <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={() => helpInitiateRecordVerify(row)}>核销</span>
467
+          </AuthButton>
468
+        }
469
+        </>
470
+      ),
280 471
     },
281 472
   ]
282 473
 
@@ -308,19 +499,21 @@ function body(props) {
308 499
         导出
309 500
       </Button>
310 501
 
311
-      <div style={{ margin: '20px 0'}}>
502
+      <div style={{ margin: '20px 0' }}>
312 503
         <AuthButton name="admin.customer.recommend.get" noRight={null}>
313 504
           <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>
505
+            <Radio.Button value="helpSucceed">助力成功</Radio.Button>
506
+            <Radio.Button value="helpUnderway">进行中</Radio.Button>
507
+            <Radio.Button value="helpUnfinished">助力失败</Radio.Button>
317 508
           </Radio.Group>
318 509
         </AuthButton>
319 510
       </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" /> 
511
+      {customerType === 'helpSucceed' ?
512
+        <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" /> 
323 514
       }
515
+       <InviteTable visibleData={gInviteData} />
516
+       <Verifier visibleData={gVerifierData} />
324 517
     </>
325 518
   );
326 519
 }

+ 46
- 36
src/pages/activity/helpActivity/list.jsx 查看文件

@@ -13,7 +13,7 @@ import AuthButton from '@/components/AuthButton';
13 13
 const { Option } = Select;
14 14
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
15 15
 
16
-const header = (props) => {
16
+const header = props => {
17 17
   const [ data, setData ] = useState({})
18 18
 //   const [page, changePage] = useState({})
19 19
 
@@ -31,11 +31,11 @@ const header = (props) => {
31 31
 
32 32
   
33 33
 // 跳转到助力新增
34
-const toEditGoods = (dynamicId) => () => {
34
+const toEditGoods = (helpActivityId) => () => {
35 35
     router.push({
36 36
       pathname: '/activity/helpActivity/edithelpActivity',
37 37
       query: {
38
-        dynamicId
38
+        helpActivityId
39 39
       },
40 40
     });
41 41
   }
@@ -79,9 +79,9 @@ const toEditGoods = (dynamicId) => () => {
79 79
       key: 'isEnlist',
80 80
       align: 'center',
81 81
       render: (text, records) => {
82
-        if (records.status === 0) { return '未开始' }
83
-        if (records.status === 1) { return '进行中' }
84
-        if (records.status === 2) { return '已结束' }
82
+        if (records.activityStatus === 0) { return '未开始' }
83
+        if (records.activityStatus === 1) { return '进行中' }
84
+        if (records.activityStatus === 2) { return '已结束' }
85 85
       },
86 86
     },
87 87
     {
@@ -89,31 +89,42 @@ const toEditGoods = (dynamicId) => () => {
89 89
       dataIndex: 'handle',
90 90
       key: 'handle',
91 91
       align: 'center',
92
-      render: (x,row) => (
92
+      render: (x, row) => (
93 93
         <>
94
+          {row.activityStatus === 1 &&
94 95
           <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>
96
+        
97
+            <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.helpActivityId)}>助力记录<Icon type="snippets" className={styles.shoppingCart} /></span>
98
+            <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={topDynamic(row, 2)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
99
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 0)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
100
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 1)}>{ row.isMain === true ? '取消推首页' : '推首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
101
+          </AuthButton> }
102
+
103
+          {row.activityStatus === 0 &&
104
+           <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
105
+                      <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditGoods(row.helpActivityId)}>编辑<Icon type="form" className={styles.edit} /></span>
106
+                      <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={topDynamic(row, 2)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
107
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 0)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
108
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 1)}>{ row.isMain === true ? '取消推首页' : '推首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
109
+            </AuthButton>
110
+          }
111
+
112
+          {row.activityStatus === 2 &&
113
+        <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
114
+           <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.helpActivityId)}>助力记录<Icon type="snippets" className={styles.shoppingCart} /></span>
115
+           <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 0)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
116
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 1)}>{ row.isMain === true ? '取消推首页' : '推首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
117
+        </AuthButton>
118
+          }
107 119
         </>
108
-      )
120
+      ),
109 121
     },
110 122
   ];
111
-  
112
-  const getSignList = (dynamicId) => {
123
+  const getSignList = helpActivityId => {
113 124
       router.push({
114 125
           pathname: '/activity/helpActivity/helpRecord',
115 126
           query: {
116
-              dynamicId
127
+            helpActivityId,
117 128
           },
118 129
         });
119 130
   }
@@ -137,9 +148,8 @@ const toEditGoods = (dynamicId) => () => {
137 148
   }
138 149
   
139 150
 //   置顶
140
-  const topDynamic = (row) => () => {
141
-      const weight = Math.abs(row.weight - 1)
142
-      request({ ...apis.activity.weight, params: {dynamicId: row.dynamicId, weight} }).then((data) => {
151
+  const topDynamic = (row, code) => () => {
152
+      request({ ...apis.helpActivity.top, data: { helpActivityId: row.helpActivityId, status: code } }).then((data) => {
143 153
           console.log(data)
144 154
           message.info('操作成功!')
145 155
           getList({ pageNum: 1, pageSize: 10 })
@@ -149,13 +159,13 @@ const toEditGoods = (dynamicId) => () => {
149 159
       })
150 160
   }
151 161
   
152
-  const sendOrPublicDynamic = (row) => {
153
-      if (row.status === 1) {
154
-          cancelDynamic(row)
155
-      } else {
156
-          sendDynamic(row)
157
-      }
158
-  }
162
+  // const sendOrPublicDynamic = (row) => {
163
+  //     if (row.status === 1) {
164
+  //         cancelDynamic(row)
165
+  //     } else {
166
+  //         sendDynamic(row)
167
+  //     }
168
+  // }
159 169
   
160 170
   // 取消活动
161 171
   const cancelDynamic = (row) => {
@@ -229,11 +239,11 @@ const handleSubmit = (e, props) => {
229 239
           )}
230 240
         </Form.Item> */}
231 241
         <Form.Item>
232
-          {getFieldDecorator('isEnlist')(
242
+          {getFieldDecorator('status')(
233 243
             <Select style={{ width: '180px' }} placeholder="活动状态">
244
+              <Option value="0">未开始</Option>
234 245
               <Option value="1">进行中</Option>
235
-              <Option value="2">未开始</Option>
236
-              <Option value="3">已结束</Option>
246
+              <Option value="2">已结束</Option>
237 247
             </Select>,
238 248
           )}
239 249
         </Form.Item>

+ 3
- 3
src/pages/news/list/NewsList.jsx 查看文件

@@ -92,13 +92,13 @@ function body(props) {
92 92
     }
93 93
 
94 94
     //删除资讯
95
-    const changeNewsListStatus = (newsId) => () => {
95
+    const changeNewsListStatus = (row, newsId) => () => {
96 96
       Modal.confirm({
97 97
         title: '确认删除该资讯?',
98 98
         okText: '确认',
99 99
         cancelText: '取消',
100 100
         onOk() {
101
-          request({ ...apis.news.delete, urlData: { id: newsId }, }).then((data) => {
101
+          request({ ...apis.news.put, urlData: { id: newsId }, data: { ...row, status: -1 } }).then((data) => {
102 102
             message.info('操作成功!')
103 103
             getList({ pageNum: 1, pageSize: 10 });
104 104
           }).catch((err) => {
@@ -201,7 +201,7 @@ function body(props) {
201 201
           }
202 202
         </AuthButton>
203 203
         <AuthButton name="admin.taNews.id.delete" noRight={null}>
204
-          <span style={{ position: 'absolute', right: '20px', bottom: ' 10px', fontSize: ' 0.106rem', color: '#FF7E48', cursor: 'pointer' }} onClick={changeNewsListStatus(data.newsId)}>
204
+          <span style={{ position: 'absolute', right: '20px', bottom: ' 10px', fontSize: ' 0.106rem', color: '#FF7E48', cursor: 'pointer', zIndex: 1 }} onClick={changeNewsListStatus(data, data.newsId)}>
205 205
             删除
206 206
                 <Icon type="rest" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
207 207
           </span>

+ 2
- 1
src/pages/news/type/NewsType.jsx 查看文件

@@ -60,7 +60,8 @@ function header(props) {
60 60
       okText: '确认',
61 61
       cancelText: '取消',
62 62
       onOk() {
63
-        request({ ...apis.newsType.delete, urlData: { id: newsId },}).then((data) => {
63
+
64
+        request({ ...apis.newsType.put, urlData: { id: newsId }, data: { ...row, status: -1 } }).then((data) => {
64 65
           message.info('操作成功!')
65 66
           getList({ pageNum: 1, pageSize: 10 });
66 67
         }).catch((err) => {

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

@@ -715,6 +715,88 @@ export default {
715 715
     method: 'GET',
716 716
     action: 'admin.taRole.get',
717 717
   },
718
+  add: {
719
+    url: `${prefix}/helpActivity/add`,
720
+    method: 'post',
721
+    action: 'admin.taRole.get',
722
+  },
723
+  details: {
724
+    url: `${prefix}/helpActivity/details`,
725
+    method: 'get',
726
+    action: 'admin.taRole.get',
727
+  },
728
+  update: {
729
+    url: `${prefix}/helpActivity/update`,
730
+    method: 'put',
731
+    action: 'admin.taRole.get',
732
+  },
733
+  top: {
734
+    url: `${prefix}/top/update`,
735
+    method: 'post',
736
+    action: 'admin.taRole.get',
737
+  },
738
+  record: {
739
+    url: `${prefix}/helpRecord`,
740
+    method: 'get',
741
+    action: 'admin.taRole.get',
742
+  },
743
+  helpPeopleDetails: {
744
+    url: `${prefix}/taHelpRecord/details`,
745
+    method: 'get',
746
+    action: 'admin.taRole.get',
747
+  },
748
+  verification: {
749
+    url: `${prefix}/helpInitiateRecordVerify`,
750
+    method: 'post',
751
+    action: 'admin.taRole.get',
752
+  },
753
+  HelpInitiateRecordSucceed: {
754
+    url: `${prefix}/HelpInitiateRecordSucceed/export`,
755
+    method: 'get',
756
+    action: 'admin.taRole.get',
757
+  },
758
+ },
759
+ groupActivity: {
760
+  list: {
761
+    url: `${prefix}/taShareActivity/list`,
762
+    method: 'get',
763
+    action: 'admin.taShareActivity.get',
764
+  },
765
+  add: {
766
+    url: `${prefix}/taShareActivity`,
767
+    method: 'post',
768
+    action: 'admin.taRole.get',
769
+  },
770
+  details: {
771
+    url: `${prefix}/taShareActivity/:id`,
772
+    method: 'get',
773
+    action: 'admin.taRole.get',
774
+  },
775
+  update: {
776
+    url: `${prefix}/taShareActivity/update`,
777
+    method: 'put',
778
+    action: 'admin.taRole.get',
779
+  },
780
+  finish: {
781
+    url: `${prefix}/taShareActivity/finish/:id`,
782
+    method: 'put',
783
+    action: 'admin.taShareActivity.finish',
784
+  },
785
+  top: {
786
+    url: `${prefix}/taShareActivity/weight`,
787
+    method: 'put',
788
+    action: 'admin.taShareActivity.weight',
789
+  },
790
+  shareSuccList: {
791
+    url: `${prefix}/taShareSuccessRecord`,
792
+    method: 'get',
793
+    action: 'admin.taRole.get',
794
+  },
795
+  shareFailList : {
796
+    url: `${prefix}/taShareFailAndProcessingRecord`,
797
+    method: 'get',
798
+    action: 'admin.taRole.get',
799
+  }
718 800
  },
719 801
  third: {
720 802
   thirdPartyMiniapp: {