|
@@ -0,0 +1,242 @@
|
|
1
|
+import React from 'react';
|
|
2
|
+import { Form, Input, Button, Icon, Select, DatePicker } from 'antd';
|
|
3
|
+import { FormattedMessage } from 'umi-plugin-react/locale';
|
|
4
|
+import styles from '../style/GoodsList.less';
|
|
5
|
+
|
|
6
|
+/**
|
|
7
|
+ @param {*} props
|
|
8
|
+ @returns
|
|
9
|
+ */
|
|
10
|
+const { Option } = Select;
|
|
11
|
+// 提交事件
|
|
12
|
+function handleSubmit(e, props) {
|
|
13
|
+ e.preventDefault();
|
|
14
|
+ props.form.validateFields((err, values) => {
|
|
15
|
+ if (!err) {
|
|
16
|
+ console.log('提交数据: ', values)
|
|
17
|
+ }
|
|
18
|
+ });
|
|
19
|
+}
|
|
20
|
+// Change 事件
|
|
21
|
+function handleSelectChange(props) {
|
|
22
|
+ console.log(props)
|
|
23
|
+}
|
|
24
|
+// 兑换时间 组件
|
|
25
|
+class DateRange extends React.Component {
|
|
26
|
+ state = {
|
|
27
|
+ startValue: null,
|
|
28
|
+ endValue: null,
|
|
29
|
+ endOpen: false,
|
|
30
|
+ };
|
|
31
|
+
|
|
32
|
+ disabledStartDate = startValue => {
|
|
33
|
+ const { endValue } = this.state;
|
|
34
|
+ if (!startValue || !endValue) {
|
|
35
|
+ return false;
|
|
36
|
+ }
|
|
37
|
+ return startValue.valueOf() > endValue.valueOf();
|
|
38
|
+ };
|
|
39
|
+
|
|
40
|
+ disabledEndDate = endValue => {
|
|
41
|
+ const { startValue } = this.state;
|
|
42
|
+ if (!endValue || !startValue) {
|
|
43
|
+ return false;
|
|
44
|
+ }
|
|
45
|
+ return endValue.valueOf() <= startValue.valueOf();
|
|
46
|
+ };
|
|
47
|
+
|
|
48
|
+ onChange = (field, value) => {
|
|
49
|
+ this.setState({
|
|
50
|
+ [field]: value,
|
|
51
|
+ });
|
|
52
|
+
|
|
53
|
+ };
|
|
54
|
+ onStartChange = value => {
|
|
55
|
+ this.onChange('startValue', value);
|
|
56
|
+ console.log(value, "startValue")
|
|
57
|
+ };
|
|
58
|
+
|
|
59
|
+ onEndChange = value => {
|
|
60
|
+ this.onChange('endValue', value);
|
|
61
|
+ console.log(value, "endValue")
|
|
62
|
+ };
|
|
63
|
+
|
|
64
|
+ handleStartOpenChange = open => {
|
|
65
|
+ if (!open) {
|
|
66
|
+ this.setState({ endOpen: true });
|
|
67
|
+ }
|
|
68
|
+ };
|
|
69
|
+ handleEndOpenChange = open => {
|
|
70
|
+ this.setState({ endOpen: open });
|
|
71
|
+ };
|
|
72
|
+ render() {
|
|
73
|
+ const { startValue, endValue, endOpen } = this.state;
|
|
74
|
+ return (
|
|
75
|
+ <div>
|
|
76
|
+ <span style={{ marginRight: '14px' }}>兑换时间</span>
|
|
77
|
+ <DatePicker
|
|
78
|
+ disabledDate={this.disabledStartDate}
|
|
79
|
+ format="YYYY-MM-DD"
|
|
80
|
+ value={startValue}
|
|
81
|
+ placeholder="开始时间"
|
|
82
|
+ onChange={this.onStartChange}
|
|
83
|
+ onOpenChange={this.handleStartOpenChange}
|
|
84
|
+ style={{ marginRight: '14px' }}
|
|
85
|
+ />
|
|
86
|
+ <DatePicker
|
|
87
|
+ disabledDate={this.disabledEndDate}
|
|
88
|
+ format="YYYY-MM-DD"
|
|
89
|
+ value={endValue}
|
|
90
|
+ placeholder="结束时间"
|
|
91
|
+ onChange={this.onEndChange}
|
|
92
|
+ open={endOpen}
|
|
93
|
+ onOpenChange={this.handleEndOpenChange}
|
|
94
|
+ />
|
|
95
|
+ </div>
|
|
96
|
+ );
|
|
97
|
+ }
|
|
98
|
+}
|
|
99
|
+// 兑换时间 组件 end
|
|
100
|
+// 领取时间 组件
|
|
101
|
+class DateRange2 extends React.Component {
|
|
102
|
+ state = {
|
|
103
|
+ startValue2: null,
|
|
104
|
+ endValue2: null,
|
|
105
|
+ endOpen2: false,
|
|
106
|
+ };
|
|
107
|
+
|
|
108
|
+ disabledStartDate2 = startValue2 => {
|
|
109
|
+ const { endValue2 } = this.state;
|
|
110
|
+ if (!startValue2 || !endValue2) {
|
|
111
|
+ return false;
|
|
112
|
+ }
|
|
113
|
+ return startValue2.valueOf() > endValue2.valueOf();
|
|
114
|
+ };
|
|
115
|
+
|
|
116
|
+ disabledEndDate2 = endValue2 => {
|
|
117
|
+ const { startValue2 } = this.state;
|
|
118
|
+ if (!endValue2 || !startValue2) {
|
|
119
|
+ return false;
|
|
120
|
+ }
|
|
121
|
+ return endValue2.valueOf() <= startValue2.valueOf();
|
|
122
|
+ };
|
|
123
|
+
|
|
124
|
+ onChange = (field, value) => {
|
|
125
|
+ this.setState({
|
|
126
|
+ [field]: value,
|
|
127
|
+ });
|
|
128
|
+ };
|
|
129
|
+ onStartChange2 = value => {
|
|
130
|
+ this.onChange('startValue2', value);
|
|
131
|
+ console.log(value, "startValue2")
|
|
132
|
+ };
|
|
133
|
+
|
|
134
|
+ onEndChange2 = value => {
|
|
135
|
+ this.onChange('endValue2', value);
|
|
136
|
+ console.log(value, "endValue2")
|
|
137
|
+ };
|
|
138
|
+
|
|
139
|
+ handleStartOpenChange2 = open => {
|
|
140
|
+ if (!open) {
|
|
141
|
+ this.setState({ endOpen2: true });
|
|
142
|
+ }
|
|
143
|
+ };
|
|
144
|
+ handleEndOpenChange2 = open => {
|
|
145
|
+ this.setState({ endOpen2: open });
|
|
146
|
+ };
|
|
147
|
+ render() {
|
|
148
|
+ const { startValue2, endValue2, endOpen2 } = this.state;
|
|
149
|
+ return (
|
|
150
|
+ <div>
|
|
151
|
+ <span style={{ marginRight: '14px' }}>领取时间</span>
|
|
152
|
+ <DatePicker
|
|
153
|
+ disabledDate={this.disabledStartDate2}
|
|
154
|
+ format="YYYY-MM-DD"
|
|
155
|
+ value={startValue2}
|
|
156
|
+ placeholder="开始时间"
|
|
157
|
+ onChange={this.onStartChange2}
|
|
158
|
+ onOpenChange={this.handleStartOpenChange2}
|
|
159
|
+ style={{ marginRight: '14px' }}
|
|
160
|
+ />
|
|
161
|
+ <DatePicker
|
|
162
|
+ disabledDate={this.disabledEndDate2}
|
|
163
|
+ format="YYYY-MM-DD"
|
|
164
|
+ value={endValue2}
|
|
165
|
+ placeholder="结束时间"
|
|
166
|
+ onChange={this.onEndChange2}
|
|
167
|
+ open={endOpen2}
|
|
168
|
+ onOpenChange={this.handleEndOpenChange2}
|
|
169
|
+ />
|
|
170
|
+ </div>
|
|
171
|
+ );
|
|
172
|
+ }
|
|
173
|
+}
|
|
174
|
+// 领取时间 组件 end
|
|
175
|
+
|
|
176
|
+function record(props) {
|
|
177
|
+ const { getFieldDecorator } = props.form
|
|
178
|
+
|
|
179
|
+ return (
|
|
180
|
+
|
|
181
|
+ <>
|
|
182
|
+ <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
|
|
183
|
+ <Form.Item>
|
|
184
|
+ {getFieldDecorator('name')(
|
|
185
|
+ <Input
|
|
186
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
187
|
+ placeholder="用户姓名"
|
|
188
|
+ />,
|
|
189
|
+ )}
|
|
190
|
+ </Form.Item>
|
|
191
|
+ <Form.Item>
|
|
192
|
+ {getFieldDecorator('phone')(
|
|
193
|
+ <Input
|
|
194
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
195
|
+ placeholder="手机号"
|
|
196
|
+ />,
|
|
197
|
+ )}
|
|
198
|
+ </Form.Item>
|
|
199
|
+ <Form.Item>
|
|
200
|
+ {getFieldDecorator('goodName')(
|
|
201
|
+ <Input
|
|
202
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
203
|
+ placeholder="商品名称"
|
|
204
|
+ />,
|
|
205
|
+ )}
|
|
206
|
+ </Form.Item>
|
|
207
|
+ <Form.Item>
|
|
208
|
+ {getFieldDecorator('type')(
|
|
209
|
+ <Select style={{ width: '200px' }} placeholder="用户类型" onChange={handleSelectChange}>
|
|
210
|
+ <Option value="2">置业顾问</Option>
|
|
211
|
+ <Option value="1">销售主管</Option>
|
|
212
|
+ <Option value="0">经纪人</Option>
|
|
213
|
+ </Select>,
|
|
214
|
+ )}
|
|
215
|
+ </Form.Item>
|
|
216
|
+ <Form.Item>
|
|
217
|
+ {getFieldDecorator('state')(
|
|
218
|
+ <Select style={{ width: '200px' }} placeholder="状态" onChange={handleSelectChange}>
|
|
219
|
+ <Option value="1">已领取</Option>
|
|
220
|
+ <Option value="0">未领取</Option>
|
|
221
|
+ </Select>,
|
|
222
|
+ )}
|
|
223
|
+ </Form.Item>
|
|
224
|
+
|
|
225
|
+ <Form.Item>
|
|
226
|
+ <Button type="primary" htmlType="submit" className={styles.searchBtn}>
|
|
227
|
+ 搜索
|
|
228
|
+ </Button>
|
|
229
|
+ </Form.Item>
|
|
230
|
+ <Form.Item>
|
|
231
|
+ <DateRange />
|
|
232
|
+ </Form.Item>
|
|
233
|
+ <Form.Item>
|
|
234
|
+ <DateRange2 />
|
|
235
|
+ </Form.Item>
|
|
236
|
+ </Form>
|
|
237
|
+ </>
|
|
238
|
+ )
|
|
239
|
+}
|
|
240
|
+const WrappedHeader = Form.create({ name: 'record' })(record);
|
|
241
|
+
|
|
242
|
+export default WrappedHeader
|