|
@@ -0,0 +1,226 @@
|
|
1
|
+import React, { useState, useEffect } from 'react';
|
|
2
|
+import { Form, Button, DatePicker, Table, Pagination, Radio, Typography } from 'antd';
|
|
3
|
+import router from 'umi/router';
|
|
4
|
+import moment from 'moment';
|
|
5
|
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
|
|
6
|
+import apis from '../../../services/apis';
|
|
7
|
+import request from '../../../utils/request'
|
|
8
|
+
|
|
9
|
+/**
|
|
10
|
+ @param {*} props
|
|
11
|
+ @returns
|
|
12
|
+ */
|
|
13
|
+const { RangePicker } = DatePicker;
|
|
14
|
+const { Text } = Typography;
|
|
15
|
+
|
|
16
|
+function record(props) {
|
|
17
|
+ const { getFieldDecorator } = props.form
|
|
18
|
+
|
|
19
|
+ // 获取初始化数据
|
|
20
|
+ const [data, setData] = useState({})
|
|
21
|
+
|
|
22
|
+ useEffect(() => {
|
|
23
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
24
|
+ }, [])
|
|
25
|
+
|
|
26
|
+ // 查询列表
|
|
27
|
+ const getList = (params) => {
|
|
28
|
+ request({ ...apis.activity.saleCountList, params: { ...params }, }).then((data) => {
|
|
29
|
+ setData(data)
|
|
30
|
+ console.log("data:", data)
|
|
31
|
+ })
|
|
32
|
+ }
|
|
33
|
+
|
|
34
|
+ //重置搜索
|
|
35
|
+ function handleReset() {
|
|
36
|
+ props.form.resetFields();
|
|
37
|
+ }
|
|
38
|
+
|
|
39
|
+ // 分享详情
|
|
40
|
+ function shareCount(personId) {
|
|
41
|
+ router.push({
|
|
42
|
+ pathname: '/record/share/shareCountList',
|
|
43
|
+ query: {
|
|
44
|
+ id: personId,
|
|
45
|
+ },
|
|
46
|
+ });
|
|
47
|
+ }
|
|
48
|
+
|
|
49
|
+ // 点击人数详情
|
|
50
|
+ function clickCount(personId) {
|
|
51
|
+ router.push({
|
|
52
|
+ pathname: '/record/share/clickCountList',
|
|
53
|
+ query: {
|
|
54
|
+ id: personId,
|
|
55
|
+ },
|
|
56
|
+ });
|
|
57
|
+ }
|
|
58
|
+
|
|
59
|
+ // 提交事件
|
|
60
|
+ const handleSubmit = (e, props) => {
|
|
61
|
+ e.preventDefault();
|
|
62
|
+ props.form.validateFields((err, values) => {
|
|
63
|
+ if (!err) {
|
|
64
|
+ let { shareTime, receiveTime, ...submitValue } = values
|
|
65
|
+ if (null != shareTime && shareTime.length > 0) {
|
|
66
|
+ const [startCreateDate, endCreateDate] = shareTime
|
|
67
|
+ submitValue.startCreateDate = moment(startCreateDate).format('YYYY-MM-DD');
|
|
68
|
+ submitValue.endCreateDate = moment(endCreateDate).format('YYYY-MM-DD');
|
|
69
|
+ } else {
|
|
70
|
+ submitValue.startCreateDate = null
|
|
71
|
+ submitValue.endCreateDate = null
|
|
72
|
+ }
|
|
73
|
+ console.log(submitValue)
|
|
74
|
+ getList({ pageNum: 1, pageSize: 10, ...submitValue })
|
|
75
|
+ }
|
|
76
|
+ });
|
|
77
|
+ }
|
|
78
|
+
|
|
79
|
+ const changePageNum = (pageNumber) => {
|
|
80
|
+ props.form.validateFields((err, values) => {
|
|
81
|
+ if (!err) {
|
|
82
|
+ let { shareTime, receiveTime, ...submitValue } = values
|
|
83
|
+ if (null != shareTime && shareTime.length > 0) {
|
|
84
|
+ const [startCreateDate, endCreateDate] = shareTime
|
|
85
|
+ submitValue.startCreateDate = moment(startCreateDate).format('YYYY-MM-DD');
|
|
86
|
+ submitValue.endCreateDate = moment(endCreateDate).format('YYYY-MM-DD');
|
|
87
|
+ } else {
|
|
88
|
+ submitValue.startCreateDate = null
|
|
89
|
+ submitValue.endCreateDate = null
|
|
90
|
+ }
|
|
91
|
+ getList({ pageNum: pageNumber, pageSize: 10, ...submitValue })
|
|
92
|
+ }
|
|
93
|
+ });
|
|
94
|
+ }
|
|
95
|
+ function getDataOf(days) {
|
|
96
|
+ // this.setState({ endDate: new Date(), startDate: moment().subtract(days, 'day').toDate() })
|
|
97
|
+ }
|
|
98
|
+ const columns = [
|
|
99
|
+
|
|
100
|
+ {
|
|
101
|
+ title: '项目',
|
|
102
|
+ dataIndex: 'buildingName',
|
|
103
|
+ key: 'buildingName',
|
|
104
|
+ align: 'center',
|
|
105
|
+ },
|
|
106
|
+ {
|
|
107
|
+ title: '置业顾问名称1',
|
|
108
|
+ dataIndex: 'consultantName',
|
|
109
|
+ key: 'consultantName',
|
|
110
|
+ align: 'center',
|
|
111
|
+ },
|
|
112
|
+ {
|
|
113
|
+ title: '置业顾问电话',
|
|
114
|
+ dataIndex: 'consultantPhone',
|
|
115
|
+ key: 'consultantPhone',
|
|
116
|
+ align: 'center',
|
|
117
|
+ },
|
|
118
|
+ {
|
|
119
|
+ title: '客户总计',
|
|
120
|
+ dataIndex: 'customerAggregate',
|
|
121
|
+ key: 'customerAggregate',
|
|
122
|
+ align: 'center',
|
|
123
|
+ sorter: (a, b) => a.customerAggregate - b.customerAggregate,
|
|
124
|
+ render: (_, record) => <><span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => shareCount(record.personId)} >{record.customerAggregate}</span></>,
|
|
125
|
+ },
|
|
126
|
+ {
|
|
127
|
+ title: '新增客户',
|
|
128
|
+ dataIndex: 'newCustomers',
|
|
129
|
+ key: 'newCustomers',
|
|
130
|
+ align: 'center',
|
|
131
|
+ sorter: (a, b) => a.newCustomers - b.newCustomers,
|
|
132
|
+ render: (_, record) => <><span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => shareCount(record.personId)} >{record.newCustomers}</span></>,
|
|
133
|
+ },
|
|
134
|
+ {
|
|
135
|
+ title: '分享次数',
|
|
136
|
+ dataIndex: 'shareCount',
|
|
137
|
+ key: 'shareCount',
|
|
138
|
+ align: 'center',
|
|
139
|
+ sorter: (a, b) => a.shareCount - b.shareCount,
|
|
140
|
+ render: (_, record) => <><span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => shareCount(record.personId)} >{record.shareCount}</span></>,
|
|
141
|
+ },
|
|
142
|
+ {
|
|
143
|
+ title: '分享访问人数',
|
|
144
|
+ dataIndex: 'shareVisitPersonNum',
|
|
145
|
+ key: 'shareVisitPersonNum',
|
|
146
|
+ align: 'center',
|
|
147
|
+ sorter: (a, b) => a.shareVisitPersonNum - b.shareVisitPersonNum,
|
|
148
|
+ render: (_, record) => <><span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => shareCount(record.personId)} >{record.shareVisitPersonNum}</span></>,
|
|
149
|
+ },
|
|
150
|
+ {
|
|
151
|
+ title: '分享访问次数',
|
|
152
|
+ dataIndex: 'shareVisitNum',
|
|
153
|
+ key: 'shareVisitNum',
|
|
154
|
+ align: 'center',
|
|
155
|
+ sorter: (a, b) => a.shareVisitNum - b.shareVisitNum,
|
|
156
|
+ render: (_, record) => <><span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => shareCount(record.personId)} >{record.shareVisitNum}</span></>,
|
|
157
|
+ },
|
|
158
|
+
|
|
159
|
+ {
|
|
160
|
+ title: '分享拓客',
|
|
161
|
+ dataIndex: 'sharePossess',
|
|
162
|
+ key: 'sharePossess',
|
|
163
|
+ align: 'center',
|
|
164
|
+ sorter: (a, b) => a.sharePossess - b.sharePossess,
|
|
165
|
+ render: (_, record) => <><span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => clickCount(record.personId)} >{record.sharePossess}</span></>,
|
|
166
|
+ },
|
|
167
|
+ {
|
|
168
|
+ title: '主页访问人数',
|
|
169
|
+ dataIndex: 'visitPerson',
|
|
170
|
+ key: 'visitPerson',
|
|
171
|
+ align: 'center',
|
|
172
|
+ sorter: (a, b) => a.visitPerson - b.visitPerson,
|
|
173
|
+ render: (_, record) => <><span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => clickCount(record.personId)} >{record.visitPerson}</span></>,
|
|
174
|
+ },
|
|
175
|
+ {
|
|
176
|
+ title: '主页访问次数',
|
|
177
|
+ dataIndex: 'clickNum',
|
|
178
|
+ key: 'clickNum',
|
|
179
|
+ align: 'center',
|
|
180
|
+ sorter: (a, b) => a.clickNum - b.clickNum,
|
|
181
|
+ render: (_, record) => <><span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => clickCount(record.personId)} >{record.clickNum}</span></>,
|
|
182
|
+ },
|
|
183
|
+ ];
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+ return (
|
|
188
|
+
|
|
189
|
+ <>
|
|
190
|
+ <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
|
|
191
|
+ <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
192
|
+ <Radio.Group buttonStyle="solid" defaultValue="a" style={{ marginRight: '16px', }}>
|
|
193
|
+ <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
|
|
194
|
+ <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
|
|
195
|
+ </Radio.Group>
|
|
196
|
+ <Form.Item>
|
|
197
|
+ {getFieldDecorator('shareTime')(
|
|
198
|
+ <RangePicker placeholder={['开始日期', '结束日期']} />
|
|
199
|
+ )}
|
|
200
|
+ </Form.Item>
|
|
201
|
+ <Form.Item>
|
|
202
|
+ {getFieldDecorator('buildingId')(
|
|
203
|
+ <BuildSelect />,
|
|
204
|
+ )}
|
|
205
|
+ </Form.Item>
|
|
206
|
+ <Form.Item style={{ position: 'absolute', right: '38px' }}>
|
|
207
|
+ <Button type="primary" onClick={handleReset}>查询</Button>
|
|
208
|
+ <Button style={{ marginLeft: 8 }} onClick={handleReset}>重置</Button>
|
|
209
|
+ </Form.Item>
|
|
210
|
+ </div>
|
|
211
|
+ </Form>
|
|
212
|
+ <Table rowKey="KPIRecords"
|
|
213
|
+ style={{ marginTop: '30px' }}
|
|
214
|
+ dataSource={data.records}
|
|
215
|
+ columns={columns}
|
|
216
|
+ pagination={false}
|
|
217
|
+ />
|
|
218
|
+ < div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
|
219
|
+ <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
|
|
220
|
+ </div>
|
|
221
|
+ </>
|
|
222
|
+ )
|
|
223
|
+}
|
|
224
|
+const WrappedHeader = Form.create({ name: 'record' })(record);
|
|
225
|
+
|
|
226
|
+export default WrappedHeader
|