zlisen 3 anos atrás
pai
commit
44027ec2fd

+ 56
- 32
src/pages/customer/Customer/statusChange.jsx Ver arquivo

@@ -35,7 +35,7 @@ const header = props => {
35 35
 
36 36
   const { id, buildingId } = props.location.query;
37 37
 
38
-const [loading,setLoading] = useState(false)
38
+  const [loading, setLoading] = useState(false);
39 39
   const [data, setData] = useState({});
40 40
   const [apartmentTypeList, setApartmentTypeList] = useState([]);
41 41
 
@@ -79,11 +79,10 @@ const [loading,setLoading] = useState(false)
79 79
   function handleSubmit(e) {
80 80
     e.preventDefault();
81 81
     props.form.validateFields((err, values) => {
82
-      console.log(values, 'values');
83 82
       if (!err) {
84 83
         const { status } = values;
85 84
         // values.isNewHouse =  values.isNewHouse?1:0
86
-setLoading(true)
85
+        setLoading(true);
87 86
         if (status == 3) {
88 87
           //认筹
89 88
           const params = {
@@ -91,7 +90,9 @@ setLoading(true)
91 90
             customerPreparatory: {
92 91
               ...values,
93 92
               customerId: id,
93
+              channeCustomerId: data.channelCustomer?.channelCustomerId,
94 94
             },
95
+            
95 96
           };
96 97
           request({
97 98
             ...apis.customer.preparatory,
@@ -99,8 +100,8 @@ setLoading(true)
99 100
           })
100 101
             .then(data => {
101 102
               message.info('认筹成功');
102
-              setLoading(false)
103
-                cancelPage();
103
+              setLoading(false);
104
+              cancelPage();
104 105
             })
105 106
             .catch(err => {
106 107
               message.info(err.msg || err.message);
@@ -111,41 +112,45 @@ setLoading(true)
111 112
             customerSignatory: {
112 113
               ...values,
113 114
               customerId: id,
115
+              channeCustomerId: data.channelCustomer?.channelCustomerId,
114 116
             },
117
+           
115 118
           };
116 119
           request({
117 120
             ...apis.customer.signatory,
118 121
             data: params,
119 122
           })
120 123
             .then(data => {
121
-              message.info('认筹成功');
122
-              setLoading(false)
123
-                cancelPage();
124
+              message.info('签约成功');
125
+              setLoading(false);
126
+              cancelPage();
124 127
             })
125 128
             .catch(err => {
126 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 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,10 +162,16 @@ setLoading(true)
157 162
       <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
158 163
         <Form.Item label="变更状态为">
159 164
           {getFieldDecorator('status', {
160
-            // initialValue: data.status,
165
+            initialValue: data.status,
161 166
             rules: [{ required: true, message: ' 请选择变更状态' }],
162 167
           })(
163 168
             <Select>
169
+              <Option value={1} disabled>
170
+                报备
171
+              </Option>
172
+              <Option value={2} disabled>
173
+                到访
174
+              </Option>
164 175
               <Option value={3}>认筹</Option>
165 176
               <Option value={4}>签约</Option>
166 177
               <Option value={5}>结佣</Option>
@@ -210,7 +221,11 @@ setLoading(true)
210 221
               })(
211 222
                 <Select>
212 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 230
                 </Select>,
216 231
               )}
@@ -230,7 +245,7 @@ setLoading(true)
230 245
           </>
231 246
         )}
232 247
 
233
-{props.form.getFieldValue('status') == 5 && (
248
+        {props.form.getFieldValue('status') == 5 && (
234 249
           <>
235 250
             <Form.Item label="业绩分成人">
236 251
               {getFieldDecorator('dividendsName', {})(<Input placeholder="业绩分成人" />)}
@@ -244,7 +259,11 @@ setLoading(true)
244 259
               })(
245 260
                 <Select>
246 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 268
                 </Select>,
250 269
               )}
@@ -265,7 +284,12 @@ setLoading(true)
265 284
         )}
266 285
 
267 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 294
           </Button>
271 295
           <Button onClick={() => router.go(-1)}>取消</Button>

+ 86
- 75
src/pages/recommend/customer/audit.jsx Ver arquivo

@@ -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;