Bladeren bron

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

魏熙美 5 jaren geleden
bovenliggende
commit
8b4c22cedc

+ 20
- 6
config/config.js Bestand weergeven

@@ -218,6 +218,11 @@ export default {
218 218
                   name: '',
219 219
                   component: './channel/addChannel',
220 220
                 },
221
+                {
222
+                  path: '/channel/editChannel',
223
+                  name: '',
224
+                  component: './channel/editChannel',
225
+                },
221 226
                 {
222 227
                   path: '/channel/brokerList',
223 228
                   name: '经纪人',
@@ -225,12 +230,12 @@ export default {
225 230
                 },
226 231
                 {
227 232
                   path: '/channel/recommendClients',
228
-                  name: '推荐客户',
233
+                  name: '',
229 234
                   component: './channel/recommendClients',
230 235
                 },
231 236
                 {
232 237
                   path: '/channel/InviteClients',
233
-                  name: '邀请经纪人',
238
+                  name: '',
234 239
                   component: './channel/InviteClients',
235 240
                 },
236 241
               ],
@@ -241,13 +246,18 @@ export default {
241 246
               component: '../layouts/BlankLayout',
242 247
               routes: [
243 248
                 {
244
-                  path: '/news/NewsType',
249
+                  path: '/news/type/NewsType',
245 250
                   name: '资讯类型',
246 251
                   component: './news/type/NewsType',
247 252
                 },
248 253
                 {
249
-                  path: '/news/NewsList',
250
-                  name: '咨询列表',
254
+                  path: '/news/type/editNews',
255
+                  name: '',
256
+                  component: './news/type/editNews',
257
+                },
258
+                {
259
+                  path: '/news/list/NewsList',
260
+                  name: '资讯列表',
251 261
                   component: './news/list/NewsList',
252 262
                 },
253 263
               ],
@@ -291,6 +301,10 @@ export default {
291 301
   // Theme for antd: https://ant.design/docs/react/customize-theme-cn
292 302
   theme: {
293 303
     'primary-color': primaryColor,
304
+    'btn-primary-bg': '#EF273A',
305
+    'table-row-hover-bg': '#eee',
306
+    'btn-danger-bg': '#FF7E48',
307
+
294 308
   },
295 309
   define: {
296 310
     ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
@@ -333,7 +347,7 @@ export default {
333 347
 
334 348
   proxy: {
335 349
     '/api/': {
336
-      target: 'http://localhost:8080/',
350
+      target: 'http://192.168.0.84:8080/',
337 351
       changeOrigin: true,
338 352
       // pathRewrite: { '^/server': '' },
339 353
     },

+ 22
- 5
src/components/Wangedit/Wangedit.jsx Bestand weergeven

@@ -8,7 +8,10 @@ import E from 'wangeditor'
8 8
 class Wangedit extends React.Component {
9 9
   constructor(props, context) {
10 10
     super(props, context);
11
-    this.state = {}
11
+    this.state = {
12
+      html: undefined,
13
+    }
14
+    this.editor = undefined;
12 15
   }
13 16
 
14 17
   render() {
@@ -20,11 +23,25 @@ class Wangedit extends React.Component {
20 23
 
21 24
   componentDidMount() {
22 25
     const elem = this.refs.editorElem
23
-    const editor = new E(elem)
26
+    this.editor = new E(elem)
24 27
     // 使用 onchange 函数监听内容的变化
25
-    editor.customConfig.onchange = this.props.onChange
26
-    editor.create()
27
-    editor.txt.html(this.props.value)
28
+    this.editor.customConfig.onchange = html => {
29
+      this.setState({ html })
30
+
31
+      if (typeof this.props.onChange === 'function') {
32
+        this.props.onChange(html)
33
+      }
34
+    }
35
+    this.editor.create()
36
+    this.editor.txt.html(this.props.value)
37
+  }
38
+
39
+  componentDidUpdate(props, state) {
40
+    if (this.props.value && !state.html) {
41
+      if (this.editor) {
42
+        this.editor.txt.html(this.props.value)
43
+      }
44
+    }
28 45
   }
29 46
 }
30 47
 

+ 1
- 1
src/components/XForm/WrapperItem.jsx Bestand weergeven

@@ -84,7 +84,7 @@ const WrapperItem = (props) => {
84 84
     return <></>;
85 85
   }
86 86
 
87
-  const SelectOpts = (dict || []).map((item, index) => (<Option value={item.value}>{item.name}</Option>))
87
+  const SelectOpts = (dict || []).map((item, index) => (<Option value={item.value}>{item.label}</Option>))
88 88
 
89 89
   let Field = <></>;
90 90
   if (render) {

+ 1
- 1
src/layouts/BasicLayout.jsx Bestand weergeven

@@ -100,7 +100,7 @@ const BasicLayout = props => {
100 100
       }}
101 101
       footerRender={footerRender}
102 102
       menuDataRender={menuDataRender}
103
-      formatMessage={formatMessage}
103
+      // formatMessage={formatMessage}
104 104
       rightContentRender={rightProps => <RightContent {...rightProps} />}
105 105
       {...props}
106 106
       {...settings}

+ 26
- 32
src/pages/Welcome.jsx Bestand weergeven

@@ -17,39 +17,33 @@ import { FormattedMessage } from 'umi-plugin-react/locale';
17 17
 // );
18 18
 
19 19
 export default () => (
20
-  <div className="gutter-example">
21
-    <Row gutter={20} type="flex" justify="space-around" align="middle">
22
-      <Col className="gutter-row" span={7} style={{
23
-        background: 'linear-gradient(180deg,rgba(246,168,30,1) 0%,rgba(250,86,139,1) 100%)', height: '150px',
24
-        boxShadow: '0px 1px 5px 1px rgba(0,0,0,0.2)',
25
-        borderRadius: '12px'
20
+  <>
21
+    <div style={{ display: 'flex' }}>
22
+      <div style={{
23
+        textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(144deg,rgba(241,43,62,1) 0%,rgba(254,144,155,1) 100%)', height: '100px',
24
+        boxShadow: '0px 18px 14px -15px rgba(241,43,62,1)',
25
+        borderRadius: '12px', width: '32%', marginRight: '2%'
26 26
       }}>
27
-        <div className="gutter-box" style={{ textAlign: 'center' }}>
28
-          <p className="gutter-tit" style={{ fontSize: '24px', color: '#fff', margin: '26px 0 0 0 ' }}>总用户</p>
29
-          <p className="gutter-num" style={{ fontSize: '51px', color: '#fff', margin: '0' }}>133</p>
30
-        </div>
31
-      </Col>
32
-      <Col className="gutter-row" span={7} style={{
33
-        background: 'linear-gradient(180deg,rgba(78,239,186,1) 0%,rgba(63,197,224,1) 100%)', height: '150px',
34
-        boxShadow: '0px 1px 5px 1px rgba(0,0,0,0.2)',
35
-        borderRadius: '12px'
27
+        <span style={{ fontSize: '24px', color: '#fff' }}>总用户 </span>
28
+        <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>133</span>
29
+      </div>
30
+      <div style={{
31
+        textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(144deg,rgba(255,126,74,1) 0%,rgba(255,196,168,1) 100%)', height: '100px',
32
+        boxShadow: '0px 18px 14px -15px rgba(255,126,74,1)',
33
+        borderRadius: '12px', width: '32%', marginRight: '2%'
36 34
       }}>
37
-        <div className="gutter-box" style={{ textAlign: 'center' }}>
38
-          <p className="gutter-tit" style={{ fontSize: '24px', color: '#fff', margin: '24px 0 0 0 ' }}>总注册用户</p>
39
-          <p className="gutter-num" style={{ fontSize: '51px', color: '#fff', margin: '0' }}>76</p>
40
-        </div>
41
-      </Col>
42
-      <Col className="gutter-row" span={7} style={{
43
-        background: 'linear-gradient(180deg,rgba(77,231,247,1) 0%,rgba(89,49,238,1) 100%)', height: '150px',
44
-        boxShadow: '0px 1px 5px 1px rgba(0,0,0,0.2)',
45
-        borderRadius: '12px'
35
+        <span style={{ fontSize: '24px', color: '#fff' }}>总注册用户 </span>
36
+        <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>12</span>
37
+      </div>
38
+      <div style={{
39
+        textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(137deg,rgba(107,130,230,1) 0%,rgba(152,175,251,1) 100%)', height: '100px',
40
+        boxShadow: '0px 18px 14px -15px rgba(107,130,230,1)',
41
+        borderRadius: '12px', width: '32%',
46 42
       }}>
47
-        <div className="gutter-box" style={{ textAlign: 'center' }}>
48
-          <p className="gutter-tit" style={{ fontSize: '24px', color: '#fff', margin: '26px 0 0 0 ' }}>最近7天新增</p>
49
-          <p className="gutter-num" style={{ fontSize: '51px', color: '#fff', margin: '0' }}>24</p>
50
-        </div>
51
-      </Col>
52
-    </Row>
53
-  </div>
54
-
43
+        <span style={{ fontSize: '24px', color: '#fff' }}>最近7天新增 </span>
44
+        <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>91</span>
45
+      </div>
46
+    </div>
47
+    <div>11111111111111</div>
48
+  </>
55 49
 );

+ 1
- 0
src/pages/activity/editActivity.jsx Bestand weergeven

@@ -155,6 +155,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
155 155
         })
156 156
       }
157 157
     }
158
+    
158 159
     return <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
159 160
   }
160 161
   

+ 68
- 53
src/pages/channel/InviteClients.jsx Bestand weergeven

@@ -1,46 +1,31 @@
1
-import React from 'react';
1
+
2
+import React, { useState, useEffect } from 'react';
2 3
 import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select } from 'antd';
3 4
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 5
 import channels from './channelList.less';
5 6
 import router from 'umi/router';
7
+import request from '../../utils/request'
6 8
 
7 9
 const { Option } = Select;
8 10
 function handleChange(value) {
9 11
   console.log(`selected ${value}`);
10 12
 }
11 13
 
12
-
13
-const menu = (
14
-  <Menu onClick={handleMenuClick}>
15
-    <Menu.Item key="1">
16
-      <Icon type="user" />
17
-      1st menu item
18
-    </Menu.Item>
19
-    <Menu.Item key="2">
20
-      <Icon type="user" />
21
-      2nd menu item
22
-    </Menu.Item>
23
-    <Menu.Item key="3">
24
-      <Icon type="user" />
25
-      3rd item
26
-    </Menu.Item>
27
-  </Menu>
28
-);
29
-const dataSource = [
30
-  {
31
-    key: '1',
32
-    img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
33
-    name: '123',
34
-    age: 32,
35
-    address: '西湖区湖底公园1号',
36
-  },
37
-  {
38
-    key: '2',
39
-    img: '',
40
-    age: 42,
41
-    address: '西湖区湖底公园1号',
42
-  },
43
-];
14
+// const dataSource = [
15
+//   {
16
+//     key: '1',
17
+//     img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
18
+//     name: '123',
19
+//     age: 32,
20
+//     address: '西湖区湖底公园1号',
21
+//   },
22
+//   {
23
+//     key: '2',
24
+//     img: '',
25
+//     age: 42,
26
+//     address: '西湖区湖底公园1号',
27
+//   },
28
+// ];
44 29
 
45 30
 const columns = [
46 31
   {
@@ -49,7 +34,7 @@ const columns = [
49 34
     key: 'img',
50 35
     align: 'center',
51 36
 
52
-    render: (text, record) => <img src={record.img} className={channels.touxiang} />,
37
+    render: (text, record) => <img src={record.avatarurl} className={channels.touxiang} />,
53 38
   },
54 39
   {
55 40
     title: '用户姓名',
@@ -60,32 +45,62 @@ const columns = [
60 45
   },
61 46
   {
62 47
     title: '电话',
63
-    dataIndex: 'integral',
64
-    key: 'integral',
48
+    dataIndex: 'tel',
49
+    key: 'tel',
65 50
     align: 'center',
66 51
   },
67 52
   {
68 53
     title: '性别',
69
-    dataIndex: 'total',
70
-    key: 'total',
54
+    dataIndex: 'sex',
55
+    key: 'sex',
71 56
     align: 'center',
72 57
   },
73 58
 ];
59
+const header = props => {
60
+  // eslint-disable-next-line react-hooks/rules-of-hooks
61
+  const [data, setData] = useState({ channelNmae: [], result: [] })
62
+  // eslint-disable-next-line react-hooks/rules-of-hooks
63
+  useEffect(() => {
64
+    getList({ id: props.location.query.id, pageNum: 1, pageSize: 10 })
65
+  }, [])
66
+
67
+  function getList(params) {
68
+    request({
69
+      url: '/api/admin/channel/InviteClientsList',
70
+      method: 'GET',
71
+      params: { ...params },
72
+  // eslint-disable-next-line no-shadow
73
+  }).then(data => {
74
+      console.log(data)
75
+      setData(data)
76
+  })
77
+  }
78
+  // value 的值
79
+  // eslint-disable-next-line no-shadow
80
+  function handleChange(value) {
81
+    // setQueryData({ ...queryData, channelId: value });
82
+    localStorage.setItem('value', value);
83
+  }
84
+  // 查询
85
+  function queryList() {
86
+    getList({ pageNum: 1, pageSize: 10 })
87
+  }
74 88
 
75
-// 跳转到编辑商品
76
-function toEditGoods() {
77
-  router.push({
78
-    pathname: '/channel/addChannel',
79
-    query: {
80
-      a: 'b',
81
-    },
82
-  });
83
-}
84
-export default () => (
85
-    <Table dataSource={dataSource} columns={columns} />
86
-);
87 89
 
88
-function handleMenuClick(e) {
89
-  message.info('Click on menu item.');
90
-  console.log('click', e);
90
+  // 分页
91
+  function onChange(pageNumber) {
92
+    // eslint-disable-next-line react-hooks/rules-of-hooks
93
+      getList({ pageNum: pageNumber, pageSize: 9 })
94
+  }
95
+
96
+  return (
97
+    <>
98
+      <div className={channels.searchBox}>
99
+      </div>
100
+      <Table dataSource={data.records} columns={columns} pagination={{ pageSize: 10, total: data.total, onChange }} />
101
+  </>
102
+  )
91 103
 }
104
+
105
+
106
+export default header

+ 6
- 2
src/pages/channel/addChannel.jsx Bestand weergeven

@@ -37,7 +37,10 @@ const header = props => {
37 37
       if (!err) {
38 38
         console.log('Received values of form: ', values);
39 39
         // eslint-disable-next-line max-len
40
-        addChannel({ channelName: values.channelName, channelContact: values.channelContact, contactTel: values.contactTel })
40
+        addChannel({ channelName: values.channelName,
41
+                     channelContact: values.channelContact,
42
+                     contactTel: values.contactTel,
43
+                     explain: values.explain })
41 44
       }
42 45
     });
43 46
   }
@@ -63,7 +66,8 @@ const header = props => {
63 66
           })(<Input className={channels.inpuit} />)}
64 67
         </Form.Item>
65 68
         <Form.Item label="说明描述">
66
-       <TextArea className={channels.inpuitTxt} rows={8} />
69
+        {getFieldDecorator('explain', {
70
+        })(<TextArea className={channels.inpuitTxt} rows={8} />)}
67 71
         </Form.Item>
68 72
         <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
69 73
           <Button type="primary" htmlType="submit">

+ 75
- 27
src/pages/channel/brokerList.jsx Bestand weergeven

@@ -51,7 +51,7 @@ const columns = [
51 51
     align: 'center',
52 52
 
53 53
     // eslint-disable-next-line jsx-a11y/alt-text
54
-    render: (text, record) => <img src={record.avatarurl }/>,
54
+    render: (text, list) => <img src={list.avatarurl }/>,
55 55
   },
56 56
   {
57 57
     title: '用户姓名',
@@ -61,8 +61,8 @@ const columns = [
61 61
   },
62 62
   {
63 63
     title: '电话',
64
-    dataIndex: 'tel',
65
-    key: 'tel',
64
+    dataIndex: 'phone',
65
+    key: 'phone',
66 66
     align: 'center',
67 67
   },
68 68
   {
@@ -76,64 +76,112 @@ const columns = [
76 76
     dataIndex: 'recommendCount',
77 77
     key: 'recommendCount',
78 78
     align: 'center',
79
+    render: (text, list) => <a style={ { color: '#66B3FF' } } onClick= {() => torecommend(list.personId)} >{ list.recommendCount }</a>,
79 80
   },
80 81
   {
81 82
     title: '邀请经纪人',
82
-    dataIndex: 'rest',
83
-    key: 'rest',
83
+    dataIndex: 'inviteCount',
84
+    key: 'inviteCount',
84 85
     align: 'center',
86
+    render: (text, list) => <a style={ { color: '#66B3FF' } } onClick= {() => toinvite(list.personId)} >{ list.inviteCount }</a>,
85 87
   },
86 88
 ];
87 89
 
88
-// 跳转到编辑商品
89
-function toEditGoods() {
90
+// 跳转到推荐客户
91
+function torecommend(personId) {
90 92
   router.push({
91
-    pathname: '/channel/addChannel',
93
+    pathname: '/channel/recommendClients',
92 94
     query: {
93
-      a: 'b',
95
+      id: personId,
94 96
     },
95 97
   });
96 98
 }
99
+
100
+// 跳转到邀请经纪人
101
+function toinvite(personId) {
102
+  router.push({
103
+    pathname: '/channel/InviteClients',
104
+    query: {
105
+      id: personId,
106
+    },
107
+  });
108
+}
109
+
110
+
97 111
 const header = props => {
98 112
   // eslint-disable-next-line react-hooks/rules-of-hooks
99
-  const [data, setData] = useState({})
113
+  const [data, setData] = useState({ list: [] })
114
+
115
+  // eslint-disable-next-line react-hooks/rules-of-hooks
116
+  const [queryData, setQueryData] = useState({})
100 117
 //   const [page, changePage] = useState({})
101 118
   // eslint-disable-next-line react-hooks/rules-of-hooks
102 119
   useEffect(() => {
103
-    request({
120
+    getList()
121
+  }, [])
122
+      function getList(params) {
123
+      request({
104 124
         url: '/api/admin/channel/broker',
105 125
         method: 'GET',
106
-        params: { pageNum: 1, pageSize: 10 },
126
+        params: { ...params },
107 127
     // eslint-disable-next-line no-shadow
108 128
     }).then(data => {
109 129
         console.log(data)
110 130
         setData(data)
111 131
     })
112
-  }, [])
132
+    }
133
+  // const getList = e => {
134
+  //   request({
135
+  //       url: '/api/xxx',
136
+  //       method: 'GET',
137
+  //       params: {},
138
+  //   // eslint-disable-next-line no-shadow
139
+  //   }).then(data => {
140
+  //       setData(data)
141
+  //   })
142
+  // }
143
+ // 查询
144
+ function queryList() {
145
+  getList({ ...queryData, pageNum: 1, pageSize: 10, channelId: localStorage.getItem('value') })
146
+}
147
+    // 分页
148
+    function onChange(pageNumber) {
149
+      // eslint-disable-next-line react-hooks/rules-of-hooks
150
+        getList({ pageNum: pageNumber, pageSize: 10 })
151
+    }
152
+    // 获取input的值
153
+    function onInputChangePhone (e) {
154
+      // const InputValue = e.target.name.x.value;
155
+      setQueryData({ ...queryData, name: e.target.value })
156
+   }
113 157
 
114
-  const getList = e => {
115
-    request({
116
-        url: '/api/xxx',
117
-        method: 'GET',
118
-        params: {},
119
-    // eslint-disable-next-line no-shadow
120
-    }).then(data => {
121
-        setData(data)
122
-    })
158
+   function onInputChangeName (e) {
159
+    // const InputValue = e.target.name.x.value;
160
+    setQueryData({ ...queryData, phone: e.target.value })
161
+  }
162
+  function refurbishList () {
163
+    getList({ pageNum: 1, pageSize: 10 })
164
+  }
165
+  // eslint-disable-next-line no-undef
166
+  function handleClick() {
167
+    alert('11', this)
168
+    console.log('this is:', this);
123 169
   }
124
-
125 170
 return (
126 171
   <>
127 172
     <div className={ channels.searchBox }>
128 173
       <div>
129 174
         <span className={ channels.selectName }>姓名</span>
130
-        <Input style ={{ width: 150 }} />
175
+        <Input onChange = { onInputChangePhone } style ={{ width: 150 }} />
131 176
         <span className={ channels.selectName }>电话</span>
132
-        <Input style ={{ width: 150 }}/>
177
+        <Input onChange = { onInputChangeName } style ={{ width: 150 }} />
133 178
       </div>
134
-      <Button className={channels.about}>查询</Button>
179
+      <div>
180
+      <Button type="primary" onClick={() => queryList() }>查询</Button>
181
+      <Button onClick={() => refurbishList() }>重置</Button>
182
+    </div>
135 183
     </div>
136
-    <Table dataSource={data.records} columns={columns} />
184
+    <Table dataSource={data.list} columns={columns} pagination={{ pageSize: 10, total: data.total, onChange }} />
137 185
   </>
138 186
 )
139 187
 }

+ 34
- 11
src/pages/channel/channelList.jsx Bestand weergeven

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select } from 'antd';
2
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Pagination } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import channels from './channelList.less';
5 5
 import router from 'umi/router';
@@ -81,12 +81,12 @@ const columns = [
81 81
     dataIndex: '',
82 82
     key: '',
83 83
     align: 'center',
84
-    render: () => <a style={ { color: '#66B3FF' } }>编辑</a>,
84
+    render: (text, record) => <a style={ { color: '#66B3FF' } } onClick= {() => toedit(record.channelId)} >编辑</a>,
85 85
   },
86 86
 ];
87 87
 
88
-// 跳转到编辑商品
89
-function toEditGoods() {
88
+// 跳转到添加页面
89
+function toAdd() {
90 90
   router.push({
91 91
     pathname: '/channel/addChannel',
92 92
     query: {
@@ -94,14 +94,21 @@ function toEditGoods() {
94 94
     },
95 95
   });
96 96
 }
97
+  // 跳编辑页面
98
+  function toedit(channelId) {
99
+    // alert(channelId)
100
+    router.push({
101
+      pathname: '/channel/editChannel',
102
+      query: {
103
+        id: channelId,
104
+      },
105
+    });
106
+  }
97 107
 
98 108
 const header = props => {
99 109
   // eslint-disable-next-line react-hooks/rules-of-hooks
100 110
   const [data, setData] = useState({ channelNmae: [], result: [] })
101 111
   // eslint-disable-next-line react-hooks/rules-of-hooks
102
-  // const [queryData, setQueryData] = useState({ pageNum: 1, pageSize: 10 })
103
-  //   const [page, changePage] = useState({})
104
-  // eslint-disable-next-line react-hooks/rules-of-hooks
105 112
   useEffect(() => {
106 113
     getList({ pageNum: 1, pageSize: 10 })
107 114
   }, [])
@@ -130,6 +137,23 @@ const header = props => {
130 137
  function reset() {
131 138
   getList({ pageNum: 1, pageSize: 10 })
132 139
  }
140
+
141
+ // 跳编辑页
142
+ function toEdit() {
143
+  router.push({
144
+    pathname: '/integralMall/editGoods',
145
+    query: {
146
+      a: 'b',
147
+    },
148
+  });
149
+}
150
+
151
+  // 分页
152
+  function onChange(pageNumber) {
153
+    // eslint-disable-next-line react-hooks/rules-of-hooks
154
+      getList({ pageNum: pageNumber, pageSize: 9 })
155
+  }
156
+
133 157
   return (
134 158
     <>
135 159
       <div className={channels.searchBox}>
@@ -142,15 +166,14 @@ const header = props => {
142 166
               )}
143 167
               {/* {listItems} */}
144 168
           </Select>
145
-
146 169
         </dvi>
147 170
         <div >
148
-        <Button style ={{ backgroundColor: '#00bfff' } } onClick={() => queryList() }>查询</Button>
171
+        <Button type="primary" onClick={() => queryList() }>查询</Button>
149 172
         <Button onClick={() => reset() }>重置</Button>
150 173
         </div>
151 174
       </div>
152
-      <Button className={channels.addBtn} onClick={toEditGoods}>新增</Button>
153
-      <Table dataSource={data.result.records} columns={columns} />
175
+      <Button type="danger" onClick={toAdd}>新增</Button>
176
+      <Table dataSource={data.result.records} columns={columns} pagination={{ pageSize: 10, total: data.result.total, onChange }} />
154 177
   </>
155 178
   )
156 179
 }

+ 1
- 1
src/pages/channel/channelList.less Bestand weergeven

@@ -32,7 +32,7 @@
32 32
 .about {
33 33
   padding: 0 30px;
34 34
   height: 36px;
35
-  background-color: #00bfff;
35
+  background-color:rgba(255,255,255,1);
36 36
   color: #fff;
37 37
   margin: 30px 0;
38 38
 }

+ 89
- 0
src/pages/channel/editChannel.jsx Bestand weergeven

@@ -0,0 +1,89 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import channels from './channelList.less';
5
+import router from 'umi/router';
6
+import request from '../../utils/request'
7
+
8
+const { TextArea } = Input;
9
+const { Option } = Select;
10
+
11
+const header = props => {
12
+
13
+  // eslint-disable-next-line react-hooks/rules-of-hooks
14
+  useEffect(() => {
15
+    getById()
16
+  }, [])
17
+  // 查询当前信息
18
+  function getById() {
19
+    request({
20
+      url: `/api/admin/channel/${props.location.query.id}`,
21
+      method: 'GET',
22
+  // eslint-disable-next-line no-shadow
23
+  }).then(data => {
24
+      props.form.setFieldsValue(data)
25
+  })
26
+  }
27
+
28
+  // 编辑
29
+  function editChannel(data) {
30
+    alert(1111111)
31
+      request({
32
+        url: `/api/admin/channel/${props.location.query.id}`,
33
+        method: 'PUT',
34
+        data: { ...data },
35
+    // eslint-disable-next-line no-shadow
36
+    }).then(data => {
37
+         // eslint-disable-next-line no-unused-expressions
38
+         router.go(-1)
39
+    })
40
+  }
41
+
42
+  function handleSubmit(e) {
43
+    e.preventDefault();
44
+    props.form.validateFields((err, values) => {
45
+      if (!err) {
46
+        console.log('values', values)
47
+        editChannel({ ...values })
48
+      }
49
+    });
50
+  }
51
+
52
+  const { getFieldDecorator } = props.form;
53
+
54
+  return (
55
+  <>
56
+        <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
57
+        <Form.Item label="渠道名称">
58
+          {getFieldDecorator('channelName', {
59
+            rules: [{ required: true, message: '请输入渠道名称' }],
60
+          })(<Input className={channels.inpuit} />)}
61
+        </Form.Item>
62
+        <Form.Item label="联系人">
63
+          {getFieldDecorator('channelContact', {
64
+            rules: [{ required: true, message: ' 请输入联系人' }],
65
+          })(<Input className={channels.inpuit} />)}
66
+        </Form.Item>
67
+        <Form.Item label="联系电话">
68
+          {getFieldDecorator('contactTel', {
69
+            rules: [{ required: true, message: '请输入联系电话' }],
70
+          })(<Input className={channels.inpuit} />)}
71
+        </Form.Item>
72
+        <Form.Item label="说明描述">
73
+        {getFieldDecorator('explain', {
74
+        })(<TextArea className={channels.inpuitTxt} rows={8} />)}
75
+        </Form.Item>
76
+        <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
77
+          <Button type="primary" htmlType="submit">
78
+            保存
79
+          </Button>
80
+          <Button className={channels.formButton} onClick = {() => router.go(-1)} type="primary" htmlType="submit">
81
+            取消
82
+          </Button>
83
+        </Form.Item>
84
+      </Form>
85
+  </>
86
+)
87
+}
88
+const WrappedNormalLoginForm = Form.create({ name: 'header' })(header);
89
+export default WrappedNormalLoginForm

+ 17
- 27
src/pages/channel/recommendClients.jsx Bestand weergeven

@@ -91,46 +91,36 @@ const columns = [
91 91
   },
92 92
 ];
93 93
 
94
-// 跳转到编辑商品
95
-function toEditGoods() {
96
-  router.push({
97
-    pathname: '/channel/addChannel',
98
-    query: {
99
-      a: 'b',
100
-    },
101
-  });
102
-}
103 94
 const header = props => {
104 95
   // eslint-disable-next-line react-hooks/rules-of-hooks
105 96
   const [data, setData] = useState({})
106 97
 //   const [page, changePage] = useState({})
107 98
   // eslint-disable-next-line react-hooks/rules-of-hooks
108 99
   useEffect(() => {
109
-    request({
110
-        url: '/api/admin/customer/recommend/recommender',
111
-        method: 'GET',
112
-        params: { pageNum: 1, pageSize: 10 },
113
-    // eslint-disable-next-line no-shadow
114
-    }).then(data => {
115
-        console.log(data)
116
-        setData(data)
117
-    })
100
+    getList({ pageNumber: 1, pageSize: 10 })
118 101
   }, [])
119 102
 
120
-  const getList = e => {
103
+  function getList(params) {
121 104
     request({
122
-        url: '/api/xxx',
123
-        method: 'GET',
124
-        params: {},
125
-    // eslint-disable-next-line no-shadow
126
-    }).then(data => {
127
-        setData(data)
128
-    })
105
+      url: `/api/admin/customer/recommend/${props.location.query.id}`,
106
+      method: 'GET',
107
+      params: { ...params },
108
+  // eslint-disable-next-line no-shadow
109
+  }).then(data => {
110
+      console.log(data)
111
+      setData(data)
112
+  })
129 113
   }
130 114
 
115
+
116
+   // 分页
117
+ function onChange(pageNum) {
118
+      // eslint-disable-next-line react-hooks/rules-of-hooks
119
+        getList({ pageNumber: pageNum, pageSize: 9 })
120
+    }
131 121
 return (
132 122
   <>
133
-    <Table dataSource={data.records} columns={columns} />
123
+  <Table dataSource={data.records} columns={columns} pagination={{ pageSize: 10, total: data.total, onChange }} />
134 124
   </>
135 125
 )
136 126
 }

+ 1
- 1
src/pages/customer/report/index.jsx Bestand weergeven

@@ -154,7 +154,7 @@ function body(props) {
154 154
           )}
155 155
         </Form.Item>
156 156
         <Form.Item>
157
-          <Button type="primary" htmlType="submit" className={Styles.SubmitButton}>
157
+          <Button type="primary" htmlType="submit">
158 158
             搜索
159 159
           </Button>
160 160
         </Form.Item>

+ 140
- 129
src/pages/integralMall/GoodsList.jsx Bestand weergeven

@@ -1,133 +1,148 @@
1
-import React from 'react';
1
+import React, { useState, useEffect } from 'react';
2 2
 import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal,Breadcrumb } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5 5
 import router from 'umi/router';
6
+import BuildSelect from '../../components/SelectButton/BuildSelect'
7
+
8
+import request from '../../utils/request'
6 9
 
7 10
 const { Option } = Select;
8
-// 提交事件
9
-function handleSubmit(e, props) {
10
-  e.preventDefault();
11
-  props.form.validateFields((err, values) => {
12
-    if (!err) {
13
-      console.log('提交数据: ', values)
14
-    }
15
-  });
16
-}
17
-// Change 事件
18
-function handleSelectChange(props) {
19
-  console.log(props)
20
-}
21 11
 
22
-// 分页
23
-function onChange(pageNumber) {
24
-  console.log('Page: ', pageNumber);
25
-}
26
-// 跳转到编辑商品
27
-function toEditGoods() {
28
-  router.push({
29
-    pathname: '/integralMall/editGoods',
30
-    query: {
31
-      a: 'b',
32
-    },
33
-  });
34
-}
35 12
 
36
-/**
37
- *
38
- *
39
- * @param {*} props
40
- * @returns
41
- */
13
+function header(props) {
14
+  // 获取初始化数据
15
+  const [ data, setData ] = useState({})
16
+
17
+  useEffect(() => {
18
+    getList({ pageNum: 1, pageSize: 10 });
19
+  },[])
20
+
21
+  // 查询列表
22
+  const getList = (params) => {
23
+    request({
24
+        url: '/api/admin/taGoods',
25
+        method: 'GET',
26
+        params: { ...params },
27
+    }).then((data) => {
28
+        console.log(data)
29
+        setData(data)
30
+    })
31
+  }
32
+  
33
+  // 提交事件
34
+  const handleSubmit = (e, props) => {
35
+    e.preventDefault();
36
+    props.form.validateFields((err, values) => {
37
+      if (!err) {
38
+        getList({ pageNum: 1, pageSize: 10, ...values })
39
+      }
40
+    });
41
+  }
42
+
43
+  const changePageNum = (pageNumber) => {
44
+    getList({ pageNum: pageNumber, pageSize: 10 })
45
+  }
42 46
 
43
-const dataSource = [
44
-  {
45
-    key: '1',
46
-    img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
47
-    name: '华为P30 Pro',
48
-  },
49
-  {
50
-    key: '2',
51
-    img: '',
52
-    name: '大米',
53
-  },
54
-];
55 47
 
56
-const columns = [
57
-  {
58
-    title: '商品图片',
59
-    dataIndex: 'img',
60
-    key: 'img',
61
-    align: 'center',
62
-    render: (text, record) => <img src={record.img} className={styles.touxiang} />,
63
-  },
64
-  {
65
-    title: '商品名称',
66
-    dataIndex: 'name',
67
-    key: 'name',
68
-    align: 'center',
48
+  // 跳转到编辑商品
49
+  const toEditGoods = (goodsId) => () => {
50
+    router.push({
51
+      pathname: '/integralMall/editGoods',
52
+      query: {
53
+        goodsId
54
+      },
55
+    });
56
+  }
69 57
 
70
-  },
71
-  {
72
-    title: '所属积分',
73
-    dataIndex: 'integral',
74
-    key: 'integral',
75
-    align: 'center',
76
-  },
77
-  {
78
-    title: '总数量',
79
-    dataIndex: 'total',
80
-    key: 'total',
81
-    align: 'center',
82
-  },
83
-  {
84
-    title: '已兑换数量',
85
-    dataIndex: 'exchanged',
86
-    key: 'exchanged',
87
-    align: 'center',
88
-  },
89
-  {
90
-    title: '剩余数量',
91
-    dataIndex: 'rest',
92
-    key: 'rest',
93
-    align: 'center',
94
-  },
95
-  {
96
-    title: '状态',
97
-    dataIndex: 'state',
98
-    key: 'state',
99
-    align: 'center',
100
-  },
101
-  {
102
-    title: '操作',
103
-    dataIndex: 'handle',
104
-    key: 'handle',
105
-    align: 'center',
106
-    render: () => <><span style={{ color: '#EF273A', marginRight: '20px' }} onClick={confirm}>下架<Icon type="shopping-cart" className={styles.shoppingCart} /></span><span style={{ color: '#FF925C' }} onClick={toEditGoods}>编辑<Icon type="form" className={styles.edit} /></span></>,
107
-  },
108
-];
109
-function confirm() {
110
-  Modal.confirm({
111
-    title: '确认下架该商品?',
112
-    okText: '确认',
113
-    cancelText: '取消',
114
-    onOk() {
115
-      console.log('OK');
58
+  
59
+  const changeGoodsStatus = (row) => () => {
60
+    Modal.confirm({
61
+      title: '确认下架该商品?',
62
+      okText: '确认',
63
+      cancelText: '取消',
64
+      onOk() {
65
+        request({
66
+          url: '/api/admin/taGoods/change',
67
+          method: 'PUT',
68
+          data: { ...row },
69
+        }).then((data) => {
70
+          message.info('操作成功!')
71
+          getList({ pageNum: 1, pageSize: 10 });
72
+        })
73
+      }
74
+    });
75
+  }
76
+  /**
77
+   *
78
+   *
79
+   * @param {*} props
80
+   * @returns
81
+   */
82
+  const columns = [
83
+    {
84
+      title: '商品图片',
85
+      dataIndex: 'imgUrl',
86
+      key: 'imgUrl',
87
+      align: 'center',
88
+      render: (text, record) => <img src={record.imgUrl} className={styles.touxiang} />,
116 89
     },
117
-    onCancel() {
118
-      console.log('Cancel');
90
+    {
91
+      title: '商品名称',
92
+      dataIndex: 'goodsName',
93
+      key: 'goodsName',
94
+      align: 'center',
95
+
96
+    },
97
+    {
98
+      title: '所属积分',
99
+      dataIndex: 'pointPrice',
100
+      key: 'pointPrice',
101
+      align: 'center',
102
+    },
103
+    {
104
+      title: '总数量',
105
+      dataIndex: 'totalNum',
106
+      key: 'totalNum',
107
+      align: 'center',
108
+    },
109
+    {
110
+      title: '已兑换数量',
111
+      dataIndex: 'exchanged',
112
+      key: 'exchanged',
113
+      align: 'center',
114
+      render: (x,row) => <><span>{row.totalNum - row.inventory}</span></>
115
+    },
116
+    {
117
+      title: '剩余数量',
118
+      dataIndex: 'inventory',
119
+      key: 'inventory',
120
+      align: 'center',
119 121
     },
120
-  });
122
+    {
123
+      title: '状态',
124
+      dataIndex: 'status',
125
+      key: 'status',
126
+      align: 'center',
127
+      render: (status)=> <><span>{status == 1 ? '已上架' : '未上架'}</span></>
128
+    },
129
+    {
130
+      title: '操作',
131
+      dataIndex: 'handle',
132
+      key: 'handle',
133
+      align: 'center',
134
+      render: (x, row) => <><span style={{ color: '#EF273A', marginRight: '20px' }} onClick={changeGoodsStatus(row)}>{row.status == 1 ? '下架' : '上架'}<Icon type="shopping-cart" className={styles.shoppingCart} />
135
+                            </span><span style={{ color: '#FF925C' }} onClick={toEditGoods(row.goodsId)}>编辑<Icon type="form" className={styles.edit} /></span></>,
136
+    },
137
+  ];
121 138
 
122
-}
123
-function header(props) {
124 139
   const { getFieldDecorator } = props.form
125 140
   return (
126 141
 
127 142
     <>
128 143
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
129 144
         <Form.Item>
130
-          {getFieldDecorator('name')(
145
+          {getFieldDecorator('goodsName')(
131 146
             <Input
132 147
               prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
133 148
               placeholder="商品名称"
@@ -135,34 +150,31 @@ function header(props) {
135 150
           )}
136 151
         </Form.Item>
137 152
         <Form.Item>
138
-          {getFieldDecorator('goodState')(
139
-            <Select style={{ width: '180px' }} placeholder="状态" onChange={handleSelectChange}>
140
-              <Option value="1">上架</Option>
141
-              <Option value="0">下架</Option>
153
+          {getFieldDecorator('status')(
154
+            <Select style={{ width: '180px' }} placeholder="状态">
155
+              <Option value="1">上架</Option>
156
+              <Option value="0">下架</Option>
142 157
             </Select>,
143 158
           )}
144 159
         </Form.Item>
145 160
         <Form.Item>
146
-          {getFieldDecorator('isMain')(
147
-            <Select style={{ width: '180px' }} placeholder="所属项目" onChange={handleSelectChange}>
148
-              <Option value="1">首页推荐</Option>
149
-              <Option value="0">首页未推荐</Option>
150
-            </Select>,
161
+          {getFieldDecorator('buildingId')(
162
+            <BuildSelect />,
151 163
           )}
152 164
         </Form.Item>
153 165
         <Form.Item>
154
-          {getFieldDecorator('min')(
166
+          {getFieldDecorator('priceLesser')(
155 167
             <Input
156 168
               prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
157
-              placeholder="最小积分"
169
+              placeholder="价格小"
158 170
             />,
159 171
           )}
160 172
         </Form.Item>
161 173
         <Form.Item>
162
-          {getFieldDecorator('max')(
174
+          {getFieldDecorator('priceGreater')(
163 175
             <Input
164 176
               prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
165
-              placeholder="最大积分"
177
+              placeholder="价格大"
166 178
             />,
167 179
           )}
168 180
         </Form.Item>
@@ -172,12 +184,11 @@ function header(props) {
172 184
           </Button>
173 185
         </Form.Item>
174 186
       </Form>
175
-      <Button type="primary" className={styles.addBtn} onClick={toEditGoods}>新增</Button>
176
-      <Table dataSource={dataSource} columns={columns} />
177
-      {/* 分页 */
178
-      /* <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
179
-        <Pagination showQuickJumper defaultCurrent={1} total={500} onChange={onChange} />
180
-      </div> */}
187
+      <Button type="primary" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
188
+      <Table dataSource={data.records} columns={columns} pagination={false} />
189
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
190
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
191
+      </div>
181 192
     </>
182 193
   )
183 194
 }

+ 122
- 62
src/pages/integralMall/editGoods.jsx Bestand weergeven

@@ -2,6 +2,9 @@ import React, { useState, useEffect } from 'react';
2 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 4
 import channels from '../channel/channelList.less';
5
+import BuildSelect from '../../components/SelectButton/BuildSelect'
6
+import XForm, { FieldTypes } from '../../components/XForm';
7
+import Wangedit from '../../components/Wangedit/Wangedit'
5 8
 import router from 'umi/router';
6 9
 import request from '../../utils/request'
7 10
 
@@ -9,78 +12,135 @@ const { TextArea } = Input;
9 12
 const { Option } = Select;
10 13
 
11 14
 const header = props => {
15
+  const goodsId = props.location.query.goodsId
16
+  const [ goodsData, setGoodsData ] = useState({})
17
+  if(goodsId){
18
+    useEffect(() => {
19
+      getGoodsData(goodsId);
20
+    },[])
12 21
 
13
-  const [data, setData] = useState({ channelNmae: [], result: [] })
14
-
15
-  function goBack(){
16
-    router.push({
17
-      pathname: '/integralMall/GoodsList',
18
-    });
19
-  }
20
-
21
-  function addChannel(params) {
22
+  // 查询列表
23
+  const getGoodsData = (goodsId) => {
22 24
     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)
25
+        url: '/api/admin/taGoods/' + goodsId,
26
+        method: 'GET',
27
+    }).then((data) => {
28
+        console.log(data)
29
+        setGoodsData(data)
32 30
     })
33 31
   }
32
+  }
34 33
 
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 })
34
+  const fields = [
35
+    {
36
+      label: '所属项目',
37
+      name: 'buildingId',
38
+      render: <BuildSelect />,
39
+      value: goodsData.buildingId,
40
+      rules: [
41
+        {required: true, message: '请选择所属项目'},
42
+      ]
43
+    },
44
+    {
45
+      label: '商品图片',
46
+      name: 'imgUrl',
47
+      type: FieldTypes.ImageUploader,
48
+      value: goodsData.imgUrl,
49
+    },
50
+    {
51
+      label: '商品名称',
52
+      name: 'goodsName',
53
+      type: FieldTypes.Text,
54
+      value: goodsData.goodsName,
55
+      rules: [
56
+        {required: true, message: '请输入商品名称'},
57
+      ]
58
+    },
59
+    {
60
+      label: '所需积分',
61
+      name: 'pointPrice',
62
+      type: FieldTypes.Text,
63
+      value: goodsData.pointPrice,
64
+      rules: [
65
+        {required: true, message: '请输入所需积分'},
66
+      ]
67
+    },
68
+    {
69
+      label: '商品数量',
70
+      name: 'totalNum',
71
+      type: FieldTypes.Text,
72
+      value: goodsData.totalNum,
73
+      rules: [
74
+        {required: true, message: '请输入商品数量'},
75
+      ]
76
+    },
77
+    {
78
+      label: '剩余数量',
79
+      name: 'inventory',
80
+      type: FieldTypes.Text,
81
+      value: goodsData.inventory,
82
+      rules: [
83
+        {required: true, message: '请输入剩余数量'},
84
+      ]
85
+    },
86
+    {
87
+      label: '商品详情',
88
+      name: 'goodsDescription',
89
+      render: <Wangedit />,
90
+      value: goodsData.goodsDescription,
91
+    },
92
+    {
93
+      label: '状态',
94
+      name: 'status',
95
+      type: FieldTypes.Select,
96
+      dict: [{label:"已上架",value:1},{label:"已下架",value:0}],
97
+      value: goodsData.status != null ? goodsData.status : 1,
98
+    },
99
+    {
100
+      label: '领取地址',
101
+      name: 'address',
102
+      type: FieldTypes.Text,
103
+      value: goodsData.address,
104
+      rules: [
105
+        {required: true, message: '请输入领取地址'},
106
+      ]
107
+    },
108
+  ]
109
+
110
+   
111
+  const handleSubmit = (values) => {
112
+    if(goodsId){
113
+      values.goodsId = goodsId
114
+      request({
115
+        url: '/api/admin/taGoods',
116
+        method: 'PUT',
117
+        data: values,
118
+      }).then((data) => {
119
+        cancelPage()
120
+      }).catch((err) => {
121
+        message.info(err.msg || err.message)
122
+      })
123
+      }else{
124
+      request({
125
+        url: '/api/admin/taGoods/add',
126
+        method: 'POST',
127
+        data: values,
128
+      }).then((data) => {
129
+        cancelPage()
130
+      }).catch((err) => {
131
+        message.info(err.msg || err.message)
132
+      })
42 133
       }
43
-    });
44 134
   }
45 135
 
46
-  const { getFieldDecorator } = props.form;
136
+  const cancelPage = () => {
137
+    router.push({
138
+      pathname: '/integralMall/GoodsList',
139
+    });
140
+  }
47 141
 
48 142
   return (
49
-    <>
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={goBack} type="primary" htmlType="submit">
79
-            取消
80
-          </Button>
81
-        </Form.Item>
82
-      </Form>
83
-    </>
143
+    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
84 144
   )
85 145
 }
86 146
 

+ 136
- 244
src/pages/integralMall/exchangeRecords.jsx Bestand weergeven

@@ -1,246 +1,131 @@
1
-import React from 'react';
2
-import { Form, Input, Button, Icon, Select, DatePicker, Table } from 'antd';
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, DatePicker, Table, Pagination } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5
+import router from 'umi/router';
6
+import moment from 'moment';
7
+import BuildSelect from '../../components/SelectButton/BuildSelect'
8
+
9
+import request from '../../utils/request'
5 10
 
6 11
 /**
7 12
   @param {*} props
8 13
   @returns
9 14
  */
10 15
 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
-  };
16
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
58 17
 
59
-  onEndChange = value => {
60
-    this.onChange('endValue', value);
61
-    console.log(value, "endValue")
62
-  };
18
+function record(props) {
19
+  const { getFieldDecorator } = props.form
63 20
 
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
-    );
21
+  // 获取初始化数据
22
+  const [ data, setData ] = useState({})
23
+
24
+  useEffect(() => {
25
+    getList({ pageNum: 1, pageSize: 10 });
26
+  },[])
27
+
28
+  // 查询列表
29
+  const getList = (params) => {
30
+    request({
31
+        url: '/api/admin/taPointsExchange',
32
+        method: 'GET',
33
+        params: { ...params },
34
+    }).then((data) => {
35
+        setData(data)
36
+    })
97 37
   }
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,
38
+  
39
+  // 提交事件
40
+  const handleSubmit = (e, props) => {
41
+    e.preventDefault();
42
+    props.form.validateFields((err, values) => {
43
+      if (!err) {
44
+        let {exchangeTime,receiveTime, ...submitValue} = values
45
+        if(null != exchangeTime && exchangeTime.length > 0){
46
+          const [startCreateDate, endCreateDate] = exchangeTime
47
+          submitValue.startCreateDate = moment(startCreateDate).format('YYYY-MM-DD');
48
+          submitValue.endCreateDate = moment(endCreateDate).format('YYYY-MM-DD');
49
+        }else{
50
+          submitValue.startCreateDate = null
51
+          submitValue.endCreateDate = null
52
+        }
53
+        
54
+        if(null != receiveTime && receiveTime.length > 0){
55
+          const [startVerifyDate, endVerifyDate] = receiveTime
56
+          submitValue.startVerifyDate = moment(startVerifyDate).format('YYYY-MM-DD');
57
+          submitValue.endVerifyDate = moment(endVerifyDate).format('YYYY-MM-DD');
58
+        }else{
59
+          submitValue.startVerifyDate = null
60
+          submitValue.endVerifyDate = null
61
+        }
62
+        
63
+        console.log(submitValue)
64
+        getList({ pageNum: 1, pageSize: 10, ...submitValue })
65
+      }
127 66
     });
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 67
   }
173
-}
174
-// 领取时间 组件  end
175
-const dataSource = [
176
-  {
177
-    key: '1',
178
-    img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
179
-    name: '华为P30 Pro',
180
-  },
181
-  {
182
-    key: '2',
183
-    img: '',
184
-    name: '大米',
185
-  },
186
-];
187
-
188
-const columns = [
189 68
 
190
-  {
191
-    title: '用户姓名',
192
-    dataIndex: 'name',
193
-    key: 'name',
194
-    align: 'center',
195
-
196
-  },
197
-  {
198
-    title: '用户类型',
199
-    dataIndex: 'type',
200
-    key: 'type',
201
-    align: 'center',
202
-  },
203
-  {
204
-    title: '手机号',
205
-    dataIndex: 'phone',
206
-    key: 'phone',
207
-    align: 'center',
208
-  },
209
-  {
210
-    title: '商品图片',
211
-    dataIndex: 'img',
212
-    key: 'img',
213
-    align: 'center',
214
-    render: (text, record) => <img src={record.img} className={styles.touxiang} />,
215
-  },
216
-  {
217
-    title: '商品名称',
218
-    dataIndex: 'goodName',
219
-    key: 'goodName',
220
-    align: 'center',
221
-  },
222
-  {
223
-    title: '兑换时间',
224
-    dataIndex: 'time',
225
-    key: 'time',
226
-    align: 'center',
227
-  },
228
-  {
229
-    title: '领取时间',
230
-    dataIndex: 'time2',
231
-    key: 'time2',
232
-    align: 'center',
233
-  },
234
-  {
235
-    title: '状态',
236
-    dataIndex: 'state',
237
-    key: 'state',
238
-    align: 'center',
239
-  },
240
-];
69
+  const changePageNum = (pageNumber) => {
70
+    getList({ pageNum: pageNumber, pageSize: 10 })
71
+  }
241 72
 
242
-function record(props) {
243
-  const { getFieldDecorator } = props.form
73
+  const columns = [
74
+
75
+    {
76
+      title: '用户姓名',
77
+      dataIndex: 'personName',
78
+      key: 'personName',
79
+      align: 'center',
80
+    },
81
+    {
82
+      title: '用户类型',
83
+      dataIndex: 'personType',
84
+      key: 'personType',
85
+      align: 'center',
86
+      render: (personType)=> <><span>{personType === 'Realty Consultant' ? '置业顾问' : personType === 'Sales Executive' ? '销售主管' : personType === 'estate agent' ? '经纪人' : ''}</span></>
87
+    },
88
+    {
89
+      title: '手机号',
90
+      dataIndex: 'phone',
91
+      key: 'phone',
92
+      align: 'center',
93
+    },
94
+    {
95
+      title: '商品图片',
96
+      dataIndex: 'image',
97
+      key: 'image',
98
+      align: 'center',
99
+      render: (text, record) => <img src={record.image} className={styles.touxiang} />,
100
+    },
101
+    {
102
+      title: '商品名称',
103
+      dataIndex: 'targetName',
104
+      key: 'targetName',
105
+      align: 'center',
106
+    },
107
+    {
108
+      title: '兑换时间',
109
+      dataIndex: 'createDate',
110
+      key: 'createDate',
111
+      align: 'center',
112
+      render: (createDate) => <><span>{moment(createDate).format('YYYY-MM-DD HH:mm')}</span></>
113
+    },
114
+    {
115
+      title: '领取时间',
116
+      dataIndex: 'verifyDate',
117
+      key: 'verifyDate',
118
+      align: 'center',
119
+      render: (verifyDate) => <><span>{verifyDate != null ? moment(verifyDate).format('YYYY-MM-DD HH:mm') : ''}</span></>
120
+    },
121
+    {
122
+      title: '状态',
123
+      dataIndex: 'status',
124
+      key: 'status',
125
+      align: 'center',
126
+      render: (status)=> <><span>{status == 1 ? '已领取' : '未领取'}</span></>
127
+    },
128
+  ];
244 129
 
245 130
   return (
246 131
 
@@ -248,7 +133,7 @@ function record(props) {
248 133
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
249 134
         <div style={{ display: 'flex' }}>
250 135
           <Form.Item>
251
-            {getFieldDecorator('name')(
136
+            {getFieldDecorator('personName')(
252 137
               <Input
253 138
                 prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
254 139
                 placeholder="用户姓名"
@@ -264,7 +149,7 @@ function record(props) {
264 149
             )}
265 150
           </Form.Item>
266 151
           <Form.Item>
267
-            {getFieldDecorator('goodName')(
152
+            {getFieldDecorator('targetName')(
268 153
               <Input
269 154
                 prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
270 155
                 placeholder="商品名称"
@@ -272,36 +157,43 @@ function record(props) {
272 157
             )}
273 158
           </Form.Item>
274 159
           <Form.Item>
275
-            {getFieldDecorator('type')(
276
-              <Select style={{ width: '220px' }} placeholder="用户类型" onChange={handleSelectChange}>
277
-                <Option value="2">置业顾问</Option>
278
-                <Option value="1">销售主管</Option>
279
-                <Option value="0">经纪人</Option>
160
+            {getFieldDecorator('personType')(
161
+              <Select style={{ width: '220px' }} placeholder="用户类型">
162
+                <Option value="Realty Consultant">置业顾问</Option>
163
+                <Option value="Sales Executive">销售主管</Option>
164
+                <Option value="estate agent">经纪人</Option>
280 165
               </Select>,
281 166
             )}
282 167
           </Form.Item>
283 168
           <Form.Item>
284
-            {getFieldDecorator('state')(
285
-              <Select style={{ width: '220px' }} placeholder="状态" onChange={handleSelectChange}>
169
+            {getFieldDecorator('status')(
170
+              <Select style={{ width: '220px' }} placeholder="状态">
286 171
                 <Option value="1">已领取</Option>
287 172
                 <Option value="0">未领取</Option>
288 173
               </Select>,
289 174
             )}
290 175
           </Form.Item>
176
+          <Form.Item>
177
+            {getFieldDecorator('exchangeTime')(
178
+              <RangePicker placeholder={['兑换开始时间','兑换结束时间']}/>
179
+            )}
180
+          </Form.Item>
181
+          <Form.Item>
182
+            {getFieldDecorator('receiveTime')(
183
+              <RangePicker placeholder={['领取开始时间','领取结束时间']}/>
184
+            )}
185
+          </Form.Item>
291 186
           <Form.Item>
292 187
             <Button type="primary" htmlType="submit" className={styles.searchBtn}>
293 188
               搜索
294 189
           </Button>
295 190
           </Form.Item>
296 191
         </div>
297
-        <Form.Item>
298
-          <DateRange />
299
-        </Form.Item>
300
-        <Form.Item>
301
-          <DateRange2 />
302
-        </Form.Item>
303 192
       </Form>
304
-      <Table style={{ marginTop: '40px' }} dataSource={dataSource} columns={columns} />
193
+      <Table dataSource={data.records} columns={columns} pagination={false} />
194
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
195
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
196
+      </div>
305 197
     </>
306 198
   )
307 199
 }

+ 3
- 3
src/pages/news/list/NewsList.jsx Bestand weergeven

@@ -37,7 +37,7 @@ function CartBody(props) {
37 37
             </p>
38 38
             <p className={Styles.cardText}>
39 39
               <span className={Styles.title}>状态</span>
40
-              <span >:{ data.status == '0' ? "已发布" : "未发布" }</span>
40
+              <span >:{ data.status == 0 ? "已发布" : "未发布" }</span>
41 41
             </p>
42 42
             <p className={Styles.cardItem}>
43 43
               <span className={Styles.title}>阅读数量</span>
@@ -173,8 +173,8 @@ function body(props) {
173 173
         <Form.Item>
174 174
           {getFieldDecorator('newsStatus')(
175 175
             <Select style={{ width: '180px' }} placeholder="状态" onChange={handleSelectChange}>
176
-              <Option value="1">已发布</Option>
177
-              <Option value="0">未发布</Option>
176
+              <Option value="0">已发布</Option>
177
+              <Option value="1">未发布</Option>
178 178
             </Select>,
179 179
           )}
180 180
         </Form.Item>

+ 5
- 5
src/pages/news/type/NewsType.jsx Bestand weergeven

@@ -24,10 +24,10 @@ function onChange(pageNumber) {
24 24
   console.log('Page: ', pageNumber);
25 25
 }
26 26
 
27
-// 跳转到编辑商品
28
-function toEditGoods() {
27
+// 跳转到编辑资讯
28
+function toEditNews() {
29 29
   router.push({
30
-    pathname: '/integralMall/editGoods',
30
+    pathname: '/news/type/editNews',
31 31
     query: {
32 32
       a: 'b',
33 33
     },
@@ -76,7 +76,7 @@ const columns = [
76 76
     align: 'center',
77 77
     render: () => <>
78 78
     <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={confirm}>删除<Icon type="shopping-cart" className={styles.shoppingCart} /></span>
79
-    <span style={{ color: '#FF925C' }} onClick={toEditGoods}>编辑<Icon type="form" className={styles.edit} /></span></>,
79
+    <span style={{ color: '#FF925C' }} onClick={toEditNews}>编辑<Icon type="form" className={styles.edit} /></span></>,
80 80
   },
81 81
 ];
82 82
 function confirm() {
@@ -108,7 +108,7 @@ function header(props) {
108 108
           )}
109 109
         </Form.Item>
110 110
       </Form>
111
-      <Button type="primary" className={styles.addBtn} onClick={toEditGoods}>新增</Button>
111
+      <Button type="primary" className={styles.addBtn} onClick={toEditNews}>新增</Button>
112 112
       <Table dataSource={dataSource} columns={columns} />
113 113
     </>
114 114
   )

+ 75
- 0
src/pages/news/type/editNews.jsx Bestand weergeven

@@ -0,0 +1,75 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import channels from '../../channel/channelList.less';
5
+import router from 'umi/router';
6
+import request from '../../../utils/request'
7
+
8
+const { TextArea } = Input;
9
+const { Option } = Select;
10
+
11
+const header = props => {
12
+
13
+  const [data, setData] = useState({ channelNmae: [], result: [] })
14
+
15
+  function goBack(){
16
+    router.push({
17
+      pathname: '/news/type/NewsType',
18
+    });
19
+  }
20
+
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
+  }
45
+
46
+  const { getFieldDecorator } = props.form;
47
+
48
+  return (
49
+    <>
50
+      <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
51
+      <Form.Item label="类型图片">
52
+          {getFieldDecorator('newsName', {
53
+            rules: [{ message: '' }],
54
+          })(<Input className={channels.inpuit} />)}
55
+        </Form.Item>
56
+        <Form.Item label="名称">
57
+          {getFieldDecorator('newsName', {
58
+            rules: [{ message: '请输入资讯名称' }],
59
+          })(<Input className={channels.inpuit} />)}
60
+        </Form.Item>
61
+        <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
62
+          <Button type="primary" htmlType="submit">
63
+            保存
64
+          </Button>
65
+          <Button className={channels.formButton} onClick={goBack} type="primary" htmlType="submit">
66
+            取消
67
+          </Button>
68
+        </Form.Item>
69
+      </Form>
70
+    </>
71
+  )
72
+}
73
+
74
+const WrappedNormalLoginForm = Form.create({ name: 'header' })(header);
75
+export default WrappedNormalLoginForm

+ 1
- 17
src/pages/style/GoodsList.less Bestand weergeven

@@ -1,25 +1,9 @@
1 1
 .addBtn {
2 2
   padding: 0 40px;
3 3
   height: 36px;
4
-  background-color: #FF7E48;
5
-  color: #fff;
6 4
   margin: 30px 0;
7
-  border-color: #FF7E48;
8
-}
9
-.addBtn:focus {
10
-  color: #fff;
11
-  background-color: #FF7E48;
12
-  border-color: #FF7E48;
13
-}
14
-.searchBtn{
15
- background-color: #EF273A;
16
- border-color: #EF273A;
17
-}
18
-.searchBtn:focus {
19
-  color: #fff;
20
-  background-color: #EF273A;
21
-  border-color: #EF273A;
22 5
 }
6
+
23 7
 .touxiang {
24 8
   width: 93px;
25 9
   height: 93px;