dingxin hace 5 años
padre
commit
a6bcc9c87f

+ 60
- 29
src/pages/channel/brokerList.jsx Ver fichero

@@ -1,8 +1,9 @@
1
-import React from 'react';
1
+import React, { useState, useEffect } from 'react';
2 2
 import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select } 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';
6
+import request from '../../utils/request'
6 7
 
7 8
 const { Option } = Select;
8 9
 function handleChange(value) {
@@ -26,54 +27,54 @@ const menu = (
26 27
     </Menu.Item>
27 28
   </Menu>
28 29
 );
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
-];
30
+// const dataSource = [
31
+//   {
32
+//     key: '1',
33
+//     img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
34
+//     name: '123',
35
+//     age: 32,
36
+//     address: '西湖区湖底公园1号',
37
+//   },
38
+//   {
39
+//     key: '2',
40
+//     img: '',
41
+//     age: 42,
42
+//     address: '西湖区湖底公园1号',
43
+//   },
44
+// ];
44 45
 
45 46
 const columns = [
46 47
   {
47 48
     title: '头像',
48
-    dataIndex: 'img',
49
-    key: 'img',
49
+    dataIndex: 'avatarurl',
50
+    key: 'avatarurl',
50 51
     align: 'center',
51 52
 
52
-    render: (text, record) => <img src={record.img} className={channels.touxiang} />,
53
+    // eslint-disable-next-line jsx-a11y/alt-text
54
+    render: (text, record) => <img src={record.avatarurl }/>,
53 55
   },
54 56
   {
55 57
     title: '用户姓名',
56 58
     dataIndex: 'name',
57 59
     key: 'name',
58 60
     align: 'center',
59
-    render: text => <a>{text}</a>,
60 61
   },
61 62
   {
62 63
     title: '电话',
63
-    dataIndex: 'integral',
64
-    key: 'integral',
64
+    dataIndex: 'tel',
65
+    key: 'tel',
65 66
     align: 'center',
66 67
   },
67 68
   {
68 69
     title: '性别',
69
-    dataIndex: 'total',
70
-    key: 'total',
70
+    dataIndex: 'sex',
71
+    key: 'sex',
71 72
     align: 'center',
72 73
   },
73 74
   {
74 75
     title: '推荐客户',
75
-    dataIndex: 'exchanged',
76
-    key: 'exchanged',
76
+    dataIndex: 'recommendCount',
77
+    key: 'recommendCount',
77 78
     align: 'center',
78 79
   },
79 80
   {
@@ -93,7 +94,35 @@ function toEditGoods() {
93 94
     },
94 95
   });
95 96
 }
96
-export default () => (
97
+const header = props => {
98
+  // eslint-disable-next-line react-hooks/rules-of-hooks
99
+  const [data, setData] = useState({})
100
+//   const [page, changePage] = useState({})
101
+  // eslint-disable-next-line react-hooks/rules-of-hooks
102
+  useEffect(() => {
103
+    request({
104
+        url: '/api/admin/channel/broker',
105
+        method: 'GET',
106
+        params: { pageNum: 1, pageSize: 10 },
107
+    // eslint-disable-next-line no-shadow
108
+    }).then(data => {
109
+        console.log(data)
110
+        setData(data)
111
+    })
112
+  }, [])
113
+
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
+    })
123
+  }
124
+
125
+return (
97 126
   <>
98 127
     <div className={ channels.searchBox }>
99 128
       <div>
@@ -104,11 +133,13 @@ export default () => (
104 133
       </div>
105 134
       <Button className={channels.about}>查询</Button>
106 135
     </div>
107
-    <Table dataSource={dataSource} columns={columns} />
136
+    <Table dataSource={data.records} columns={columns} />
108 137
   </>
109
-);
138
+)
139
+}
110 140
 
111 141
 function handleMenuClick(e) {
112 142
   message.info('Click on menu item.');
113 143
   console.log('click', e);
114 144
 }
145
+export default header

+ 74
- 53
src/pages/channel/channelList.jsx Ver fichero

@@ -1,8 +1,9 @@
1
-import React from 'react';
1
+import React, { useState, useEffect } from 'react';
2 2
 import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select } 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';
6
+import request from '../../utils/request'
6 7
 
7 8
 const { Option } = Select;
8 9
 function handleChange(value) {
@@ -26,21 +27,21 @@ const menu = (
26 27
     </Menu.Item>
27 28
   </Menu>
28 29
 );
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
-];
30
+// const dataSource = [
31
+//   {
32
+//     key: '1',
33
+//     img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
34
+//     name: '123',
35
+//     age: 32,
36
+//     address: '西湖区湖底公园1号',
37
+//   },
38
+//   {
39
+//     key: '2',
40
+//     img: '',
41
+//     age: 42,
42
+//     address: '西湖区湖底公园1号',
43
+//   },
44
+// ];
44 45
 
45 46
 const columns = [
46 47
   // {
@@ -53,52 +54,52 @@ const columns = [
53 54
   // },
54 55
   {
55 56
     title: '渠道代码',
56
-    dataIndex: 'name',
57
-    key: 'name',
57
+    dataIndex: 'channelCode',
58
+    key: 'channelCode',
58 59
     align: 'center',
59 60
     render: text => <a>{text}</a>,
60 61
   },
61 62
   {
62 63
     title: '渠道名称',
63
-    dataIndex: 'integral',
64
-    key: 'integral',
64
+    dataIndex: 'channelName',
65
+    key: 'channelName',
65 66
     align: 'center',
66 67
   },
67 68
   {
68 69
     title: '联系人',
69
-    dataIndex: 'total',
70
-    key: 'total',
70
+    dataIndex: 'channelContact',
71
+    key: 'channelContact',
71 72
     align: 'center',
72 73
   },
73 74
   {
74 75
     title: '联系电话',
75
-    dataIndex: 'exchanged',
76
-    key: 'exchanged',
76
+    dataIndex: 'contactTel',
77
+    key: 'contactTel',
77 78
     align: 'center',
78 79
   },
79 80
   {
80
-    title: '经纪人',
81
-    dataIndex: 'rest',
82
-    key: 'rest',
81
+    title: '经纪人',
82
+    dataIndex: 'agentsNum',
83
+    key: 'agentsNum',
83 84
     align: 'center',
84 85
   },
85 86
   {
86 87
     title: '推荐客户有效',
87
-    dataIndex: 'state',
88
-    key: 'state',
88
+    dataIndex: 'recommendEffective',
89
+    key: 'recommendEffective',
89 90
     align: 'center',
90 91
   },
91 92
   {
92 93
     title: '邀请经济人',
93
-    dataIndex: 'handle',
94
-    key: 'handle',
94
+    dataIndex: 'agentsInvite',
95
+    key: 'agentsInvite',
95 96
     align: 'center',
96
-    render: () => <a>Delete</a>,
97
+    // render: () => <a>Delete</a>,
97 98
   },
98 99
   {
99 100
     title: '操作',
100
-    dataIndex: 'handle',
101
-    key: 'handle',
101
+    dataIndex: '',
102
+    key: '',
102 103
     align: 'center',
103 104
     render: () => <a style={ { color: '#66B3FF' } }>编辑</a>,
104 105
   },
@@ -113,28 +114,48 @@ function toEditGoods() {
113 114
     },
114 115
   });
115 116
 }
116
-export default () => (
117
-  <>
118
-    <div className={channels.searchBox}>
119
-      <dvi>
120
-        <span className={channels.selectName}>渠道名称</span>
121
-        <Select defaultValue="lucy" style={{ width: 180 }} onChange={handleChange}>
122
-          <Option value="jack">Jack</Option>
123
-          <Option value="lucy">Lucy</Option>
124
-          <Option value="disabled" disabled>
125
-            Disabled
126
-          </Option>
127
-          <Option value="Yiminghe">yiminghe</Option>
128
-        </Select>
129
-      </dvi>
130
-      <Button className={channels.about}>查询</Button>
131
-    </div>
132
-    <Button className={channels.addBtn} onClick={toEditGoods}>新增</Button>
133
-    <Table dataSource={dataSource} columns={columns} />
117
+
118
+const header = props => {
119
+  // eslint-disable-next-line react-hooks/rules-of-hooks
120
+  const [data, setData] = useState({ records: [] })
121
+//   const [page, changePage] = useState({})
122
+  // eslint-disable-next-line react-hooks/rules-of-hooks
123
+  useEffect(() => {
124
+    request({
125
+        url: '/api/admin/channel',
126
+        method: 'GET',
127
+        params: { pageNum: 1, pageSize: 10 },
128
+    // eslint-disable-next-line no-shadow
129
+    }).then(data => {
130
+        console.log(data)
131
+        setData(data)
132
+    })
133
+  }, [])
134
+
135
+  return (
136
+    <>
137
+      <div className={channels.searchBox}>
138
+        <dvi>
139
+          <span className={channels.selectName}>渠道名称</span>
140
+          <Select defaultValue="请选择" style={{ width: 180 }} onChange={handleChange}>
141
+              {data.records.map(Item =>
142
+                <Option value={ Item.channelId }> { Item.channelName } </Option>,
143
+              )}
144
+              {/* {listItems} */}
145
+          </Select>
146
+
147
+        </dvi>
148
+        <Button className={channels.about} onClick={ header }>查询</Button>
149
+      </div>
150
+      <Button className={channels.addBtn} onClick={toEditGoods}>新增</Button>
151
+      <Table dataSource={data.records} columns={columns} />
134 152
   </>
135
-);
153
+  )
154
+}
136 155
 
137 156
 function handleMenuClick(e) {
138 157
   message.info('Click on menu item.');
139 158
   console.log('click', e);
140 159
 }
160
+
161
+export default header

+ 50
- 17
src/pages/channel/recommendClients.jsx Ver fichero

@@ -1,8 +1,9 @@
1
-import React from 'react';
1
+import React, { useState, useEffect } from 'react';
2 2
 import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select } 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';
6
+import request from '../../utils/request'
6 7
 
7 8
 const { Option } = Select;
8 9
 function handleChange(value) {
@@ -45,11 +46,11 @@ const dataSource = [
45 46
 const columns = [
46 47
   {
47 48
     title: '头像',
48
-    dataIndex: 'img',
49
-    key: 'img',
49
+    // dataIndex: 'img',
50
+    // key: 'img',
50 51
     align: 'center',
51 52
 
52
-    render: (text, record) => <img src={record.img} className={channels.touxiang} />,
53
+    render: (text, record) => <img src={record.picture} className={channels.touxiang} />,
53 54
   },
54 55
   {
55 56
     title: '用户姓名',
@@ -60,32 +61,32 @@ const columns = [
60 61
   },
61 62
   {
62 63
     title: '电话',
63
-    dataIndex: 'integral',
64
-    key: 'integral',
64
+    dataIndex: 'recommendTel',
65
+    key: 'recommendTel',
65 66
     align: 'center',
66 67
   },
67 68
   {
68 69
     title: '性别',
69
-    dataIndex: 'total',
70
-    key: 'total',
70
+    dataIndex: 'sex',
71
+    key: 'sex',
71 72
     align: 'center',
72 73
   },
73 74
   {
74 75
     title: '意向项目',
75
-    dataIndex: 'exchanged',
76
-    key: 'exchanged',
76
+    dataIndex: 'intention',
77
+    key: 'intention',
77 78
     align: 'center',
78 79
   },
79 80
   {
80 81
     title: '推荐时间',
81
-    dataIndex: 'rest',
82
-    key: 'rest',
82
+    dataIndex: 'createDate',
83
+    key: 'createDate',
83 84
     align: 'center',
84 85
   },
85 86
   {
86 87
     title: '状态',
87
-    dataIndex: 'rest',
88
-    key: 'rest',
88
+    dataIndex: 'status',
89
+    key: 'status',
89 90
     align: 'center',
90 91
   },
91 92
 ];
@@ -99,11 +100,43 @@ function toEditGoods() {
99 100
     },
100 101
   });
101 102
 }
102
-export default () => (
103
-    <Table dataSource={dataSource} columns={columns} />
104
-);
103
+const header = props => {
104
+  // eslint-disable-next-line react-hooks/rules-of-hooks
105
+  const [data, setData] = useState({})
106
+//   const [page, changePage] = useState({})
107
+  // eslint-disable-next-line react-hooks/rules-of-hooks
108
+  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
+    })
118
+  }, [])
119
+
120
+  const getList = e => {
121
+    request({
122
+        url: '/api/xxx',
123
+        method: 'GET',
124
+        params: {},
125
+    // eslint-disable-next-line no-shadow
126
+    }).then(data => {
127
+        setData(data)
128
+    })
129
+  }
130
+
131
+return (
132
+  <>
133
+    <Table dataSource={data.records} columns={columns} />
134
+  </>
135
+)
136
+}
105 137
 
106 138
 function handleMenuClick(e) {
107 139
   message.info('Click on menu item.');
108 140
   console.log('click', e);
109 141
 }
142
+export default header