|
@@ -1,5 +1,5 @@
|
1
|
1
|
import React, { useState, useEffect } from 'react';
|
2
|
|
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
|
|
2
|
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker, notification } from 'antd';
|
3
|
3
|
import { FormattedMessage } from 'umi-plugin-react/locale';
|
4
|
4
|
import router from 'umi/router';
|
5
|
5
|
import moment from 'moment';
|
|
@@ -17,9 +17,9 @@ const header = props => {
|
17
|
17
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
18
|
18
|
const [data, setData] = useState({ list: [], total: 0 })
|
19
|
19
|
// const [page, changePage] = useState({})
|
|
20
|
+ const [houseIdList, setHouseIdList] = useState([])
|
20
|
21
|
const [time, setTime] = useState('')
|
21
|
22
|
|
22
|
|
- //==========看这里-- 新功能都用house为中间单词,我已经创建好了,你只要修改list的指向链接就行,看完删除=========
|
23
|
23
|
// 查询列表
|
24
|
24
|
const getList = params => {
|
25
|
25
|
request({ ...apis.house.taSalesBatch, params: { ...params } }).then(data => {
|
|
@@ -33,7 +33,7 @@ const header = props => {
|
33
|
33
|
getList({ pageNum: 1, pageSize: 10 });
|
34
|
34
|
}, [])
|
35
|
35
|
|
36
|
|
- // 跳转到编辑商品
|
|
36
|
+ // 跳转到编辑
|
37
|
37
|
const toAddHouse = rowData => () => {
|
38
|
38
|
if(rowData) {
|
39
|
39
|
router.push({
|
|
@@ -50,6 +50,30 @@ const header = props => {
|
50
|
50
|
});
|
51
|
51
|
}
|
52
|
52
|
|
|
53
|
+ function openNotificationWithIcon(type, message) {
|
|
54
|
+ notification[type]({
|
|
55
|
+ message,
|
|
56
|
+ description:
|
|
57
|
+ '',
|
|
58
|
+ });
|
|
59
|
+ }
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+ const toDelBatch = rowData => () =>{
|
|
63
|
+ console.log(houseIdList, 'houseIdListhouseIdList')
|
|
64
|
+ if(houseIdList.length < 1){
|
|
65
|
+ openNotificationWithIcon('error', '请先选择需要删除的批次')
|
|
66
|
+ return
|
|
67
|
+ }
|
|
68
|
+ console.log(houseIdList,'houseIdListhouseIdList');
|
|
69
|
+ request({ ...apis.house.deleteTaSalesBatch, data: houseIdList, }).then((data) => {
|
|
70
|
+ message.info("操作成功")
|
|
71
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
72
|
+ }).catch((err) => {
|
|
73
|
+ // message.info(err.msg)
|
|
74
|
+ })
|
|
75
|
+ }
|
|
76
|
+
|
53
|
77
|
const newQrcode = row => {
|
54
|
78
|
const x = new XMLHttpRequest();
|
55
|
79
|
const resourceUrl = row.qrCode
|
|
@@ -66,23 +90,6 @@ const header = props => {
|
66
|
90
|
x.send();
|
67
|
91
|
}
|
68
|
92
|
|
69
|
|
- const getActivityDetail = (dynamicId) => () => {
|
70
|
|
- router.push({
|
71
|
|
- pathname: '/activity/detailActivity',
|
72
|
|
- query: {
|
73
|
|
- dynamicId,
|
74
|
|
- },
|
75
|
|
- });
|
76
|
|
- }
|
77
|
|
-
|
78
|
|
- const getJoinPeople = (dynamicId) => () => {
|
79
|
|
- router.push({
|
80
|
|
- pathname: '/activity/SignList',
|
81
|
|
- query: {
|
82
|
|
- dynamicId,
|
83
|
|
- },
|
84
|
|
- });
|
85
|
|
- }
|
86
|
93
|
/**
|
87
|
94
|
*
|
88
|
95
|
*
|
|
@@ -140,98 +147,17 @@ const header = props => {
|
140
|
147
|
});
|
141
|
148
|
}
|
142
|
149
|
|
143
|
|
- const finishDynamic = row => {
|
144
|
|
- Modal.confirm({
|
145
|
|
- title: '活动会被强制结束,小程序端无法再发起或参与此活动,如果不想让客户看到活动,请再点击取消发布按钮',
|
146
|
|
- okText: '确定',
|
147
|
|
- cancelText: '取消',
|
148
|
|
- onOk () {
|
149
|
|
- request({ ...apis.activity.finish, data: { dynamicId: row.dynamicId, top: '' } }).then(data => {
|
150
|
|
- console.log(data)
|
151
|
|
- message.info('操作成功!')
|
152
|
|
- getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
|
153
|
|
- }).catch(err => {
|
154
|
|
- console.log(err)
|
155
|
|
- message.info(err.msg || err.message)
|
156
|
|
- })
|
157
|
|
- },
|
158
|
|
- });
|
159
|
|
- }
|
160
|
|
-
|
161
|
|
- // 置顶
|
162
|
|
- const topDynamic = row => () => {
|
163
|
|
- const weight = Math.abs(row.weight - 1)
|
164
|
|
- request({ ...apis.activity.weight, params: { dynamicId: row.dynamicId, weight } }).then(data => {
|
165
|
|
- console.log(data)
|
166
|
|
- message.info('操作成功!')
|
167
|
|
- getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
|
168
|
|
- }).catch(err => {
|
169
|
|
- console.log(err)
|
170
|
|
- message.info(err.msg || err.message)
|
171
|
|
- })
|
172
|
|
- }
|
173
|
|
-
|
174
|
|
- // 推首页
|
175
|
|
- const homeDynamic = row => () => {
|
176
|
|
- const home = Math.abs(row.home - 1)
|
177
|
|
- request({ ...apis.activity.home, params: { dynamicId: row.dynamicId, home } }).then(data => {
|
178
|
|
- console.log(data)
|
179
|
|
- message.info('操作成功!')
|
180
|
|
- getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
|
181
|
|
- }).catch(err => {
|
182
|
|
- console.log(err)
|
183
|
|
- message.info(err.msg || err.message)
|
184
|
|
- })
|
185
|
|
- }
|
186
|
|
-
|
187
|
|
- const sendOrPublicDynamic = row => {
|
188
|
|
- if (row.status === 1) {
|
189
|
|
- cancelDynamic(row)
|
190
|
|
- } else {
|
191
|
|
- sendDynamic(row)
|
192
|
|
- }
|
193
|
|
- }
|
194
|
|
-
|
195
|
|
- // 取消活动
|
196
|
|
- const cancelDynamic = row => {
|
197
|
|
- Modal.confirm({
|
198
|
|
- title: '活动会在小程序端隐藏,后台可以继续编辑重新发布',
|
199
|
|
- okText: '确认',
|
200
|
|
- cancelText: '取消',
|
201
|
|
- onOk() {
|
202
|
|
- request({ ...apis.activity.cancel, urlData: { id: row.dynamicId } }).then(data => {
|
203
|
|
- message.info('操作成功!')
|
204
|
|
- getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
|
205
|
|
- }).catch(err => {
|
206
|
|
- console.log(err)
|
207
|
|
- message.info(err.msg || err.message)
|
208
|
|
- })
|
209
|
|
- }
|
210
|
|
- });
|
211
|
|
- }
|
212
|
|
-
|
213
|
|
- // 发布活动
|
214
|
|
- const sendDynamic = row => {
|
215
|
|
- Modal.confirm({
|
216
|
|
- title: '确定发布吗?',
|
217
|
|
- okText: '确认',
|
218
|
|
- cancelText: '取消',
|
219
|
|
- onOk() {
|
220
|
|
- request({ ...apis.activity.send, urlData: { id: row.dynamicId } }).then(data => {
|
221
|
|
- message.info('操作成功!')
|
222
|
|
- getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() });
|
223
|
|
- }).catch(err => {
|
224
|
|
- console.log(err)
|
225
|
|
- message.info(err.msg || err.message)
|
226
|
|
- })
|
227
|
|
- }
|
228
|
|
- });
|
229
|
|
- }
|
230
|
|
-
|
231
|
150
|
const changePageNum = pageNumber => {
|
232
|
151
|
getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
|
233
|
152
|
}
|
234
|
153
|
|
|
154
|
+ const rowSelection = {
|
|
155
|
+ onChange: (selectedRowKeys, selectedRows) => {
|
|
156
|
+ console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
|
|
157
|
+ setHouseIdList(selectedRows)
|
|
158
|
+ },
|
|
159
|
+ };
|
|
160
|
+
|
235
|
161
|
// 提交事件
|
236
|
162
|
const handleSubmit = e => {
|
237
|
163
|
e.preventDefault();
|
|
@@ -302,10 +228,13 @@ const header = props => {
|
302
|
228
|
</Button>
|
303
|
229
|
</Form.Item>
|
304
|
230
|
</Form>
|
305
|
|
- <AuthButton name="admin.buildingDynamic.add.post" noRight={null}>
|
|
231
|
+ <AuthButton name="admin.salesBatch.add.post" noRight={null}>
|
306
|
232
|
<Button type="danger" className={styles.addBtn} onClick={toAddHouse()}>新增</Button>
|
307
|
233
|
</AuthButton>
|
308
|
|
- <Table
|
|
234
|
+ <AuthButton name="admin.salesBatch.del" noRight={null}>
|
|
235
|
+ <Button type="primary" className={styles.addBtn} onClick={toDelBatch()} style={{marginLeft:'30px'}}>删除</Button>
|
|
236
|
+ </AuthButton>
|
|
237
|
+ <Table rowSelection={rowSelection}
|
309
|
238
|
dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
|
310
|
239
|
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
311
|
240
|
<Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current}/>
|