|
@@ -1,27 +1,88 @@
|
1
|
|
-import React from 'react';
|
2
|
|
-import { Form, Input, Button, Icon, Select } from 'antd';
|
|
1
|
+import React, { useState, useEffect } from 'react';
|
|
2
|
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert } from 'antd';
|
3
|
3
|
import { FormattedMessage } from 'umi-plugin-react/locale';
|
4
|
|
-import styles from '../style/GoodsList.less';
|
|
4
|
+import channels from '../channel/channelList.less';
|
|
5
|
+import router from 'umi/router';
|
|
6
|
+import request from '../../utils/request'
|
5
|
7
|
|
|
8
|
+const { TextArea } = Input;
|
|
9
|
+const { Option } = Select;
|
6
|
10
|
|
|
11
|
+const header = props => {
|
7
|
12
|
|
8
|
|
-/**
|
9
|
|
- *
|
10
|
|
- *
|
11
|
|
- * @param {*} props
|
12
|
|
- * @returns
|
13
|
|
- */
|
|
13
|
+ const [data, setData] = useState({ channelNmae: [], result: [] })
|
14
|
14
|
|
|
15
|
+ function goBack(){
|
|
16
|
+ router.push({
|
|
17
|
+ pathname: '/integralMall/GoodsList',
|
|
18
|
+ });
|
|
19
|
+ }
|
15
|
20
|
|
16
|
|
-function header(props) {
|
17
|
|
- const { getFieldDecorator } = props.form
|
18
|
|
- return (
|
|
21
|
+ function addChannel(params) {
|
|
22
|
+ request({
|
|
23
|
+ url: '/api/admin/channel',
|
|
24
|
+ method: 'POST',
|
|
25
|
+ data: { ...params },
|
|
26
|
+ // eslint-disable-next-line no-shadow
|
|
27
|
+ }).then(data => {
|
|
28
|
+ console.log(data)
|
|
29
|
+ setData(data)
|
|
30
|
+ // eslint-disable-next-line no-unused-expressions
|
|
31
|
+ router.go(-1)
|
|
32
|
+ })
|
|
33
|
+ }
|
|
34
|
+
|
|
35
|
+ function handleSubmit(e) {
|
|
36
|
+ e.preventDefault();
|
|
37
|
+ props.form.validateFields((err, values) => {
|
|
38
|
+ if (!err) {
|
|
39
|
+ console.log('Received values of form: ', values);
|
|
40
|
+ // eslint-disable-next-line max-len
|
|
41
|
+ addChannel({ channelName: values.channelName, channelContact: values.channelContact, contactTel: values.contactTel })
|
|
42
|
+ }
|
|
43
|
+ });
|
|
44
|
+ }
|
19
|
45
|
|
|
46
|
+ const { getFieldDecorator } = props.form;
|
|
47
|
+
|
|
48
|
+ return (
|
20
|
49
|
<>
|
21
|
|
- <div>编辑商品</div>
|
|
50
|
+ <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
|
|
51
|
+ <Form.Item label="商品名称">
|
|
52
|
+ {getFieldDecorator('channelName', {
|
|
53
|
+ rules: [{ message: '请输入商品名称' }],
|
|
54
|
+ })(<Input className={channels.inpuit} />)}
|
|
55
|
+ </Form.Item>
|
|
56
|
+ <Form.Item label="所需积分">
|
|
57
|
+ {getFieldDecorator('channelContact', {
|
|
58
|
+ rules: [{ message: ' 请输入所需积分' }],
|
|
59
|
+ })(<Input className={channels.inpuit} />)}
|
|
60
|
+ </Form.Item>
|
|
61
|
+ <Form.Item label="商品数量">
|
|
62
|
+ {getFieldDecorator('contactTel', {
|
|
63
|
+ rules: [{ message: '请输入商品数量' }],
|
|
64
|
+ })(<Input className={channels.inpuit} />)}
|
|
65
|
+ </Form.Item>
|
|
66
|
+ <Form.Item label="剩余数量">
|
|
67
|
+ {getFieldDecorator('contactTel', {
|
|
68
|
+ rules: [{ message: '请输入剩余数量' }],
|
|
69
|
+ })(<Input className={channels.inpuit} />)}
|
|
70
|
+ </Form.Item>
|
|
71
|
+ <Form.Item label="商品详情">
|
|
72
|
+ <TextArea className={channels.inpuitTxt} rows={8} />
|
|
73
|
+ </Form.Item>
|
|
74
|
+ <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
|
|
75
|
+ <Button type="primary" htmlType="submit">
|
|
76
|
+ 保存
|
|
77
|
+ </Button>
|
|
78
|
+ <Button className={channels.formButton} onClick={this.goBack} type="primary" htmlType="submit">
|
|
79
|
+ 取消
|
|
80
|
+ </Button>
|
|
81
|
+ </Form.Item>
|
|
82
|
+ </Form>
|
22
|
83
|
</>
|
23
|
84
|
)
|
24
|
85
|
}
|
25
|
|
-const WrappedHeader = Form.create({ name: 'header' })(header);
|
26
|
86
|
|
27
|
|
-export default WrappedHeader
|
|
87
|
+const WrappedNormalLoginForm = Form.create({ name: 'header' })(header);
|
|
88
|
+export default WrappedNormalLoginForm
|