dingxin 5 years ago
parent
commit
974d89e17d

+ 145
- 0
src/pages/customer/customerlist/components/recommend.jsx View File

@@ -0,0 +1,145 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions, notification } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../../utils/request';
5
+import apis from '../../../../services/apis';
6
+import Styles from '../style.less';
7
+
8
+
9
+const { Option } = Select;
10
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
11
+const { Meta } = Card;
12
+
13
+/**
14
+ * 推荐客户
15
+ *
16
+ * @param {*} props
17
+ * @returns
18
+ */
19
+class ModalRecommendRecord extends React.Component {
20
+  constructor(props) {
21
+    super(props);
22
+    this.state = {
23
+       dataSource: [],
24
+       visibleData: { visible: false, customerId: '' },
25
+    }
26
+  }
27
+
28
+  // 挂载之后
29
+  componentDidMount() {
30
+    this.getList({ pageNumber: 1, pageSize: 5 })
31
+  }
32
+
33
+  componentDidUpdate(preProps, preState) {
34
+    // console.log('this.props.visibleData', this.props.visibleData)
35
+    if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
36
+      this.getList({ pageNumber: 1, pageSize: 5 })
37
+      this.setState({ visibleData: this.props.visibleData });
38
+    }
39
+  }
40
+
41
+  // 弹框确定按钮
42
+  // eslint-disable-next-line react/sort-comp
43
+  handleOk() {
44
+    this.setState({ visibleData: { visible: false, customerId: '' } })
45
+  }
46
+
47
+  // 弹框取消按钮
48
+  handleCancel() {
49
+    this.setState({ visibleData: { visible: false, customerId: '' } })
50
+  }
51
+
52
+  openNotificationWithIcon = (type, message) => {
53
+    notification[type]({
54
+      message,
55
+      description:
56
+        '',
57
+    });
58
+  }
59
+
60
+  getList(params) {
61
+    const { customerId } = this.state.visibleData
62
+    if (customerId === '' || customerId === undefined) {
63
+      return
64
+    }
65
+    console.log('customerId', customerId)
66
+    // 网路请求
67
+    // 网路请求
68
+    request({ ...apis.customer.recommendClient, urlData: { id: customerId }, params: { ...params } }).then(res => {
69
+      this.setState({ dataSource: res })
70
+    }).catch(err => {
71
+      this.openNotificationWithIcon('error', err)
72
+    })
73
+  }
74
+
75
+   // 分页
76
+  onChange(pageNum) {
77
+    this.getList({ pageNumber: pageNum, pageSize: 5 })
78
+  }
79
+
80
+  render() {
81
+    const columns = [
82
+      {
83
+        title: '头像',
84
+        // eslint-disable-next-line jsx-a11y/alt-text
85
+        render: (text, records) => <img src={records.picture} width={50} height={50} />,
86
+      },
87
+      {
88
+        title: '用户名',
89
+        dataIndex: 'name',
90
+        key: 'name',
91
+      },
92
+      {
93
+        title: '电话',
94
+        dataIndex: 'phone',
95
+        key: 'phone',
96
+      },
97
+      {
98
+        title: '性别',
99
+        dataIndex: 'sex',
100
+        key: 'sex',
101
+        render: (text, records) => <span>{records.sex === 1 ? '男' : '女'}</span>,
102
+      },
103
+      {
104
+        title: '意向项目',
105
+        dataIndex: 'intention',
106
+        key: 'intention',
107
+      },
108
+      {
109
+        title: '推荐时间',
110
+        dataIndex: 'createDate',
111
+        key: 'createDate',
112
+        render: (_, record) => <><span>{ record.createDate && moment(record.createDate).format('YYYY-MM-DD') }</span></>,
113
+      },
114
+      {
115
+        title: '状态',
116
+        // eslint-disable-next-line consistent-return
117
+        render: (text, records) => {
118
+          if (records.status === 1) { return '报备' }
119
+          if (records.status === 2) { return '到访' }
120
+          if (records.status === 3) { return '认筹' }
121
+          if (records.status === 4) { return '签约' }
122
+          // reportRecommendStatus
123
+        },
124
+      },
125
+    ]
126
+    return (
127
+      <>
128
+        <Modal
129
+            title="推荐客户"
130
+            width={800}
131
+            destroyOnClose="true"
132
+            footer={null}
133
+            visible={this.state.visibleData.visible}
134
+            // onOk={() => this.handleOk()}
135
+            onCancel={(e) => this.handleCancel(e)}
136
+          >
137
+            {console.log('this.state.dataSource', this.state.dataSource)}
138
+            <Table dataSource={this.state.dataSource.records} rowKey="integralrecord" columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
139
+          </Modal>
140
+      </>
141
+    );
142
+  }
143
+}
144
+
145
+export default ModalRecommendRecord

+ 137
- 0
src/pages/customer/customerlist/publicCustomerDetail.jsx View File

@@ -0,0 +1,137 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Table, Pagination } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import publicStyle from './publicStyle.less';
5
+import apis from '../../../services/apis';
6
+import request from '../../../utils/request';
7
+import moment from 'moment';
8
+
9
+import router from 'umi/router';
10
+
11
+
12
+function header(props) {
13
+  /**
14
+   * @param {*} props
15
+   * @returns
16
+   */
17
+  // eslint-disable-next-line react-hooks/rules-of-hooks
18
+  const [data, setData] = useState([{ visitRecords: [] }])
19
+  const [dataConsultant, setDataonsultant] = useState({})
20
+  const [intentionData, setIntentionData] = useState([])
21
+
22
+  // eslint-disable-next-line react-hooks/rules-of-hooks
23
+  useEffect(() => {
24
+    getById()
25
+  }, [])
26
+
27
+  // 查询
28
+  function getById(params) {
29
+    const { id } = props.location.query;
30
+    if (id === '' || id === undefined) {
31
+      return
32
+    }
33
+
34
+    request({ ...apis.customer.CustomerRecommendGet, urlData: { id }, params: { ...params } }).then(res => {
35
+      setData(res)
36
+      setDataonsultant(res.geoInfo)
37
+    })
38
+  }
39
+// 分页
40
+  const changePageNum = pageNumber => {
41
+    // getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
42
+  }
43
+  const columns = [
44
+    {
45
+      title: '访问事件',
46
+      dataIndex: 'activity',
47
+      key: 'activity',
48
+      align: 'center',
49
+    },
50
+    {
51
+      title: '访问时间',
52
+      dataIndex: 'visitTime',
53
+      key: 'visitTime',
54
+      align: 'center',
55
+
56
+    },
57
+    {
58
+      title: '停留时间',
59
+      dataIndex: 'visitDuration',
60
+      key: 'visitDuration',
61
+      align: 'center',
62
+      render: (_, record) => <span>{record.visitDuration === null ? 0 : record.visitDuration }秒</span>,
63
+    },
64
+  ]
65
+  // 意向
66
+  const intention = [
67
+    {
68
+      title: 'Name',
69
+      dataIndex: 'name',
70
+      width: 150,
71
+      render: (_, record) => <span>香颂半岛</span>,
72
+    },
73
+    {
74
+      title: 'Address',
75
+      dataIndex: 'address',
76
+      render: (_, record) => <span style={{ marginLeft: '55%' }}>22</span>,
77
+    },
78
+  ];
79
+
80
+for (let i = 0; i < 1; i++ ) {
81
+  intentionData.push({
82
+    key: i,
83
+    name: `Edward King ${i}`,
84
+    age: 32,
85
+    address: `London, Park Lane no. ${i}`,
86
+  });
87
+}
88
+  return (
89
+    <>
90
+      <div className={publicStyle.cardBox}>
91
+     {/* { console.log("data:",data),console.log("data:",dataConsultant)} */}
92
+        <div className={publicStyle.rightBox}>
93
+          <p className={publicStyle.tit}>客户信息</p>
94
+          <img className={publicStyle.touxiang} src={ data.picture && data.picture } />
95
+          <div className={publicStyle.right}>
96
+            <p className={publicStyle.rightItem}>用户名称:{ data.name }</p>
97
+            <p className={publicStyle.rightItem}>手机号码:{ data.phone }</p>
98
+            <p className={publicStyle.rightItem}>首次访问时间:{data.visitTime && moment(data.visitTime).format('YYYY-MM-DD')}</p>
99
+          </div>
100
+          <div className={publicStyle.Centered}>
101
+          <p>访问时长:{ data.duration }秒</p>
102
+          <p>访问次数:{ data.visitTimes }</p>
103
+          <p className={publicStyle.rightItem}>来访渠道:活动分享</p>
104
+          {/* <p>预约人数:{ data.visiteNum }</p> */}
105
+          </div>
106
+          {/* <p className={styles.rightItem}>预约到访时间:{data.appointmentTime && moment(data.appointmentTime).format('YYYY-MM-DD') }</p> */}
107
+          <div className={publicStyle.rightInfo}>
108
+            <p className={publicStyle.rightItem}>国家:{ dataConsultant && dataConsultant.country }</p>
109
+            <p className={publicStyle.rightItem}>省份:{ dataConsultant && dataConsultant.provience }</p>
110
+            <p className={publicStyle.rightItem}>城市:{dataConsultant && dataConsultant.city }</p>
111
+            {/* <p className={styles.rightItem}>详细信息:</p> */}
112
+            {/* <p className={styles.rightItem}>意向项目:{data.intention }</p> */} 
113
+            {/* <p className={styles.rightItem}>客户说明:{ data.verifyRemark }</p> */}
114
+          </div>
115
+        </div>
116
+        {/* { console.log("data:",data),console.log("data:",dataConsultant)} */}
117
+        <div className={publicStyle.leftBoxCentre}>
118
+          <div className={publicStyle.tit}>
119
+                <span>项目名称</span>
120
+                <span style={{ marginLeft: '47%' }}>项目名称</span>
121
+          </div>
122
+          {/* <img className={styles.touxiang} src={ data.picture && data.picture } /> */}
123
+          <div className={publicStyle.infoItem}>
124
+          <Table columnWidth={10} showHeader={false} columns={intention} dataSource={intentionData} pagination={{ pageSize: 50 }} scroll={{ y: 240 }}/>,
125
+          </div>
126
+        </div>
127
+      </div>
128
+      <div className={publicStyle.recordBox}>
129
+        <p className={publicStyle.tableName}>访问记录</p>
130
+        <Table dataSource={data.visitRecords} columns={columns} rowKey="customerDetail" onChange={changePageNum} showQuickJumper/>
131
+      </div>
132
+    </>
133
+  )
134
+}
135
+const WrappedHeader = Form.create({ name: 'header' })(header);
136
+
137
+export default WrappedHeader

+ 209
- 0
src/pages/customer/customerlist/publicStyle.less View File

@@ -0,0 +1,209 @@
1
+.SubmitButton {
2
+  background: rgba(239,39,58,1);
3
+  border-radius: 7px;
4
+  border: 0px;
5
+}
6
+.text {
7
+  color: rgba(239,39,58,1);
8
+}
9
+.SelectFrom {
10
+  width: 180px;
11
+  background: #ffffff;
12
+  border-radius: 7px;
13
+  border: 1px solid #dbdbdb;
14
+}
15
+.addButton {
16
+  background: #50be00;
17
+  border-radius: 4px;
18
+  border: 0px;
19
+  margin: 10px 0px;
20
+}
21
+.cardText {
22
+  color: #333;
23
+  display: flex;
24
+  align-items: center;
25
+  position: relative;
26
+  line-height: 1.5;
27
+  font-size: 0.106rem;
28
+  margin-bottom: 0.08rem;
29
+
30
+}
31
+.cardItem{
32
+  color: #666;
33
+  display: flex;
34
+  align-items: center; 
35
+  line-height: 1.5;
36
+  font-size: 0.106rem;
37
+  margin-bottom: 0.08rem; 
38
+}
39
+.ediText {
40
+  font-size: 0.106rem;
41
+  color: #ff925c;
42
+  line-height: 24px;
43
+  position: absolute;
44
+  right: 0;
45
+}
46
+.title{
47
+  display: inline-block;
48
+  width:  0.54rem;
49
+  justify-content: space-between;
50
+  text-align: justify;
51
+  text-align-last:justify
52
+}
53
+
54
+.address { 
55
+  width: 400px;
56
+  height: 24px; 
57
+  text-overflow: ellipsis; 
58
+  white-space: nowrap;
59
+  overflow: hidden;
60
+}
61
+
62
+.pitchButton { 
63
+  border-color: rgba(255,126,72,1);
64
+  background-color: rgba(255,126,72,1);
65
+  color: rgba(255,255,255,1); 
66
+}
67
+.noButton {
68
+  border-color: rgba(255,126,72,1);
69
+  color: rgba(255,126,72,1);
70
+}
71
+.displayS {
72
+  display: none;
73
+}
74
+
75
+
76
+// 客户详情样式
77
+.cardBox{
78
+  display: flex;
79
+  .leftBox{
80
+    width:90%;
81
+    min-width:28.5%;
82
+    height:315px;
83
+    background:rgba(255,255,255,1);
84
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
85
+    border-radius:8px;
86
+    display: inline-block;
87
+    margin-right: 30px;
88
+    padding: 30px;
89
+    overflow: hidden;
90
+  }
91
+  .rightBox{
92
+    width:865px;
93
+    min-width:342px;
94
+    height:290px;
95
+    background:rgba(255,255,255,1);
96
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
97
+    border-radius:8px;
98
+    display: inline-block;
99
+    margin-right: 30px;
100
+    padding: 30px;
101
+    overflow: hidden;
102
+  }
103
+  .rightBox{
104
+    width:-webkit-fill-available;
105
+    height:315px;
106
+    min-width: 70%;
107
+    background:rgba(255,255,255,1);
108
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
109
+    border-radius:8px;
110
+    display: inline-block;
111
+    padding: 30px;
112
+    overflow: hidden;
113
+    position: relative;
114
+  }
115
+  .rightBoxCentre{
116
+    width:865px;
117
+    height:315px;
118
+    min-width: 60%;
119
+    background:rgba(255,255,255,1);
120
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
121
+    border-radius:8px;
122
+    display: inline-block;
123
+    padding: 30px;
124
+    overflow: hidden;
125
+    position: relative;
126
+  }
127
+  .leftBoxCentre{
128
+    width:100%;
129
+    height:315px;
130
+    background:rgba(255,255,255,1);
131
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
132
+    border-radius:8px;
133
+    display: inline-block;
134
+    padding: 30px;
135
+    overflow: hidden;
136
+    position: relative;
137
+  }
138
+  .tit{
139
+    font-size:24px;
140
+    font-weight:600;
141
+    color:#222;
142
+    margin: 10px 0 0 0;
143
+  }
144
+  .touxiang{
145
+    width: 120px;
146
+    width: 120px;
147
+    border-radius: 6px;
148
+    margin: 30px 0 20px 0;
149
+  }
150
+  .infoItem{
151
+    color:#666;
152
+    font-size: 19px;
153
+    margin: 0 0 10px 0;
154
+    
155
+  }
156
+  .rightItem{
157
+    color:#666;
158
+    font-size: 19px;
159
+    margin: 0 0 15px 0;
160
+  }
161
+  .right{
162
+    position: absolute;
163
+    top:108px;
164
+    left:170px;
165
+  }
166
+  .left{
167
+    position: absolute;
168
+    top:108px;
169
+    left:60%;
170
+  }
171
+  .rightInfo{
172
+    position: absolute;
173
+    top:108px;
174
+    left:80%;
175
+  }
176
+
177
+  .Centered{
178
+    position: absolute;
179
+    top:108px;
180
+    left:40%;
181
+    margin: 0 0 15px 0;
182
+    color:#666;
183
+    font-size: 19px;
184
+  }
185
+
186
+  .rightCentered{
187
+    position: absolute;
188
+    top:108px;
189
+    left:55%;
190
+    margin: 0 0 15px 0;
191
+    color:#666;
192
+    font-size: 19px;
193
+  }
194
+  
195
+}
196
+.recordBox{
197
+  width:100%;
198
+  background:rgba(255,255,255,1);
199
+  box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
200
+  border-radius:8px;
201
+  margin-top: 30px;
202
+  padding: 30px;
203
+  .tableName{
204
+    font-size:24px;
205
+    font-weight:600;
206
+    color:#222;
207
+  }
208
+}
209
+