魏熙美 5 years ago
parent
commit
d03b393f43

+ 4
- 12
src/pages/customer/customerlist/components/attribution.jsx View File

31
   }
31
   }
32
 
32
 
33
   componentDidUpdate(preProps, preState) {
33
   componentDidUpdate(preProps, preState) {
34
-    console.log(this.props.visibleData.realtyConsultant)
35
-    if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
34
+    if (this.props.visibleData.visible !== preState.visibleData.visible) {
36
       this.getList({ pageNumber: 1, pageSize: 5 })
35
       this.getList({ pageNumber: 1, pageSize: 5 })
37
       this.setState({ visibleData: this.props.visibleData });
36
       this.setState({ visibleData: this.props.visibleData });
38
     }
37
     }
41
   // 弹框确定按钮
40
   // 弹框确定按钮
42
   // eslint-disable-next-line react/sort-comp
41
   // eslint-disable-next-line react/sort-comp
43
   handleOk() {
42
   handleOk() {
44
-    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
43
+    this.props.onCancel()
45
   }
44
   }
46
 
45
 
47
   // 弹框取消按钮
46
   // 弹框取消按钮
48
   handleCancel() {
47
   handleCancel() {
49
-    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
48
+    this.props.onCancel()
50
   }
49
   }
51
 
50
 
52
   getList(params) {
51
   getList(params) {
55
       this.setState({ dataSource: res })
54
       this.setState({ dataSource: res })
56
     }).catch(err => {
55
     }).catch(err => {
57
       // eslint-disable-next-line no-unused-expressions
56
       // eslint-disable-next-line no-unused-expressions
58
-      <Alert
59
-        style={{
60
-          marginBottom: 24,
61
-        }}
62
-        message={err}
63
-        type="error"
64
-        showIcon
65
-      />
57
+      
66
     })
58
     })
67
   }
59
   }
68
 
60
 

+ 7
- 1
src/pages/customer/customerlist/index.jsx View File

171
     link.click()
171
     link.click()
172
   }
172
   }
173
 
173
 
174
+  // 关闭调整归属的窗口
175
+  function closeAttribution() {
176
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
177
+    getList({ pageNum: 1, pageSize: 10, customerType, ...props.form.getFieldsValue() })
178
+  }
179
+
174
   const publicColumns = [
180
   const publicColumns = [
175
     {
181
     {
176
       title: '头像',
182
       title: '头像',
374
       }
380
       }
375
       
381
       
376
       {/* 调整归属 */}
382
       {/* 调整归属 */}
377
-      <Attribution visibleData={gVisibleData} />
383
+      <Attribution visibleData={gVisibleData} onCancel={() => closeAttribution()}/>
378
 
384
 
379
       {/* 积分记录 */}
385
       {/* 积分记录 */}
380
       <IntegralRecord visibleData={recordVisibleData} />
386
       <IntegralRecord visibleData={recordVisibleData} />

+ 50
- 26
src/pages/customer/recommendCustomer/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 } from 'antd';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Upload, message, notification } from 'antd';
3
 import ImageUpload from '../../../components/XForm/ImageUpload';
3
 import ImageUpload from '../../../components/XForm/ImageUpload';
4
 import moment from 'moment';
4
 import moment from 'moment';
5
 import request from '../../../utils/request';
5
 import request from '../../../utils/request';
7
 import Styles from './style.less';
7
 import Styles from './style.less';
8
 import { router } from 'umi';
8
 import { router } from 'umi';
9
 
9
 
10
+import Attribution from './components/attribution'
11
+
10
 const { Option } = Select;
12
 const { Option } = Select;
11
 // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
 // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
 const { Meta } = Card;
14
 const { Meta } = Card;
24
   },
26
   },
25
 };
27
 };
26
 
28
 
29
+const openNotificationWithIcon = (type, message) => {
30
+  notification[type]({
31
+    message,
32
+    description:
33
+      '',
34
+  });
35
+}
36
+
27
 function body(props) {
37
 function body(props) {
28
   const { getFieldDecorator } = props.form
38
   const { getFieldDecorator } = props.form
29
 
39
 
40
+  // eslint-disable-next-line react-hooks/rules-of-hooks
41
+  const [visibleData, setVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
42
+
30
   // eslint-disable-next-line react-hooks/rules-of-hooks
43
   // eslint-disable-next-line react-hooks/rules-of-hooks
31
   const [dataSource, setDataSource] = useState({ picture: '' })
44
   const [dataSource, setDataSource] = useState({ picture: '' })
32
 
45
 
49
 
62
 
50
   function submitDate(params) {
63
   function submitDate(params) {
51
     // props.form.setFieldsValue(res)
64
     // props.form.setFieldsValue(res)
52
-    request({ ...apis.customer.auto, urlData: { id: params.customerId }, params: { verifyStatus: params.verifyStatus } }).then(() => {
65
+    request({ ...apis.customer.auto, urlData: { id: params.customerId || props.form.getFieldValue('customerId') }, params: { verifyStatus: params.verifyStatus } }).then(() => {
53
       // eslint-disable-next-line no-unused-expressions
66
       // eslint-disable-next-line no-unused-expressions
54
-      <Alert
55
-        style={{
56
-          marginBottom: 24,
57
-        }}
58
-        message="操作成功"
59
-        type="success"
60
-        showIcon
61
-      />
67
+      openNotificationWithIcon('success', '操作成功')
62
       router.go(-1)
68
       router.go(-1)
63
     }).catch(err => {
69
     }).catch(err => {
64
       // eslint-disable-next-line no-unused-expressions
70
       // eslint-disable-next-line no-unused-expressions
65
-      <Alert
66
-        style={{
67
-          marginBottom: 24,
68
-        }}
69
-        message={err}
70
-        type="error"
71
-        showIcon
72
-      />
71
+
73
     })
72
     })
74
   }
73
   }
75
 
74
 
89
     console.log(e)
88
     console.log(e)
90
   }
89
   }
91
 
90
 
91
+  // 显示选择置业顾问的窗口
92
+  function showConsultant() {
93
+    setVisibleData({ visible: true, customerId: props.form.getFieldValue('customerId'), realtyConsultant: props.form.getFieldValue('realtyConsultant') })
94
+  }
95
+
96
+  // 关闭选择置业顾问的窗口
97
+  function closeConsultant() {
98
+    setVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
99
+  }
100
+
101
+  // 选择置业顾问弹窗
102
+  function consultantSuccess(e) {
103
+    props.form.setFieldsValue({ realtyConsultant: e.realtyConsultant, consultantName: e.name })
104
+  }
105
+
92
   return (
106
   return (
93
     <>
107
     <>
94
       <Form {...tailFormItemLayout} onSubmit={e => handleSubmit(e)} style={{ width: '800px', margin: 'auto' }}>
108
       <Form {...tailFormItemLayout} onSubmit={e => handleSubmit(e)} style={{ width: '800px', margin: 'auto' }}>
99
             />,
113
             />,
100
           )}
114
           )}
101
         </Form.Item>
115
         </Form.Item>
116
+        <Form.Item label="归属人" style={{ display: 'none' }}>
117
+          {getFieldDecorator('realtyConsultant')(
118
+            <Input
119
+              placeholder="归属人"
120
+            />,
121
+          )}
122
+        </Form.Item>
102
         <Form.Item label="意向项目:">
123
         <Form.Item label="意向项目:">
103
           {getFieldDecorator('intention')(
124
           {getFieldDecorator('intention')(
104
             <Input
125
             <Input
159
             <DatePicker showTime placeholder="报备日期" />,
180
             <DatePicker showTime placeholder="报备日期" />,
160
           )}
181
           )}
161
         </Form.Item>
182
         </Form.Item>
162
-        <Form.Item label="状态">
183
+        {/* <Form.Item label="状态">
163
           {getFieldDecorator('verifyStatus')(
184
           {getFieldDecorator('verifyStatus')(
164
             <Select style={{ width: '180px' }} placeholder="状态" onChange={handleSelectChange}>
185
             <Select style={{ width: '180px' }} placeholder="状态" onChange={handleSelectChange}>
165
               <Option value={0}>未通过</Option>
186
               <Option value={0}>未通过</Option>
167
               <Option value={2}>已驳回</Option>
188
               <Option value={2}>已驳回</Option>
168
             </Select>,
189
             </Select>,
169
           )}
190
           )}
170
-        </Form.Item>
191
+        </Form.Item> */}
171
         <Form.Item label="归属置业顾问">
192
         <Form.Item label="归属置业顾问">
172
             <Row gutter={8}>
193
             <Row gutter={8}>
173
               <Col span={12}>
194
               <Col span={12}>
174
-                {getFieldDecorator('consultantName')(<Input placeholder="归属置业顾问" />)}
195
+                {getFieldDecorator('consultantName')(<Input placeholder="请选择置业顾问" />)}
175
               </Col>
196
               </Col>
176
               <Col span={12}>
197
               <Col span={12}>
177
-                <Button>选择</Button>
198
+                <Button onClick={() => showConsultant()}>选择</Button>
178
               </Col>
199
               </Col>
179
             </Row>
200
             </Row>
180
         </Form.Item>
201
         </Form.Item>
181
         <Form.Item style={{ display: 'flex', justifyContent: 'center' }}>
202
         <Form.Item style={{ display: 'flex', justifyContent: 'center' }}>
182
-          <Button type="primary" htmlType="submit" className={Styles.SubmitButton}>
183
-            确定
203
+          <Button type="primary" className={Styles.SubmitButton} onClick={() => submitDate({ verifyStatus: '1' })}>
204
+            审核通过
184
           </Button>
205
           </Button>
185
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
206
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
186
-          <Button onClick={() => router.go(-1)}>
187
-            取消
207
+          <Button onClick={() => submitDate({ verifyStatus: '2' })}>
208
+            驳回
188
           </Button>
209
           </Button>
189
         </Form.Item>
210
         </Form.Item>
190
       </Form>
211
       </Form>
212
+
213
+      {/* 选择置业顾问 */}
214
+      <Attribution visibleData={visibleData} onCancel={() => closeConsultant()} onSuccess={e => consultantSuccess(e)}/>
191
     </>
215
     </>
192
   );
216
   );
193
 }
217
 }

+ 141
- 0
src/pages/customer/recommendCustomer/components/attribution.jsx View File

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 ModalAttribution extends React.Component {
20
+  constructor(props) {
21
+    super(props);
22
+    this.state = {
23
+       dataSource: { records: [] },
24
+       visibleData: { visible: false, customerId: '', realtyConsultant: '' },
25
+    }
26
+  }
27
+
28
+  // 挂载之后
29
+  componentDidMount() {
30
+    this.getList({ pageNumber: 1, pageSize: 5 })
31
+  }
32
+
33
+  componentDidUpdate(preProps, preState) {
34
+    if (this.props.visibleData.visible !== preState.visibleData.visible) {
35
+      this.getList({ pageNumber: 1, pageSize: 5 })
36
+      this.setState({ visibleData: this.props.visibleData });
37
+    }
38
+  }
39
+
40
+  // 弹框确定按钮
41
+  // eslint-disable-next-line react/sort-comp
42
+  handleOk() {
43
+    this.props.onCancel()
44
+  }
45
+
46
+  // 弹框取消按钮
47
+  handleCancel() {
48
+    this.props.onCancel()
49
+  }
50
+
51
+  getList(params) {
52
+    // 网路请求
53
+    request({ ...apis.customer.consultant, params: { ...params } }).then(res => {
54
+      this.setState({ dataSource: res })
55
+    }).catch(err => {
56
+      // eslint-disable-next-line no-unused-expressions
57
+
58
+    })
59
+  }
60
+
61
+  openNotificationWithIcon = (type, message) => {
62
+    notification[type]({
63
+      message,
64
+      description:
65
+        '',
66
+    });
67
+  };
68
+
69
+   // 分页
70
+  onChange(pageNum) {
71
+    this.getList({ pageNumber: pageNum, pageSize: 5 })
72
+  }
73
+
74
+  // 提交
75
+  submitGm(record) {
76
+    // 网路请求
77
+    request({ ...apis.customer.recommendEdit, urlData: { id: this.state.visibleData.customerId }, data: { customerId: this.state.visibleData.customerId, realtyConsultant: record.personId } }).then(res => {
78
+      // eslint-disable-next-line no-unused-expressions
79
+      this.openNotificationWithIcon('success', '操作成功')
80
+      this.handleCancel()
81
+      this.props.onSuccess({ realtyConsultant: record.personId, name: record.name })
82
+    }).catch(err => {
83
+      // eslint-disable-next-line no-unused-expressions
84
+      // this.openNotificationWithIcon('error', err)
85
+    })
86
+  }
87
+
88
+  render() {
89
+    const columns = [
90
+      // {
91
+      //   title: '编号',
92
+      //   dataIndex: 'personId',
93
+      //   key: 'personId',
94
+      // },
95
+      {
96
+        title: '姓名',
97
+        dataIndex: 'name',
98
+        key: 'name',
99
+      },
100
+      {
101
+        title: '电话',
102
+        dataIndex: 'phone',
103
+        key: 'phone',
104
+      },
105
+      {
106
+        title: '部门',
107
+        dataIndex: 'department',
108
+        key: 'department',
109
+      },
110
+      {
111
+        title: '岗位',
112
+        dataIndex: 'post',
113
+        key: 'post',
114
+      },
115
+      {
116
+        title: '操作',
117
+        dataIndex: 'personId',
118
+        key: 'personId',
119
+        // eslint-disable-next-line no-nested-ternary
120
+        render: (_, record) => <>{ this.props.visibleData.realtyConsultant !== record.personId && <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
121
+      },
122
+    ]
123
+    return (
124
+      <>
125
+        <Modal
126
+            title="选择置业顾问"
127
+            width={800}
128
+            destroyOnClose="true"
129
+            footer={null}
130
+            visible={this.state.visibleData.visible}
131
+            // onOk={() => this.handleOk()}
132
+            onCancel={(e) => this.handleCancel(e)}
133
+          >
134
+            <Table rowKey="attribution" dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
135
+          </Modal>
136
+      </>
137
+    );
138
+  }
139
+}
140
+
141
+export default ModalAttribution

+ 2
- 2
src/pages/customer/recommendCustomer/index.jsx View File

160
       title: '状态',
160
       title: '状态',
161
       dataIndex: 'verifyStatus',
161
       dataIndex: 'verifyStatus',
162
       key: 'verifyStatus',
162
       key: 'verifyStatus',
163
-      render: (_, record) => <><span>{ record.verifyStatus === 0 ? '未通过': record.verifyStatus === 1 ? '已通过' : record.verifyStatus === 2 ? '已驳回' : '' }</span></>,
163
+      render: (_, record) => <><span>{ record.verifyStatus === 0 ? '待审核': record.verifyStatus === 1 ? '已通过' : record.verifyStatus === 2 ? '已驳回' : '' }</span></>,
164
     },
164
     },
165
     {
165
     {
166
       title: '操作',
166
       title: '操作',
170
         <>
170
         <>
171
           {
171
           {
172
             <AuthButton name="admin.customer.recommend.verify.id.put" noRight={null}>
172
             <AuthButton name="admin.customer.recommend.verify.id.put" noRight={null}>
173
-              {record.verifyStatus === null ? <span style={{ color: 'rgba(239,39,58,1)',cursor: 'pointer' }} onClick={() => toAudit(record.customerId)}>审核</span> : ''}
173
+              {record.verifyStatus === 0 ? <span style={{ color: 'rgba(239,39,58,1)',cursor: 'pointer' }} onClick={() => toAudit(record.customerId)}>审核</span> : ''}
174
             </AuthButton>
174
             </AuthButton>
175
           }
175
           }
176
         </>
176
         </>