Ver código fonte

售前售后联系人

傅行帆 5 anos atrás
pai
commit
73988ac2de

+ 12
- 0
config/routes.js Ver arquivo

@@ -257,6 +257,18 @@ export default [
257 257
               },
258 258
             ],
259 259
           },
260
+          {
261
+            path: '/sell',
262
+            name: '销售管理',
263
+            component: '../layouts/BlankLayout',
264
+            routes: [
265
+              {
266
+                path: '/sell/contact',
267
+                name: '售前售后联系人',
268
+                component: './sell/contact',
269
+              },
270
+            ],
271
+          },
260 272
 
261 273
           {
262 274
             component: './404',

+ 197
- 0
src/pages/sell/components/SelectContact.jsx Ver arquivo

@@ -0,0 +1,197 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Modal, Button, Table, message, Input, Icon, Pagination } from 'antd';
3
+import request from '../../../utils/request';
4
+import apis from '../../../services/apis';
5
+import router from 'umi/router';
6
+import styles from './style.less'
7
+
8
+const { Column, ColumnGroup } = Table;
9
+const SelectContact = props => {
10
+
11
+    const [data, setData] = useState([]);
12
+    const [visible, setVisible] = useState(false);
13
+    const [group, setGroup] = useState({ groupId: undefined, groupName: '新增' })
14
+
15
+    useEffect(() => {
16
+
17
+    }, [props.value])
18
+
19
+    // 查询列表
20
+    const getList = (params) => {
21
+        request({ ...apis.contact.list, params: { ...params } }).then((data) => {
22
+            console.log(data)
23
+            setData(data)
24
+        })
25
+    }
26
+
27
+    useEffect(() => {
28
+        getList({ pageNum: 1, pageSize: 10, })
29
+    }, []);
30
+
31
+
32
+
33
+
34
+    // 提交事件
35
+    const handleSubmit = (e, props) => {
36
+        e.preventDefault();
37
+        e.stopPropagation();
38
+        props.form.validateFields((err, values) => {
39
+            if (!err) {
40
+                getList({ pageNum: 1, pageSize: 10, ...values })
41
+            }
42
+        });
43
+    }
44
+
45
+    function handleReset() {
46
+        props.form.resetFields();
47
+        getList({ pageNum: 1, pageSize: 10 })
48
+    }
49
+
50
+    const changePageNum = (pageNumber) => {
51
+        getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
52
+    }
53
+
54
+    const toAdd = () => {
55
+        router.push({
56
+            pathname: '/contact/contact/add',
57
+        });
58
+    }
59
+
60
+    const selectData = (record) => {
61
+        request({ ...apis.fund.addContact, urlData: { id: record.contactId }, params: {contactType: "sell"} }).then((data) => {
62
+            message.success('新增成功!');
63
+            props.onClick()
64
+            setVisible(false)
65
+        })
66
+    }
67
+
68
+
69
+    const columns = [
70
+        {
71
+            title: '姓名',
72
+            dataIndex: 'contactName',
73
+            key: 'contactName',
74
+            align: 'center',
75
+            ellipsis: true,
76
+        },
77
+        {
78
+            title: '性别',
79
+            dataIndex: 'sex',
80
+            key: 'sex',
81
+            align: 'center',
82
+            ellipsis: true,
83
+            render: text => <span>{text == 1 ? '男' : text == 2 ? '女' : ''}</span>,
84
+        },
85
+        {
86
+            title: '头像',
87
+            dataIndex: 'avatar',
88
+            key: 'avatar',
89
+            align: 'center',
90
+            ellipsis: true,
91
+            render: text => <img src={text} width="40px" height="40px" />,
92
+        },
93
+        {
94
+            title: '固话',
95
+            dataIndex: 'telephone',
96
+            key: 'telephone',
97
+            align: 'center',
98
+            ellipsis: true,
99
+        },
100
+        {
101
+            title: '手机号',
102
+            dataIndex: 'phone',
103
+            key: 'phone',
104
+            align: 'center',
105
+            ellipsis: true,
106
+        },
107
+        {
108
+            title: '对外头衔',
109
+            dataIndex: 'appellation',
110
+            key: 'appellation',
111
+            align: 'center',
112
+            ellipsis: true,
113
+        },
114
+        {
115
+            title: '操作',
116
+            align: 'center',
117
+            width: '20%',
118
+            render: (text, record) => (
119
+                <span>
120
+                    <a onClick={() => selectData(record)} style={{ color: 'blue' }}>选择</a>
121
+                </span>
122
+            ),
123
+        },
124
+    ];
125
+
126
+    const { getFieldDecorator } = props.form
127
+
128
+    return (
129
+        <div >
130
+
131
+            <Button type="danger" onClick={() => setVisible(true)} className={styles.addBtn} >{group.groupName}
132
+                {/* <SelectContact type="danger" onClick={() => getList({ pageNum: 1, pageSize: 10 })} /> */}
133
+            </Button>
134
+            {/* <div style={{ color: '#fff', padding: '0 15px', height: '32px', lineHeight: '32px' }} onClick={() => setVisible(true)}>{group.groupName}</div> */}
135
+
136
+            <Modal
137
+                title="选择联系人"
138
+                width="1200px"
139
+                visible={visible}
140
+                onCancel={() => setVisible(false)}
141
+                footer={[]}
142
+            >
143
+
144
+                <Form layout="inline" onSubmit={e => handleSubmit(e, props)} style={{ marginBottom: '16px' }}>
145
+                    <Form.Item>
146
+                        {getFieldDecorator('contactName')(
147
+                            <Input
148
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
149
+                                placeholder="姓名"
150
+                            />,
151
+                        )}
152
+                    </Form.Item>
153
+                    <Form.Item>
154
+                        {getFieldDecorator('telephone')(
155
+                            <Input
156
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
157
+                                placeholder="固话"
158
+                            />,
159
+                        )}
160
+                    </Form.Item>
161
+                    <Form.Item>
162
+                        {getFieldDecorator('phone')(
163
+                            <Input
164
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
165
+                                placeholder="手机号"
166
+                            />,
167
+                        )}
168
+                    </Form.Item>
169
+                    <Form.Item>
170
+                        {getFieldDecorator('appellation')(
171
+                            <Input
172
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
173
+                                placeholder="对外头衔"
174
+                            />,
175
+                        )}
176
+                    </Form.Item>
177
+                    <Form.Item>
178
+                        <Button type="primary" htmlType="submit" >
179
+                            搜索
180
+              </Button>
181
+                        <Button style={{ marginLeft: 8 }} onClick={handleReset}>
182
+                            重置
183
+              </Button>
184
+                    </Form.Item>
185
+                </Form>
186
+                <div style={{ marginBottom: '20px', textAlign: 'right' }}>没有想要的联系人? <a onClick={() => toAdd()}>去新增</a> </div>
187
+                <Table dataSource={data.records || []} columns={columns} pagination={false} />
188
+                <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
189
+                    <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
190
+                </div>
191
+            </Modal>
192
+        </div>
193
+    )
194
+}
195
+
196
+const WrappedRegistrationForm = Form.create()(SelectContact);
197
+export default WrappedRegistrationForm;

+ 109
- 0
src/pages/sell/components/style.less Ver arquivo

@@ -0,0 +1,109 @@
1
+  .mask{
2
+    width: 100vw;
3
+    height: 100vh;
4
+    background-color: rgba(0,0,0,0.32);
5
+    position: fixed;
6
+    z-index: 999;
7
+    top: 0;
8
+    left: 0;
9
+}
10
+
11
+.content{
12
+    width: 32vw;
13
+    min-width: 757px;
14
+    height: 21.3vw;
15
+    min-height: 504px;
16
+    position: absolute;
17
+    left: 50%;
18
+    top: 110px;
19
+    transform: translateX(-50%);
20
+    border-radius: 10px;
21
+    .close{
22
+        width: 40px;
23
+        height: 40px;
24
+        position: absolute;
25
+        top: -22px;
26
+        right: -22px;
27
+        z-index: 9;
28
+    }
29
+}
30
+
31
+.dots{
32
+    position: absolute;
33
+    bottom: 11px;
34
+    width: 100%;
35
+    padding: 0;
36
+    margin: 0;
37
+    list-style: none;
38
+    text-align: center;
39
+    li {
40
+        position: relative;
41
+        display: inline-block;
42
+        width: 14px;
43
+        height: 2px;
44
+        margin: 0 3px;
45
+        padding: 0;
46
+        cursor: pointer;
47
+        background: #fff;
48
+        opacity: 0.6;
49
+        &.active{
50
+            width: 16px;
51
+            height: 3px;
52
+            background: #fff;
53
+            opacity: 1;
54
+        }
55
+    }
56
+}
57
+.carousel {
58
+    width: 32vw;
59
+    min-width: 757px;
60
+    height: 21.3vw;
61
+    min-height: 504px;
62
+    border-radius: 10px;
63
+    // overflow: hidden;
64
+    
65
+    .carouselItem{
66
+        width: 32vw;
67
+        min-width: 757px;
68
+        height: 21.3vw;
69
+        min-height: 504px;
70
+        position: relative;
71
+        display: inline-block;
72
+        .title{
73
+            font-size: 0.12rem;
74
+            color: #fff;
75
+            position: absolute;
76
+            display: block;
77
+            width: 100%;
78
+            height: 0.16rem;
79
+            bottom: 30px ;
80
+            padding: 0 40px;
81
+            text-align: center;
82
+            overflow: hidden;
83
+            white-space: nowrap;
84
+            text-overflow: ellipsis;
85
+
86
+        }
87
+    }
88
+}
89
+
90
+.swiperImg{
91
+    max-height: 504px;
92
+     border-radius: 10px;
93
+     object-fit: contain;
94
+}
95
+
96
+.ant-carousel .slick-slide {
97
+    
98
+    text-align: center;
99
+    width: 32vw;
100
+    min-width: 757px;
101
+    height: 21.3vw;
102
+    min-height: 504px;
103
+    background: #364d79;
104
+    overflow: hidden;
105
+  }
106
+  
107
+  .ant-carousel .slick-slide h3 {
108
+    color: #fff;
109
+  }

+ 217
- 0
src/pages/sell/contact.jsx Ver arquivo

@@ -0,0 +1,217 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
3
+import { Form, Pagination, Button, Icon, message, Modal, Table, Input,Row,Col,Card,Avatar } from 'antd';
4
+import router from 'umi/router';
5
+import moment from 'moment';
6
+import className from 'classnames';
7
+import Cell from '../../components/Cell';
8
+import styles from './style.less';
9
+import { fetch, apis } from '../../utils/request';
10
+import request from '../../utils/request';
11
+import AuthButton from '@/components/AuthButton';
12
+import SelectContact from './components/SelectContact';
13
+
14
+
15
+function header(props) {
16
+    const { Meta } = Card;
17
+
18
+    // 获取初始化数据
19
+    const [data, setData] = useState({})
20
+    const [contactList, setContactList] = useState([])
21
+
22
+    useEffect(() => {
23
+        getList({ pageNum: 1, pageSize: 10 });
24
+    }, [])
25
+
26
+    // 查询列表
27
+    const getList = (params) => {
28
+        request({ ...apis.fund.contactList, params: { ...params, contentType: 'sell' } }).then((data) => {
29
+            console.log(data)
30
+            setData(data)
31
+        })
32
+    }
33
+
34
+
35
+    // 提交事件
36
+    const handleSubmit = (e, props) => {
37
+        e.preventDefault();
38
+        props.form.validateFields((err, values) => {
39
+            if (!err) {
40
+                let { ...submitValue } = values
41
+
42
+                getList({ pageNum: 1, pageSize: 10, ...submitValue })
43
+            }
44
+        });
45
+    }
46
+
47
+    const changePageNum = (pageNumber) => {
48
+        let { ...submitValue } = props.form.getFieldsValue()
49
+
50
+        getList({ pageNum: pageNumber, pageSize: 10, ...submitValue })
51
+    }
52
+
53
+    /**
54
+     *
55
+     *
56
+     * @param {*} props
57
+     * @returns
58
+     */
59
+    const columns = [
60
+        {
61
+            title: '姓名',
62
+            dataIndex: 'contactName',
63
+            key: 'contactName',
64
+            align: 'center',
65
+        },
66
+        {
67
+            title: '性别',
68
+            dataIndex: 'sex',
69
+            key: 'sex',
70
+            align: 'center',
71
+            render: (text, record) => <span>{record.sex == '1' ? '男' : record.sex == '2' ? '女' : '未知'}</span>
72
+
73
+        },
74
+        {
75
+            title: '头像',
76
+            dataIndex: 'avatar',
77
+            key: 'avatar',
78
+            align: 'center',
79
+            render: (text, record) => <img src={record.avatar} className={styles.touxiang} />,
80
+        },
81
+        {
82
+            title: '固话',
83
+            dataIndex: 'telephone',
84
+            key: 'telephone',
85
+            align: 'center',
86
+        },
87
+        {
88
+            title: '手机号',
89
+            dataIndex: 'phone',
90
+            key: 'phone',
91
+            align: 'center',
92
+        },
93
+        {
94
+            title: '对外头衔',
95
+            dataIndex: 'appellation',
96
+            key: 'appellation',
97
+            align: 'center',
98
+        },
99
+        {
100
+            title: '权重',
101
+            dataIndex: 'orderNo',
102
+            key: 'orderNo',
103
+            align: 'center',
104
+        },
105
+
106
+    ];
107
+    function handleReset() {
108
+        props.form.resetFields();
109
+        getList({ pageNum: 1, pageSize: 10 })
110
+    }
111
+
112
+
113
+    const rowSelection = {
114
+        onChange: (selectedRowKeys, selectedRows) => {
115
+            console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
116
+            setContactList(selectedRows)
117
+        },
118
+    };
119
+
120
+    const toDel = () => {
121
+        Modal.confirm({
122
+            title: `确认将所有条数据删除`,
123
+            okText: '确定',
124
+            cancelText: '取消',
125
+            onOk() {
126
+                request({ ...apis.fund.delContact, data: data.records,params: {contactType: 'sell'} }).then((data) => {
127
+                    message.info("操作成功")
128
+                    getList({ pageNum: 1, pageSize: 10 });
129
+                    setContactList([])
130
+                }).catch((err) => {
131
+
132
+                })
133
+            },
134
+            onCancel() { },
135
+        });
136
+    }
137
+    const { getFieldDecorator } = props.form
138
+    return (
139
+
140
+        <>
141
+            <Form layout="inline" onSubmit={e => handleSubmit(e, props)} >
142
+                <Form.Item>
143
+                    {getFieldDecorator('contactName')(
144
+                        <Input
145
+                            prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
146
+                            placeholder="姓名"
147
+                        />,
148
+                    )}
149
+                </Form.Item>
150
+                <Form.Item>
151
+                    {getFieldDecorator('telephone')(
152
+                        <Input
153
+                            prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
154
+                            placeholder="固话"
155
+                        />,
156
+                    )}
157
+                </Form.Item>
158
+                <Form.Item>
159
+                    {getFieldDecorator('phone')(
160
+                        <Input
161
+                            prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
162
+                            placeholder="手机号"
163
+                        />,
164
+                    )}
165
+                </Form.Item>
166
+                <Form.Item>
167
+                    {getFieldDecorator('appellation')(
168
+                        <Input
169
+                            prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
170
+                            placeholder="对外头衔"
171
+                        />,
172
+                    )}
173
+                </Form.Item>
174
+                <Form.Item>
175
+                    <Button type="primary" htmlType="submit" className={styles.searchBtn}>
176
+                        搜索
177
+                    </Button>
178
+                    <Button style={{ marginLeft: 8 }} onClick={handleReset}>
179
+                        重置
180
+                    </Button>
181
+                </Form.Item>
182
+            </Form>
183
+            <div style={{ margin: '10px 0 16px 0', display: 'flex' }}>
184
+                <SelectContact type="danger" onClick={() => getList({ pageNum: 1, pageSize: 10 })} />
185
+                <Button type="primary" onClick={() => toDel()} style={{ marginLeft: '30px' }} >删除</Button>
186
+            </div>
187
+            
188
+            <Row>
189
+                {(data.records || []).map((x, index) => (
190
+                <Col key={index} span={6}>
191
+                     <Card
192
+                        style={{ width: 300, marginTop: 16 }}
193
+                        actions={[
194
+                        <span>{"TEL:" + x.phone}</span>,
195
+                        <span>{x.wxCardImg ? "微信" : "暂未上传微信二维码"}</span>,
196
+                        ]}
197
+                    >
198
+                        <Meta
199
+                        style={{ height: 100 }}
200
+                        avatar={<Avatar src={x.avatar ? x.avatar : "https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"} />}
201
+                        title={x.contactName}
202
+                        description={x.appellation}
203
+                        />
204
+                    </Card>
205
+                </Col>
206
+                ))}
207
+            </Row>
208
+
209
+            <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
210
+                <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
211
+            </div>
212
+        </>
213
+    )
214
+}
215
+const WrappedHeader = Form.create({ name: 'header' })(header);
216
+
217
+export default WrappedHeader

+ 48
- 0
src/pages/sell/style.less Ver arquivo

@@ -0,0 +1,48 @@
1
+.addBtn {
2
+    padding: 0 40px;
3
+    height: 36px;
4
+    margin: 30px 0;
5
+  }
6
+  
7
+  .touxiang {
8
+    width: 93px;
9
+    height: 93px;
10
+  }
11
+  
12
+  .imgPerfect {
13
+    width: 120px;
14
+    height: 40px;
15
+  }
16
+  
17
+  .imgIndex {
18
+    width: 150px;
19
+    height: 92.7px;
20
+  }
21
+  
22
+  .imgSmall {
23
+    width: 128px;
24
+    height: 192px;
25
+  }
26
+  
27
+  .propaganda {
28
+    width: 240px;
29
+    height: 60px;
30
+  }
31
+  
32
+  .ant-table-column-title {
33
+    font-weight: 600;
34
+  }
35
+  
36
+  .shoppingCart {
37
+    // color: #dcdcdc;
38
+    color: #bebebe;
39
+    margin-left: 6px;
40
+    font-size: 16px;
41
+  }
42
+  
43
+  .edit {
44
+    // color: #dcdcdc;
45
+    color: #bebebe;
46
+    margin-left: 6px;
47
+    font-size: 15px;
48
+  }