dingxin 5 gadus atpakaļ
vecāks
revīzija
2ecf1f8644

+ 55
- 141
src/pages/customer/customerlist/index.jsx Parādīt failu

@@ -5,140 +5,15 @@ import request from '../../../utils/request';
5 5
 import apis from '../../../services/apis';
6 6
 import Styles from './style.less';
7 7
 
8
+import Attribution from './components/attribution'
9
+import IntegralRecord from './components/integralRecord'
10
+import ChangeStatus from './components/changeStatus'
11
+
8 12
 
9 13
 const { Option } = Select;
10 14
 // eslint-disable-next-line @typescript-eslint/no-unused-vars
11 15
 const { Meta } = Card;
12 16
 
13
-/**
14
- * 调整归属
15
- *  (废弃, 后面研究)
16
- *
17
- * @param {*} props
18
- * @returns
19
- */
20
-class ModalTable extends React.Component {
21
-  constructor(props) {
22
-    super(props);
23
-    this.state = {
24
-       dataSource: { records: [] },
25
-       visibleData: { visible: false, customerId: '', realtyConsultant: '' },
26
-    }
27
-  }
28
-
29
-  // 挂载之后
30
-  componentDidMount() {
31
-    this.getList({ pageNumber: 1, pageSize: 5 })
32
-  }
33
-
34
-  componentDidUpdate(preProps, preState) {
35
-    if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
36
-      this.getList({ pageNumber: 1, pageSize: 5 })
37
-      this.setState({ visibleData: this.props.visibleData });
38
-    }
39
-  }
40
-
41
-  // 弹框确定按钮
42
-  // eslint-disable-next-line react/sort-comp
43
-  handleOk() {
44
-    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
45
-  }
46
-
47
-  // 弹框取消按钮
48
-  handleCancel() {
49
-    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
50
-  }
51
-
52
-  getList(params) {
53
-    // 网路请求
54
-    request({ ...apis.customer.consultant, params: { ...params } }).then(res => {
55
-      this.setState({ dataSource: res })
56
-    }).catch(err => {
57
-      // eslint-disable-next-line no-unused-expressions
58
-      <Alert
59
-        style={{
60
-          marginBottom: 24,
61
-        }}
62
-        message={err}
63
-        type="error"
64
-        showIcon
65
-      />
66
-    })
67
-  }
68
-
69
-   // 分页
70
-  onChange(pageNum) {
71
-    this.getList({ pageNumber: pageNum, pageSize: 5 })
72
-  }
73
-
74
-  // 提交
75
-  submitGm() {
76
-    const { url, method } = apis.customer.recommendEdit
77
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(this.state.visibleData.customerId)
78
-
79
-    // 网路请求
80
-    request({ url: tempUrl, method, data: { ...this.state.visibleData } }).then(res => {
81
-      this.handleCancel()
82
-    }).catch(err => {
83
-      // eslint-disable-next-line no-unused-expressions
84
-      <Alert
85
-        style={{
86
-          marginBottom: 24,
87
-        }}
88
-        message={err}
89
-        type="error"
90
-        showIcon
91
-      />
92
-    })
93
-  }
94
-
95
-  render() {
96
-    const columns = [
97
-      {
98
-        title: '姓名',
99
-        dataIndex: 'name',
100
-        key: 'name',
101
-      },
102
-      {
103
-        title: '电话',
104
-        dataIndex: 'phone',
105
-        key: 'phone',
106
-      },
107
-      {
108
-        title: '部门',
109
-        dataIndex: 'department',
110
-        key: 'department',
111
-      },
112
-      {
113
-        title: '岗位',
114
-        dataIndex: 'post',
115
-        key: 'post',
116
-      },
117
-      {
118
-        title: '操作',
119
-        dataIndex: 'personId',
120
-        key: 'personId',
121
-        // eslint-disable-next-line no-nested-ternary
122
-        render: (_, record) => <><Button className={Styles.SubmitButton} onClick={() => this.submitGm()}>确定</Button></>,
123
-      },
124
-    ]
125
-    return (
126
-      <>
127
-        <Modal
128
-            title="选择置业顾问"
129
-            destroyOnClose="true"
130
-            footer={null}
131
-            visible={this.state.visibleData.visible}
132
-            // onOk={() => this.handleOk()}
133
-            onCancel={(e) => this.handleCancel(e)}
134
-          >
135
-            <Table dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
136
-          </Modal>
137
-      </>
138
-    );
139
-  }
140
-}
141
-
142 17
 /**
143 18
  *
144 19
  *
@@ -158,9 +33,18 @@ function body(props) {
158 33
   // 调整归属 ============  start
159 34
   // eslint-disable-next-line react-hooks/rules-of-hooks
160 35
   const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
161
-
162 36
   // 调整归属 ============= end
163 37
 
38
+  // 积分记录 ============  start
39
+  // eslint-disable-next-line react-hooks/rules-of-hooks
40
+  const [recordVisibleData, setRecordVisibleData] = useState({ visible: false, customerId: '' })
41
+  // 积分记录 ============= end
42
+
43
+  // 变更状态 ============  start
44
+  // eslint-disable-next-line react-hooks/rules-of-hooks
45
+  const [statusVisibleData, setStatusVisibleData] = useState({ visible: false, customerId: '', status: '' })
46
+  // 变更状态 ============= end
47
+
164 48
   // eslint-disable-next-line react-hooks/rules-of-hooks
165 49
   useEffect(() => {
166 50
     getList({ pageNumber: 1, pageSize: 10, customerType })
@@ -183,8 +67,17 @@ function body(props) {
183 67
     })
184 68
   }
185 69
 
70
+  function displayNone() {
71
+    setRecordVisibleData({ visible: false, customerId: '' })
72
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
73
+    setStatusVisibleData({ visible: false, customerId: '', status: '' })
74
+  }
75
+
186 76
   // 提交事件
187 77
   function handleSubmit(e) {
78
+    displayNone()
79
+
80
+
188 81
     e.preventDefault();
189 82
     props.form.validateFields((err, values) => {
190 83
       if (!err) {
@@ -207,17 +100,33 @@ function body(props) {
207 100
 
208 101
   // 私客/公客切换
209 102
   function radioButtonHandleSizeChange(e) {
103
+    displayNone()
104
+
210 105
     const { value } = e.target
211 106
     setCustomerType(value)
212 107
     getList({ pageNumber: 1, pageSize: 10, customerType: value })
213 108
   }
214 109
 
215
-  // 调整归属 ============ start
216
-  // 调整归属 显示
217
-  function gM(row) {
218
-    setGVisibleData({ visible: true, customerId: row.customerId, realtyConsultant: row.realtyConsultant })
110
+  // 这里有个 Bug, 就是 Modal 弹框,会联动出现, 比如 我点击 调整归属的Model弹框, 那么 积分记录的Model弹框莫名其妙的也显示了
111
+  // 所有这里临时解决方法是,弹出一个Modal对话框的时候,把其他的对话框给隐藏
112
+
113
+  function showGM(record) {
114
+    setGVisibleData({ visible: true, customerId: record.customerId, realtyConsultant: record.realtyConsultant })
115
+    setRecordVisibleData({ visible: false, customerId: '' })
116
+    setStatusVisibleData({ visible: false, customerId: '' })
117
+  }
118
+
119
+  function showRecord(record) {
120
+    setRecordVisibleData({ visible: true, customerId: record.customerId })
121
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
122
+    setStatusVisibleData({ visible: false, customerId: '' })
123
+  }
124
+
125
+  function showStatus(record) {
126
+    setRecordVisibleData({ visible: false, customerId: '' })
127
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
128
+    setStatusVisibleData({ visible: true, customerId: record.customerId, status: record.status })
219 129
   }
220
-  // 调整归属 ============ end
221 130
 
222 131
   const columns = [
223 132
     {
@@ -272,13 +181,13 @@ function body(props) {
272 181
       // eslint-disable-next-line no-nested-ternary
273 182
       render: (_, record) => (
274 183
         <>
275
-          <sapn className={ customerType === 'private' ? Styles.text : Styles.displayS }>变更状态</sapn>
184
+          <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link" onClick={() => showStatus(record)}>变更状态</Button>
276 185
           &nbsp;&nbsp;
277
-          <sapn className={ customerType === 'private' ? Styles.text : Styles.displayS } onClick={() => gM(record)}>调整归属</sapn>
186
+          <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link" onClick={() => showGM(record)}>调整归属</Button>
278 187
           <br/>
279
-          <sapn className={ Styles.text }>查看详情</sapn>
188
+          <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link">查看详情</Button>
280 189
           &nbsp;&nbsp;
281
-          <sapn className={ Styles.text }>积分记录</sapn>
190
+          <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link" onClick={ () => showRecord(record) }>积分记录</Button>
282 191
         </>
283 192
       ),
284 193
     },
@@ -330,7 +239,7 @@ function body(props) {
330 239
           )}
331 240
         </Form.Item>
332 241
         <Form.Item>
333
-          <Button type="primary" htmlType="submit" className={Styles.SubmitButton}>
242
+          <Button type="danger" htmlType="submit" >
334 243
             搜索
335 244
           </Button>
336 245
         </Form.Item>
@@ -345,8 +254,13 @@ function body(props) {
345 254
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
346 255
 
347 256
         {/* 调整归属 */}
348
-        <ModalTable visibleData={gVisibleData} />
257
+        <Attribution visibleData={gVisibleData} />
258
+
259
+        {/* 积分记录 */}
260
+        <IntegralRecord visibleData={recordVisibleData} />
349 261
 
262
+        {/* 变更状态 */}
263
+        <ChangeStatus visibleData={statusVisibleData} />
350 264
     </>
351 265
   );
352 266
 }

+ 41
- 36
src/pages/customer/independentList/index.jsx Parādīt failu

@@ -44,8 +44,16 @@ class ModalTable extends React.Component {
44 44
   }
45 45
 
46 46
   getList(params) {
47
+    console.log('this.state.visibleData', this.state.visibleData)
48
+    const { customerId } = this.state.visibleData
49
+    if (customerId === '' || customerId === undefined) {
50
+      return
51
+    }
52
+    // 网路请求
53
+    const { url, method } = apis.customer.recommend
54
+    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(customerId)
47 55
     // 网路请求
48
-    request({ ...apis.customer.consultant, params: { ...params } }).then(res => {
56
+    request({ url: tempUrl, method, params: { ...params } }).then(res => {
49 57
       this.setState({ dataSource: res })
50 58
     }).catch(err => {
51 59
       // eslint-disable-next-line no-unused-expressions
@@ -65,31 +73,15 @@ class ModalTable extends React.Component {
65 73
     this.getList({ pageNumber: pageNum, pageSize: 5 })
66 74
   }
67 75
 
68
-  // 提交
69
-  submitGm() {
70
-    const { url, method } = apis.customer.recommendEdit
71
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(this.state.visibleData.customerId)
72
-
73
-    // 网路请求
74
-    request({ url: tempUrl, method, data: { ...this.state.visibleData } }).then(res => {
75
-      this.handleCancel()
76
-    }).catch(err => {
77
-      // eslint-disable-next-line no-unused-expressions
78
-      <Alert
79
-        style={{
80
-          marginBottom: 24,
81
-        }}
82
-        message={err}
83
-        type="error"
84
-        showIcon
85
-      />
86
-    })
87
-  }
88
-
89 76
   render() {
90 77
     const columns = [
91 78
       {
92
-        title: '姓名',
79
+        title: '头像',
80
+        // eslint-disable-next-line jsx-a11y/alt-text
81
+        render: (text, records) => <img src={records.picture } width={50} height={50} />,
82
+      },
83
+      {
84
+        title: '用户名',
93 85
         dataIndex: 'name',
94 86
         key: 'name',
95 87
       },
@@ -99,28 +91,41 @@ class ModalTable extends React.Component {
99 91
         key: 'phone',
100 92
       },
101 93
       {
102
-        title: '部门',
103
-        dataIndex: 'department',
104
-        key: 'department',
94
+        title: '性别',
95
+        dataIndex: 'sex',
96
+        key: 'sex',
97
+        render: (text, records) => <span>{ records.sex === 1 ? '男' : '女' }</span>,
98
+      },
99
+      {
100
+        title: '意向项目',
101
+        dataIndex: 'intention',
102
+        key: 'intention',
105 103
       },
106 104
       {
107
-        title: '岗位',
108
-        dataIndex: 'post',
109
-        key: 'post',
105
+        title: '推荐时间',
106
+        dataIndex: 'createDate',
107
+        key: 'createDate',
110 108
       },
111 109
       {
112
-        title: '操作',
113
-        dataIndex: 'personId',
114
-        key: 'personId',
115
-        // eslint-disable-next-line no-nested-ternary
116
-     render: (_, record) => <><Button className={Styles.SubmitButton} onClick={() => this.submitGm()}>确定</Button></>,
110
+        title: '状态',
111
+        // eslint-disable-next-line consistent-return
112
+        render: (text, records) => {
113
+                                    if (records.status === 1) { return '报备' }
114
+                                    if (records.status === 2) { return '到访' }
115
+                                    if (records.status === 3) { return '认购' }
116
+                                    if (records.status === 4) { return '签约' }
117
+                                    if (records.verifyStatus === 1) { return '待审核' }
118
+                                    if (records.verifyStatus === 2) { return '审核同意' }
119
+                                    if (records.verifyStatus === 3) { return '签约' }
120
+                                  },
117 121
       },
118 122
     ]
119 123
     return (
120 124
       <>
121 125
         <Modal
122
-            title="选择置业顾问"
126
+            title="推荐客户"
123 127
             destroyOnClose="true"
128
+            width={900}
124 129
             footer={null}
125 130
             visible={this.state.visibleData.visible}
126 131
             // onOk={() => this.handleOk()}
@@ -183,7 +188,7 @@ function body(props) {
183 188
     console.log(e)
184 189
   }
185 190
   function gM(row) {
186
-    setGVisibleData({ visible: true, customerId: row.customerId, realtyConsultant: row.realtyConsultant })
191
+    setGVisibleData({ visible: true, customerId: row.personId, realtyConsultant: row.realtyConsultant })
187 192
   }
188 193
 
189 194
   // 分页

+ 8
- 0
src/services/apis.js Parādīt failu

@@ -88,5 +88,13 @@ export default {
88 88
       method: 'PUT',
89 89
       url: `${prefix}/customer/recommend/edit/id`,
90 90
     },
91
+    taPointsRecords: {
92
+      method: 'GET',
93
+      url: `${prefix}/mine/taPointsRecords/id`,
94
+    },
95
+    recommend: {
96
+      method: 'GET',
97
+      url: `${prefix}/customer/recommend/id`,
98
+    },
91 99
   },
92 100
 }