|
@@ -14,25 +14,25 @@ const { Option } = Select;
|
14
|
14
|
const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
|
15
|
15
|
|
16
|
16
|
const header = props => {
|
17
|
|
- const [ data, setData ] = useState({})
|
18
|
|
-// const [page, changePage] = useState({})
|
|
17
|
+ const [data, setData] = useState({})
|
|
18
|
+ // const [page, changePage] = useState({})
|
19
|
19
|
|
20
|
20
|
useEffect(() => {
|
21
|
21
|
getList({ pageNum: 1, pageSize: 10 });
|
22
|
|
- },[])
|
|
22
|
+ }, [])
|
23
|
23
|
|
24
|
24
|
// 查询列表
|
25
|
25
|
const getList = (params) => {
|
26
|
|
- console.log(params);
|
|
26
|
+ console.log(params);
|
27
|
27
|
request({ ...apis.groupActivity.list, params: { ...params } }).then((data) => {
|
28
|
|
- console.log(data)
|
29
|
|
- setData(data)
|
|
28
|
+ console.log(data)
|
|
29
|
+ setData(data)
|
30
|
30
|
})
|
31
|
31
|
}
|
32
|
32
|
|
33
|
|
-
|
34
|
|
-// 跳转到拼团活动新增
|
35
|
|
-const toEditActivity = (groupActivityId) => () => {
|
|
33
|
+
|
|
34
|
+ // 跳转到拼团活动新增
|
|
35
|
+ const toEditActivity = (groupActivityId) => () => {
|
36
|
36
|
router.push({
|
37
|
37
|
pathname: '/activity/groupActivity/editGroupActivity',
|
38
|
38
|
query: {
|
|
@@ -40,14 +40,14 @@ const toEditActivity = (groupActivityId) => () => {
|
40
|
40
|
},
|
41
|
41
|
});
|
42
|
42
|
}
|
43
|
|
-
|
|
43
|
+
|
44
|
44
|
/**
|
45
|
45
|
*
|
46
|
46
|
*
|
47
|
47
|
* @param {*} props
|
48
|
48
|
* @returns
|
49
|
49
|
*/
|
50
|
|
-
|
|
50
|
+
|
51
|
51
|
const columns = [
|
52
|
52
|
{
|
53
|
53
|
title: '活动标题',
|
|
@@ -63,11 +63,11 @@ const toEditActivity = (groupActivityId) => () => {
|
63
|
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
|
64
|
},
|
65
|
65
|
{
|
66
|
|
- title: '所需积分',
|
67
|
|
- dataIndex: 'integral',
|
68
|
|
- key: 'integral',
|
69
|
|
- align: 'center',
|
70
|
|
- },
|
|
66
|
+ title: '所需积分',
|
|
67
|
+ dataIndex: 'integral',
|
|
68
|
+ key: 'integral',
|
|
69
|
+ align: 'center',
|
|
70
|
+ },
|
71
|
71
|
{
|
72
|
72
|
title: '已参与人数',
|
73
|
73
|
dataIndex: 'participateNum',
|
|
@@ -79,7 +79,7 @@ const toEditActivity = (groupActivityId) => () => {
|
79
|
79
|
dataIndex: 'groupBuyPeople',
|
80
|
80
|
key: 'groupBuyPeople',
|
81
|
81
|
align: 'center',
|
82
|
|
- },
|
|
82
|
+ },
|
83
|
83
|
{
|
84
|
84
|
title: '状态',
|
85
|
85
|
dataIndex: 'activityStatus',
|
|
@@ -99,127 +99,129 @@ const toEditActivity = (groupActivityId) => () => {
|
99
|
99
|
render: (x, row) => (
|
100
|
100
|
<>
|
101
|
101
|
{row.activityStatus === 0 &&
|
102
|
|
- <AuthButton name="admin.taShareActivity.finish.put" noRight={null}><span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span></AuthButton>
|
|
102
|
+ <AuthButton name="admin.taShareActivity.finish.put" noRight={null}><span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span></AuthButton>
|
103
|
103
|
}
|
104
|
104
|
{row.activityStatus === 0 &&
|
105
|
|
- <AuthButton name="admin.taShareSuccessRecord.get" noRight={null}> <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.groupActivityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span></AuthButton>
|
|
105
|
+ <AuthButton name="admin.taShareSuccessRecord.get" noRight={null}>
|
|
106
|
+ <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={getSignList.bind(this, row.groupActivityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span>
|
|
107
|
+ </AuthButton>
|
106
|
108
|
}
|
107
|
109
|
{row.activityStatus === 0 &&
|
108
|
|
- <AuthButton name="admin.taShareActivity.list.get" noRight={null}>
|
109
|
|
- <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>
|
110
|
|
- <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{ row.sort === true ? '取消推荐首页' : '推荐首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
|
111
|
|
- </AuthButton> }
|
|
110
|
+ <AuthButton name="admin.taShareActivity.list.get" noRight={null}>
|
|
111
|
+ <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>
|
|
112
|
+ <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{row.sort === true ? '取消推荐首页' : '推荐首页'}<Icon type="vertical-align-top" className={styles.edit} /></span>
|
|
113
|
+ </AuthButton>}
|
112
|
114
|
|
113
|
115
|
{row.activityStatus === 1 &&
|
114
|
|
- <AuthButton name="admin.taShareActivity.update.put" noRight={null}>
|
115
|
|
- <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditActivity(row.groupActivityId)}>编辑<Icon type="form" className={styles.edit} /></span>
|
116
|
|
- </AuthButton>
|
|
116
|
+ <AuthButton name="admin.taShareActivity.update.put" noRight={null}>
|
|
117
|
+ <span style={{ color: '#FF925C', marginRight: '20px', cursor: 'pointer' }} onClick={toEditActivity(row.groupActivityId)}>编辑<Icon type="form" className={styles.edit} /></span>
|
|
118
|
+ </AuthButton>
|
117
|
119
|
}
|
118
|
|
- {row.activityStatus === 1 &&
|
119
|
|
- <AuthButton name="admin.taShareActivity.finish.put" noRight={null}>
|
120
|
|
- <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
|
121
|
|
- </AuthButton>
|
|
120
|
+ {row.activityStatus === 1 &&
|
|
121
|
+ <AuthButton name="admin.taShareActivity.finish.put" noRight={null}>
|
|
122
|
+ <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
|
|
123
|
+ </AuthButton>
|
122
|
124
|
}
|
123
|
|
- {row.activityStatus === 1 &&
|
124
|
|
- <AuthButton name="admin.taShareActivity.weight.put" noRight={null}>
|
125
|
|
- <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>
|
126
|
|
- <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{ row.sort === true ? '取消推荐首页' : '推荐首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
|
127
|
|
- </AuthButton>
|
|
125
|
+ {row.activityStatus === 1 &&
|
|
126
|
+ <AuthButton name="admin.taShareActivity.weight.put" noRight={null}>
|
|
127
|
+ <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>
|
|
128
|
+ <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{row.sort === true ? '取消推荐首页' : '推荐首页'}<Icon type="vertical-align-top" className={styles.edit} /></span>
|
|
129
|
+ </AuthButton>
|
128
|
130
|
}
|
129
|
131
|
|
130
|
|
- {row.activityStatus === 2 &&
|
131
|
|
- <AuthButton><span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.groupActivityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span></AuthButton>
|
132
|
|
- }
|
133
|
|
- {row.activityStatus === 2 &&
|
134
|
|
- <AuthButton name="admin.taShareActivity.weight.put" noRight={null}>
|
135
|
|
- <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>
|
136
|
|
- <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{ row.sort === true ? '取消推荐首页' : '推荐首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
|
137
|
|
- </AuthButton>
|
|
132
|
+ {row.activityStatus === 2 &&
|
|
133
|
+ <AuthButton><span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={getSignList.bind(this, row.groupActivityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span></AuthButton>
|
|
134
|
+ }
|
|
135
|
+ {row.activityStatus === 2 &&
|
|
136
|
+ <AuthButton name="admin.taShareActivity.weight.put" noRight={null}>
|
|
137
|
+ <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>
|
|
138
|
+ <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{row.sort === true ? '取消推荐首页' : '推荐首页'}<Icon type="vertical-align-top" className={styles.edit} /></span>
|
|
139
|
+ </AuthButton>
|
138
|
140
|
}
|
139
|
141
|
</>
|
140
|
142
|
),
|
141
|
143
|
},
|
142
|
144
|
];
|
143
|
145
|
const getSignList = groupActivityId => {
|
144
|
|
- router.push({
|
145
|
|
- pathname: '/activity/groupActivity/helpRecord',
|
146
|
|
- query: {
|
147
|
|
- groupActivityId,
|
148
|
|
- },
|
149
|
|
- });
|
|
146
|
+ router.push({
|
|
147
|
+ pathname: '/activity/groupActivity/helpRecord',
|
|
148
|
+ query: {
|
|
149
|
+ groupActivityId,
|
|
150
|
+ },
|
|
151
|
+ });
|
150
|
152
|
}
|
151
|
|
-
|
|
153
|
+
|
152
|
154
|
const finishDynamic = (row) => {
|
153
|
|
- Modal.confirm({
|
154
|
|
- title: '结束以后将无法编辑, 是否继续?',
|
155
|
|
- okText: '确定',
|
156
|
|
- cancelText: '取消',
|
157
|
|
- onOk() {
|
158
|
|
- request({ ...apis.activity.finish, data: {dynamicId: row.dynamicId, top: ""} }).then((data) => {
|
159
|
|
- console.log(data)
|
160
|
|
- message.info('操作成功!')
|
161
|
|
- getList({ pageNum: 1, pageSize: 10 })
|
162
|
|
- }).catch((err) => {
|
163
|
|
- console.log(err)
|
164
|
|
- message.info(err.msg || err.message)
|
165
|
|
- })
|
166
|
|
- },
|
167
|
|
- });
|
168
|
|
- }
|
169
|
|
-
|
170
|
|
- //结束活动
|
171
|
|
- const endGroupActivity = (row) => () => {
|
172
|
|
- request({ ...apis.groupActivity.finish, urlData: { id: row.groupActivityId} }).then((data) => {
|
|
155
|
+ Modal.confirm({
|
|
156
|
+ title: '结束以后将无法编辑, 是否继续?',
|
|
157
|
+ okText: '确定',
|
|
158
|
+ cancelText: '取消',
|
|
159
|
+ onOk () {
|
|
160
|
+ request({ ...apis.activity.finish, data: { dynamicId: row.dynamicId, top: "" } }).then((data) => {
|
173
|
161
|
console.log(data)
|
174
|
162
|
message.info('操作成功!')
|
175
|
163
|
getList({ pageNum: 1, pageSize: 10 })
|
176
|
|
- }).catch((err) => {
|
|
164
|
+ }).catch((err) => {
|
177
|
165
|
console.log(err)
|
178
|
166
|
message.info(err.msg || err.message)
|
179
|
|
- })
|
|
167
|
+ })
|
|
168
|
+ },
|
|
169
|
+ });
|
|
170
|
+ }
|
|
171
|
+
|
|
172
|
+ //结束活动
|
|
173
|
+ const endGroupActivity = (row) => () => {
|
|
174
|
+ request({ ...apis.groupActivity.finish, urlData: { id: row.groupActivityId } }).then((data) => {
|
|
175
|
+ console.log(data)
|
|
176
|
+ message.info('操作成功!')
|
|
177
|
+ getList({ pageNum: 1, pageSize: 10 })
|
|
178
|
+ }).catch((err) => {
|
|
179
|
+ console.log(err)
|
|
180
|
+ message.info(err.msg || err.message)
|
|
181
|
+ })
|
180
|
182
|
}
|
181
|
183
|
|
182
|
184
|
//置顶
|
183
|
185
|
const topGroupActivity = (row, weight) => () => {
|
184
|
186
|
request({ ...apis.groupActivity.top, data: { groupActivityId: row.groupActivityId, weight: weight } }).then((data) => {
|
185
|
|
- console.log(data)
|
186
|
|
- message.info('操作成功!')
|
187
|
|
- getList({ pageNum: 1, pageSize: 10 })
|
|
187
|
+ console.log(data)
|
|
188
|
+ message.info('操作成功!')
|
|
189
|
+ getList({ pageNum: 1, pageSize: 10 })
|
188
|
190
|
}).catch((err) => {
|
189
|
|
- console.log(err)
|
190
|
|
- message.info(err.msg || err.message)
|
|
191
|
+ console.log(err)
|
|
192
|
+ message.info(err.msg || err.message)
|
191
|
193
|
})
|
192
|
194
|
}
|
193
|
195
|
|
194
|
196
|
//首页推荐
|
195
|
197
|
const recommendGroupActivity = (row, code) => () => {
|
196
|
198
|
request({ ...apis.groupActivity.top, data: { groupActivityId: row.groupActivityId, sort: row.sort } }).then((data) => {
|
197
|
|
- console.log(data)
|
198
|
|
- message.info('操作成功!')
|
199
|
|
- getList({ pageNum: 1, pageSize: 10 })
|
|
199
|
+ console.log(data)
|
|
200
|
+ message.info('操作成功!')
|
|
201
|
+ getList({ pageNum: 1, pageSize: 10 })
|
200
|
202
|
}).catch((err) => {
|
201
|
|
- console.log(err)
|
202
|
|
- message.info(err.msg || err.message)
|
|
203
|
+ console.log(err)
|
|
204
|
+ message.info(err.msg || err.message)
|
203
|
205
|
})
|
204
|
206
|
}
|
205
|
|
-
|
|
207
|
+
|
206
|
208
|
//发布活动
|
207
|
209
|
const sendDynamic = (row) => {
|
208
|
|
- request({ ...apis.activity.send, urlData: {id: row.dynamicId}}).then((data) => {
|
209
|
|
- message.info('操作成功!')
|
210
|
|
- getList({ pageNum: 1, pageSize: 10 });
|
211
|
|
- }).catch(err => {
|
212
|
|
- console.log(err)
|
213
|
|
- message.info(err.msg || err.message)
|
214
|
|
- })
|
|
210
|
+ request({ ...apis.activity.send, urlData: { id: row.dynamicId } }).then((data) => {
|
|
211
|
+ message.info('操作成功!')
|
|
212
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
213
|
+ }).catch(err => {
|
|
214
|
+ console.log(err)
|
|
215
|
+ message.info(err.msg || err.message)
|
|
216
|
+ })
|
215
|
217
|
}
|
216
|
|
-
|
|
218
|
+
|
217
|
219
|
const changePageNum = pageNumber => {
|
218
|
|
- getList({ pageNum: pageNumber, pageSize: 10 })
|
|
220
|
+ getList({ pageNum: pageNumber, pageSize: 10 })
|
219
|
221
|
}
|
220
|
222
|
|
221
|
223
|
// 提交事件
|
222
|
|
-const handleSubmit = (e, props) => {
|
|
224
|
+ const handleSubmit = (e, props) => {
|
223
|
225
|
e.preventDefault();
|
224
|
226
|
props.form.validateFields((err, values) => {
|
225
|
227
|
if (!err) {
|
|
@@ -229,8 +231,8 @@ const handleSubmit = (e, props) => {
|
229
|
231
|
});
|
230
|
232
|
}
|
231
|
233
|
|
232
|
|
- //重置搜索
|
233
|
|
- function handleReset() {
|
|
234
|
+ //重置搜索
|
|
235
|
+ function handleReset () {
|
234
|
236
|
props.form.resetFields();
|
235
|
237
|
}
|
236
|
238
|
|
|
@@ -272,14 +274,14 @@ const handleSubmit = (e, props) => {
|
272
|
274
|
搜索
|
273
|
275
|
</Button>
|
274
|
276
|
<Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
275
|
|
- 重置
|
|
277
|
+ 重置
|
276
|
278
|
</Button>
|
277
|
279
|
</Form.Item>
|
278
|
280
|
</Form>
|
279
|
281
|
<AuthButton name="admin.taShareActivity.post" noRight={null}>
|
280
|
282
|
<Button type="danger" className={styles.addBtn} onClick={toEditActivity()}>新增</Button>
|
281
|
283
|
</AuthButton>
|
282
|
|
- <Table dataSource={data.records} columns={columns} pagination={false} rowKey="activityList"/>
|
|
284
|
+ <Table dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
|
283
|
285
|
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
284
|
286
|
<Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
|
285
|
287
|
</div>
|