zlisen 3 years ago
parent
commit
44027ec2fd
2 changed files with 142 additions and 107 deletions
  1. 56
    32
      src/pages/customer/Customer/statusChange.jsx
  2. 86
    75
      src/pages/recommend/customer/audit.jsx

+ 56
- 32
src/pages/customer/Customer/statusChange.jsx View File

35
 
35
 
36
   const { id, buildingId } = props.location.query;
36
   const { id, buildingId } = props.location.query;
37
 
37
 
38
-const [loading,setLoading] = useState(false)
38
+  const [loading, setLoading] = useState(false);
39
   const [data, setData] = useState({});
39
   const [data, setData] = useState({});
40
   const [apartmentTypeList, setApartmentTypeList] = useState([]);
40
   const [apartmentTypeList, setApartmentTypeList] = useState([]);
41
 
41
 
79
   function handleSubmit(e) {
79
   function handleSubmit(e) {
80
     e.preventDefault();
80
     e.preventDefault();
81
     props.form.validateFields((err, values) => {
81
     props.form.validateFields((err, values) => {
82
-      console.log(values, 'values');
83
       if (!err) {
82
       if (!err) {
84
         const { status } = values;
83
         const { status } = values;
85
         // values.isNewHouse =  values.isNewHouse?1:0
84
         // values.isNewHouse =  values.isNewHouse?1:0
86
-setLoading(true)
85
+        setLoading(true);
87
         if (status == 3) {
86
         if (status == 3) {
88
           //认筹
87
           //认筹
89
           const params = {
88
           const params = {
91
             customerPreparatory: {
90
             customerPreparatory: {
92
               ...values,
91
               ...values,
93
               customerId: id,
92
               customerId: id,
93
+              channeCustomerId: data.channelCustomer?.channelCustomerId,
94
             },
94
             },
95
+            
95
           };
96
           };
96
           request({
97
           request({
97
             ...apis.customer.preparatory,
98
             ...apis.customer.preparatory,
99
           })
100
           })
100
             .then(data => {
101
             .then(data => {
101
               message.info('认筹成功');
102
               message.info('认筹成功');
102
-              setLoading(false)
103
-                cancelPage();
103
+              setLoading(false);
104
+              cancelPage();
104
             })
105
             })
105
             .catch(err => {
106
             .catch(err => {
106
               message.info(err.msg || err.message);
107
               message.info(err.msg || err.message);
111
             customerSignatory: {
112
             customerSignatory: {
112
               ...values,
113
               ...values,
113
               customerId: id,
114
               customerId: id,
115
+              channeCustomerId: data.channelCustomer?.channelCustomerId,
114
             },
116
             },
117
+           
115
           };
118
           };
116
           request({
119
           request({
117
             ...apis.customer.signatory,
120
             ...apis.customer.signatory,
118
             data: params,
121
             data: params,
119
           })
122
           })
120
             .then(data => {
123
             .then(data => {
121
-              message.info('认筹成功');
122
-              setLoading(false)
123
-                cancelPage();
124
+              message.info('签约成功');
125
+              setLoading(false);
126
+              cancelPage();
124
             })
127
             })
125
             .catch(err => {
128
             .catch(err => {
126
               message.info(err.msg || err.message);
129
               message.info(err.msg || err.message);
127
             });
130
             });
128
-        }else if (status == 5) {
129
-            const params = {
131
+        } else if (status == 5) {
132
+          const params = {
133
+            customerId: id,
134
+            customerSignatory: {
135
+              ...values,
130
               customerId: id,
136
               customerId: id,
131
-              customerSignatory: {
132
-                ...values,
133
-                customerId: id,
134
-              },
135
-            };
136
-            request({
137
-              ...apis.customer.commission,
138
-              data: params,
137
+              channeCustomerId: data.channelCustomer?.channelCustomerId,
138
+            },
139
+
140
+          };
141
+          request({
142
+            ...apis.customer.commission,
143
+            data: params,
144
+          })
145
+            .then(data => {
146
+              message.info('结佣成功');
147
+              setLoading(false);
148
+              cancelPage();
139
             })
149
             })
140
-              .then(data => {
141
-                message.info('结佣成功');
142
-                setLoading(false)
143
-                  cancelPage();
144
-              })
145
-              .catch(err => {
146
-                message.info(err.msg || err.message);
147
-              });
148
-          }
150
+            .catch(err => {
151
+              message.info(err.msg || err.message);
152
+            });
153
+        }
149
       }
154
       }
150
     });
155
     });
151
   }
156
   }
157
       <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
162
       <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
158
         <Form.Item label="变更状态为">
163
         <Form.Item label="变更状态为">
159
           {getFieldDecorator('status', {
164
           {getFieldDecorator('status', {
160
-            // initialValue: data.status,
165
+            initialValue: data.status,
161
             rules: [{ required: true, message: ' 请选择变更状态' }],
166
             rules: [{ required: true, message: ' 请选择变更状态' }],
162
           })(
167
           })(
163
             <Select>
168
             <Select>
169
+              <Option value={1} disabled>
170
+                报备
171
+              </Option>
172
+              <Option value={2} disabled>
173
+                到访
174
+              </Option>
164
               <Option value={3}>认筹</Option>
175
               <Option value={3}>认筹</Option>
165
               <Option value={4}>签约</Option>
176
               <Option value={4}>签约</Option>
166
               <Option value={5}>结佣</Option>
177
               <Option value={5}>结佣</Option>
210
               })(
221
               })(
211
                 <Select>
222
                 <Select>
212
                   {apartmentTypeList?.map(x => {
223
                   {apartmentTypeList?.map(x => {
213
-                    return <Option key={x.apartmentId} value={x.apartmentId}>{x.apartmentName}</Option>;
224
+                    return (
225
+                      <Option key={x.apartmentId} value={x.apartmentId}>
226
+                        {x.apartmentName}
227
+                      </Option>
228
+                    );
214
                   })}
229
                   })}
215
                 </Select>,
230
                 </Select>,
216
               )}
231
               )}
230
           </>
245
           </>
231
         )}
246
         )}
232
 
247
 
233
-{props.form.getFieldValue('status') == 5 && (
248
+        {props.form.getFieldValue('status') == 5 && (
234
           <>
249
           <>
235
             <Form.Item label="业绩分成人">
250
             <Form.Item label="业绩分成人">
236
               {getFieldDecorator('dividendsName', {})(<Input placeholder="业绩分成人" />)}
251
               {getFieldDecorator('dividendsName', {})(<Input placeholder="业绩分成人" />)}
244
               })(
259
               })(
245
                 <Select>
260
                 <Select>
246
                   {apartmentTypeList?.map(x => {
261
                   {apartmentTypeList?.map(x => {
247
-                    return <Option key={x.apartmentId} value={x.apartmentId}>{x.apartmentName}</Option>;
262
+                    return (
263
+                      <Option key={x.apartmentId} value={x.apartmentId}>
264
+                        {x.apartmentName}
265
+                      </Option>
266
+                    );
248
                   })}
267
                   })}
249
                 </Select>,
268
                 </Select>,
250
               )}
269
               )}
265
         )}
284
         )}
266
 
285
 
267
         <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
286
         <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
268
-          <Button type="primary" htmlType="submit" loading={loading} style={{ marginRight: '20px' }}>
287
+          <Button
288
+            type="primary"
289
+            htmlType="submit"
290
+            loading={loading}
291
+            style={{ marginRight: '20px' }}
292
+          >
269
             确定
293
             确定
270
           </Button>
294
           </Button>
271
           <Button onClick={() => router.go(-1)}>取消</Button>
295
           <Button onClick={() => router.go(-1)}>取消</Button>

+ 86
- 75
src/pages/recommend/customer/audit.jsx View File

1
 import React, { useState, useEffect } from 'react';
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
 import ImageUpload from '@/components/XForm/ImageUpload';
21
 import ImageUpload from '@/components/XForm/ImageUpload';
4
 import AuthButton from '@/components/AuthButton';
22
 import AuthButton from '@/components/AuthButton';
5
 import moment from 'moment';
23
 import moment from 'moment';
7
 import apis from '@/services/apis';
25
 import apis from '@/services/apis';
8
 import { router } from 'umi';
26
 import { router } from 'umi';
9
 
27
 
10
-import Attribution from './components/attribution'
28
+import Attribution from './components/attribution';
11
 import BuildingSelect from '@/components/SelectButton/BuildSelect2';
29
 import BuildingSelect from '@/components/SelectButton/BuildSelect2';
12
 import ConsultantSelect from '@/components/SelectButton/consultantSelect';
30
 import ConsultantSelect from '@/components/SelectButton/consultantSelect';
13
 import ChannelSelect from '@/components/SelectButton/channelSelect';
31
 import ChannelSelect from '@/components/SelectButton/channelSelect';
14
 
32
 
15
-
16
 const { TextArea } = Input;
33
 const { TextArea } = Input;
17
 
34
 
18
 const tailFormItemLayout = {
35
 const tailFormItemLayout = {
29
 const openNotificationWithIcon = (type, message) => {
46
 const openNotificationWithIcon = (type, message) => {
30
   notification[type]({
47
   notification[type]({
31
     message,
48
     message,
32
-    description:
33
-      '',
49
+    description: '',
34
   });
50
   });
35
-}
51
+};
36
 
52
 
37
 function body(props) {
53
 function body(props) {
38
-  const { getFieldDecorator } = props.form
54
+  const { getFieldDecorator } = props.form;
39
 
55
 
40
   // eslint-disable-next-line react-hooks/rules-of-hooks
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
   // eslint-disable-next-line react-hooks/rules-of-hooks
64
   // eslint-disable-next-line react-hooks/rules-of-hooks
44
-  const [data, setData] = useState({})
65
+  const [data, setData] = useState({});
45
 
66
 
46
   const { id } = props.location.query;
67
   const { id } = props.location.query;
47
 
68
 
48
   if (id !== '') {
69
   if (id !== '') {
49
     // eslint-disable-next-line react-hooks/rules-of-hooks
70
     // eslint-disable-next-line react-hooks/rules-of-hooks
50
     useEffect(() => {
71
     useEffect(() => {
51
-      getById(id)
52
-    }, [])
72
+      getById(id);
73
+    }, []);
53
   }
74
   }
54
 
75
 
55
   // 获取详情信息
76
   // 获取详情信息
56
   function getById(currentId) {
77
   function getById(currentId) {
57
     request({ ...apis.customer.getDetail, urlData: { id: currentId } }).then(res => {
78
     request({ ...apis.customer.getDetail, urlData: { id: currentId } }).then(res => {
58
       // res.reportDate = moment(res.reportDate)
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
           // channelCustomer.channelId=res.channelCustomer.channelId
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
           // channelCustomer.remark=res.channelCustomer.remark
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
   function submitDate(data) {
97
   function submitDate(data) {
87
         name: props.form.getFieldValue('name'),
105
         name: props.form.getFieldValue('name'),
88
         customerVisit: {
106
         customerVisit: {
89
           imageUrl: props.form.getFieldValue('imageUrl'),
107
           imageUrl: props.form.getFieldValue('imageUrl'),
108
+          name: props.form.getFieldValue('name'),
90
         },
109
         },
91
         remark: props.form.getFieldValue('remark'),
110
         remark: props.form.getFieldValue('remark'),
92
       };
111
       };
102
         });
121
         });
103
     } else {
122
     } else {
104
       const params = {
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
     e.preventDefault();
142
     e.preventDefault();
125
     props.form.validateFields((err, values) => {
143
     props.form.validateFields((err, values) => {
126
       if (!err) {
144
       if (!err) {
127
-        submitDate({ status: '1' })
145
+        submitDate({ status: '1' });
128
         // submitDate({ ...values })
146
         // submitDate({ ...values })
129
       }
147
       }
130
     });
148
     });
131
   }
149
   }
132
 
150
 
133
-
134
   return (
151
   return (
135
     <Card>
152
     <Card>
136
       <Form {...tailFormItemLayout} onSubmit={e => handleSubmit(e)} style={{ maxWidth: '1000px' }}>
153
       <Form {...tailFormItemLayout} onSubmit={e => handleSubmit(e)} style={{ maxWidth: '1000px' }}>
142
           )}
159
           )}
143
         </Form.Item>*/}
160
         </Form.Item>*/}
144
         <Form.Item label="项目ID" style={{ display: 'none' }}>
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
         </Form.Item>
163
         </Form.Item>
151
         <Form.Item label="意向项目:">
164
         <Form.Item label="意向项目:">
152
           {getFieldDecorator('buildingId')(
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
         <Form.Item label="客户姓名">
169
         <Form.Item label="客户姓名">
161
-          {getFieldDecorator('name')(
162
-            <Input placeholder="客户姓名" />,
163
-          )}
170
+          {getFieldDecorator('name')(<Input placeholder="客户姓名" />)}
164
         </Form.Item>
171
         </Form.Item>
165
         {/* <Form.Item label="归属渠道">
172
         {/* <Form.Item label="归属渠道">
166
           {getFieldDecorator('channelId')(
173
           {getFieldDecorator('channelId')(
169
         </Form.Item> */}
176
         </Form.Item> */}
170
         <Form.Item label="归属置业顾问">
177
         <Form.Item label="归属置业顾问">
171
           {getFieldDecorator('realtyConsultant')(
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
         </Form.Item>
184
         </Form.Item>
185
+        <Form.Item label="到访照片">{getFieldDecorator('imageUrl')(<ImageUpload />)}</Form.Item>
180
         <Form.Item label="备注">
186
         <Form.Item label="备注">
181
-          {getFieldDecorator('remark')(
182
-            <TextArea placeholder="客户描述" rows={10} />,
183
-          )}
187
+          {getFieldDecorator('remark')(<TextArea placeholder="客户描述" rows={10} />)}
184
         </Form.Item>
188
         </Form.Item>
185
         <Form.Item style={{ display: 'flex', justifyContent: 'center' }}>
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
           </Button>
211
           </Button>
201
         </Form.Item>
212
         </Form.Item>
205
 }
216
 }
206
 const WrappedBody = Form.create({ name: 'body' })(body);
217
 const WrappedBody = Form.create({ name: 'body' })(body);
207
 
218
 
208
-export default WrappedBody
219
+export default WrappedBody;