|
@@ -1,5 +1,23 @@
|
1
|
1
|
import React, { useState, useEffect } from 'react';
|
2
|
|
-import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Upload, message, notification } from 'antd';
|
|
2
|
+import {
|
|
3
|
+ Form,
|
|
4
|
+ Icon,
|
|
5
|
+ Input,
|
|
6
|
+ Button,
|
|
7
|
+ DatePicker,
|
|
8
|
+ Select,
|
|
9
|
+ Card,
|
|
10
|
+ Row,
|
|
11
|
+ Col,
|
|
12
|
+ Pagination,
|
|
13
|
+ Alert,
|
|
14
|
+ Table,
|
|
15
|
+ Avatar,
|
|
16
|
+ Radio,
|
|
17
|
+ Upload,
|
|
18
|
+ message,
|
|
19
|
+ notification,
|
|
20
|
+} from 'antd';
|
3
|
21
|
import ImageUpload from '@/components/XForm/ImageUpload';
|
4
|
22
|
import AuthButton from '@/components/AuthButton';
|
5
|
23
|
import moment from 'moment';
|
|
@@ -7,12 +25,11 @@ import request from '@/utils/request';
|
7
|
25
|
import apis from '@/services/apis';
|
8
|
26
|
import { router } from 'umi';
|
9
|
27
|
|
10
|
|
-import Attribution from './components/attribution'
|
|
28
|
+import Attribution from './components/attribution';
|
11
|
29
|
import BuildingSelect from '@/components/SelectButton/BuildSelect2';
|
12
|
30
|
import ConsultantSelect from '@/components/SelectButton/consultantSelect';
|
13
|
31
|
import ChannelSelect from '@/components/SelectButton/channelSelect';
|
14
|
32
|
|
15
|
|
-
|
16
|
33
|
const { TextArea } = Input;
|
17
|
34
|
|
18
|
35
|
const tailFormItemLayout = {
|
|
@@ -29,51 +46,52 @@ const tailFormItemLayout = {
|
29
|
46
|
const openNotificationWithIcon = (type, message) => {
|
30
|
47
|
notification[type]({
|
31
|
48
|
message,
|
32
|
|
- description:
|
33
|
|
- '',
|
|
49
|
+ description: '',
|
34
|
50
|
});
|
35
|
|
-}
|
|
51
|
+};
|
36
|
52
|
|
37
|
53
|
function body(props) {
|
38
|
|
- const { getFieldDecorator } = props.form
|
|
54
|
+ const { getFieldDecorator } = props.form;
|
39
|
55
|
|
40
|
56
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
41
|
|
- const [visibleData, setVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
|
57
|
+ const [visibleData, setVisibleData] = useState({
|
|
58
|
+ visible: false,
|
|
59
|
+ customerId: '',
|
|
60
|
+ realtyConsultant: '',
|
|
61
|
+ buildingId: '',
|
|
62
|
+ });
|
42
|
63
|
|
43
|
64
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
44
|
|
- const [data, setData] = useState({})
|
|
65
|
+ const [data, setData] = useState({});
|
45
|
66
|
|
46
|
67
|
const { id } = props.location.query;
|
47
|
68
|
|
48
|
69
|
if (id !== '') {
|
49
|
70
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
50
|
71
|
useEffect(() => {
|
51
|
|
- getById(id)
|
52
|
|
- }, [])
|
|
72
|
+ getById(id);
|
|
73
|
+ }, []);
|
53
|
74
|
}
|
54
|
75
|
|
55
|
76
|
// 获取详情信息
|
56
|
77
|
function getById(currentId) {
|
57
|
78
|
request({ ...apis.customer.getDetail, urlData: { id: currentId } }).then(res => {
|
58
|
79
|
// res.reportDate = moment(res.reportDate)
|
59
|
|
- if(res){
|
60
|
|
- let channelCustomer = {}
|
61
|
|
- if(res.channelCustomer){
|
|
80
|
+ if (res) {
|
|
81
|
+ let channelCustomer = {};
|
|
82
|
+ if (res.channelCustomer) {
|
62
|
83
|
// channelCustomer.channelId=res.channelCustomer.channelId
|
63
|
|
- channelCustomer.remark=res.channelCustomer.remark
|
64
|
|
-
|
|
84
|
+ channelCustomer.remark = res.channelCustomer.remark;
|
65
|
85
|
}
|
66
|
|
- if(res.customerVisit){
|
67
|
|
- channelCustomer.imageUrl=res.customerVisit.imageUrl
|
|
86
|
+ if (res.customerVisit) {
|
|
87
|
+ channelCustomer.imageUrl = res.customerVisit.imageUrl;
|
68
|
88
|
// channelCustomer.remark=res.channelCustomer.remark
|
69
|
|
-
|
70
|
89
|
}
|
71
|
|
- channelCustomer.name=res.name||res.channelCustomer?.name
|
72
|
|
- setData(res)
|
73
|
|
- props.form.setFieldsValue({...res,...channelCustomer})
|
|
90
|
+ channelCustomer.name = res.name || res.channelCustomer?.name;
|
|
91
|
+ setData(res);
|
|
92
|
+ props.form.setFieldsValue({ ...res, ...channelCustomer });
|
74
|
93
|
}
|
75
|
|
-
|
76
|
|
- })
|
|
94
|
+ });
|
77
|
95
|
}
|
78
|
96
|
|
79
|
97
|
function submitDate(data) {
|
|
@@ -87,6 +105,7 @@ function body(props) {
|
87
|
105
|
name: props.form.getFieldValue('name'),
|
88
|
106
|
customerVisit: {
|
89
|
107
|
imageUrl: props.form.getFieldValue('imageUrl'),
|
|
108
|
+ name: props.form.getFieldValue('name'),
|
90
|
109
|
},
|
91
|
110
|
remark: props.form.getFieldValue('remark'),
|
92
|
111
|
};
|
|
@@ -102,20 +121,19 @@ function body(props) {
|
102
|
121
|
});
|
103
|
122
|
} else {
|
104
|
123
|
const params = {
|
105
|
|
- id:id,
|
106
|
|
- type:'report'
|
|
124
|
+ id: id,
|
|
125
|
+ type: 'report',
|
107
|
126
|
};
|
108
|
127
|
|
109
|
|
- request({ ...apis.customer.invalidCustomer, data: { ...params } })
|
110
|
|
- .then(() => {
|
111
|
|
- // eslint-disable-next-line no-unused-expressions
|
112
|
|
- openNotificationWithIcon('success', '操作成功');
|
113
|
|
- router.go(-1);
|
114
|
|
- })
|
115
|
|
- .catch(err => {
|
116
|
|
- // eslint-disable-next-line no-unused-expressions
|
117
|
|
- });
|
118
|
|
- ;
|
|
128
|
+ request({ ...apis.customer.invalidCustomer, data: { ...params } })
|
|
129
|
+ .then(() => {
|
|
130
|
+ // eslint-disable-next-line no-unused-expressions
|
|
131
|
+ openNotificationWithIcon('success', '操作成功');
|
|
132
|
+ router.go(-1);
|
|
133
|
+ })
|
|
134
|
+ .catch(err => {
|
|
135
|
+ // eslint-disable-next-line no-unused-expressions
|
|
136
|
+ });
|
119
|
137
|
}
|
120
|
138
|
}
|
121
|
139
|
|
|
@@ -124,13 +142,12 @@ function body(props) {
|
124
|
142
|
e.preventDefault();
|
125
|
143
|
props.form.validateFields((err, values) => {
|
126
|
144
|
if (!err) {
|
127
|
|
- submitDate({ status: '1' })
|
|
145
|
+ submitDate({ status: '1' });
|
128
|
146
|
// submitDate({ ...values })
|
129
|
147
|
}
|
130
|
148
|
});
|
131
|
149
|
}
|
132
|
150
|
|
133
|
|
-
|
134
|
151
|
return (
|
135
|
152
|
<Card>
|
136
|
153
|
<Form {...tailFormItemLayout} onSubmit={e => handleSubmit(e)} style={{ maxWidth: '1000px' }}>
|
|
@@ -142,25 +159,15 @@ function body(props) {
|
142
|
159
|
)}
|
143
|
160
|
</Form.Item>*/}
|
144
|
161
|
<Form.Item label="项目ID" style={{ display: 'none' }}>
|
145
|
|
- {getFieldDecorator('buildingId')(
|
146
|
|
- <Input
|
147
|
|
- placeholder="项目ID"
|
148
|
|
- />,
|
149
|
|
- )}
|
|
162
|
+ {getFieldDecorator('buildingId')(<Input placeholder="项目ID" />)}
|
150
|
163
|
</Form.Item>
|
151
|
164
|
<Form.Item label="意向项目:">
|
152
|
165
|
{getFieldDecorator('buildingId')(
|
153
|
|
- <BuildingSelect
|
154
|
|
- disabled
|
155
|
|
- placeholder="意向项目"
|
156
|
|
- style={{width:'100%'}}
|
157
|
|
- />,
|
|
166
|
+ <BuildingSelect disabled placeholder="意向项目" style={{ width: '100%' }} />,
|
158
|
167
|
)}
|
159
|
|
- </Form.Item>
|
|
168
|
+ </Form.Item>
|
160
|
169
|
<Form.Item label="客户姓名">
|
161
|
|
- {getFieldDecorator('name')(
|
162
|
|
- <Input placeholder="客户姓名" />,
|
163
|
|
- )}
|
|
170
|
+ {getFieldDecorator('name')(<Input placeholder="客户姓名" />)}
|
164
|
171
|
</Form.Item>
|
165
|
172
|
{/* <Form.Item label="归属渠道">
|
166
|
173
|
{getFieldDecorator('channelId')(
|
|
@@ -169,33 +176,37 @@ function body(props) {
|
169
|
176
|
</Form.Item> */}
|
170
|
177
|
<Form.Item label="归属置业顾问">
|
171
|
178
|
{getFieldDecorator('realtyConsultant')(
|
172
|
|
- <ConsultantSelect placeholder="归属置业顾问" buildingId={props.form.getFieldValue('buildingId')} />,
|
173
|
|
- )}
|
174
|
|
- </Form.Item>
|
175
|
|
- <Form.Item label="到访照片">
|
176
|
|
- {getFieldDecorator('imageUrl')(
|
177
|
|
- <ImageUpload />,
|
|
179
|
+ <ConsultantSelect
|
|
180
|
+ placeholder="归属置业顾问"
|
|
181
|
+ buildingId={props.form.getFieldValue('buildingId')}
|
|
182
|
+ />,
|
178
|
183
|
)}
|
179
|
184
|
</Form.Item>
|
|
185
|
+ <Form.Item label="到访照片">{getFieldDecorator('imageUrl')(<ImageUpload />)}</Form.Item>
|
180
|
186
|
<Form.Item label="备注">
|
181
|
|
- {getFieldDecorator('remark')(
|
182
|
|
- <TextArea placeholder="客户描述" rows={10} />,
|
183
|
|
- )}
|
|
187
|
+ {getFieldDecorator('remark')(<TextArea placeholder="客户描述" rows={10} />)}
|
184
|
188
|
</Form.Item>
|
185
|
189
|
<Form.Item style={{ display: 'flex', justifyContent: 'center' }}>
|
186
|
|
- {data.status==='1'&& <>
|
187
|
|
- <AuthButton name="customer.common.verify">
|
188
|
|
- <Button type="primary" htmlType="submit" >
|
189
|
|
- 确定
|
190
|
|
- </Button>
|
191
|
|
- </AuthButton>
|
192
|
|
- <AuthButton name="customer.common.verify">
|
193
|
|
- <Button type="danger" ghost style={{marginLeft: '4em'}} onClick={() => submitDate({ status: '2' })}>
|
194
|
|
- 无效
|
195
|
|
- </Button>
|
196
|
|
- </AuthButton>
|
197
|
|
- </>}
|
198
|
|
- <Button style={{marginLeft: '4em'}} onClick={() => router.goBack(-1)}>
|
|
190
|
+ {data.status === '1' && (
|
|
191
|
+ <>
|
|
192
|
+ <AuthButton name="customer.common.verify">
|
|
193
|
+ <Button type="primary" htmlType="submit">
|
|
194
|
+ 确定
|
|
195
|
+ </Button>
|
|
196
|
+ </AuthButton>
|
|
197
|
+ <AuthButton name="customer.common.verify">
|
|
198
|
+ <Button
|
|
199
|
+ type="danger"
|
|
200
|
+ ghost
|
|
201
|
+ style={{ marginLeft: '4em' }}
|
|
202
|
+ onClick={() => submitDate({ status: '2' })}
|
|
203
|
+ >
|
|
204
|
+ 无效
|
|
205
|
+ </Button>
|
|
206
|
+ </AuthButton>
|
|
207
|
+ </>
|
|
208
|
+ )}
|
|
209
|
+ <Button style={{ marginLeft: '4em' }} onClick={() => router.goBack(-1)}>
|
199
|
210
|
取消
|
200
|
211
|
</Button>
|
201
|
212
|
</Form.Item>
|
|
@@ -205,4 +216,4 @@ function body(props) {
|
205
|
216
|
}
|
206
|
217
|
const WrappedBody = Form.create({ name: 'body' })(body);
|
207
|
218
|
|
208
|
|
-export default WrappedBody
|
|
219
|
+export default WrappedBody;
|