dingxin 5 years ago
parent
commit
9f1f02c958

+ 0
- 30
src/pages/channel/InviteClients.jsx View File

10
 function handleChange(value) {
10
 function handleChange(value) {
11
   console.log(`selected ${value}`);
11
   console.log(`selected ${value}`);
12
 }
12
 }
13
-
14
-// const dataSource = [
15
-//   {
16
-//     key: '1',
17
-//     img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
18
-//     name: '123',
19
-//     age: 32,
20
-//     address: '西湖区湖底公园1号',
21
-//   },
22
-//   {
23
-//     key: '2',
24
-//     img: '',
25
-//     age: 42,
26
-//     address: '西湖区湖底公园1号',
27
-//   },
28
-// ];
29
-
30
 const columns = [
13
 const columns = [
31
   {
14
   {
32
     title: '头像',
15
     title: '头像',
75
       setData(data)
58
       setData(data)
76
   })
59
   })
77
   }
60
   }
78
-  // value 的值
79
-  // eslint-disable-next-line no-shadow
80
-  function handleChange(value) {
81
-    // setQueryData({ ...queryData, channelId: value });
82
-    localStorage.setItem('value', value);
83
-  }
84
-  // 查询
85
-  function queryList() {
86
-    getList({ pageNum: 1, pageSize: 10 })
87
-  }
88
-
89
-
90
   // 分页
61
   // 分页
91
   function onChange(pageNumber) {
62
   function onChange(pageNumber) {
92
     // eslint-disable-next-line react-hooks/rules-of-hooks
63
     // eslint-disable-next-line react-hooks/rules-of-hooks
93
       getList({ pageNum: pageNumber, pageSize: 9 })
64
       getList({ pageNum: pageNumber, pageSize: 9 })
94
   }
65
   }
95
-
96
   return (
66
   return (
97
     <>
67
     <>
98
       <div className={channels.searchBox}>
68
       <div className={channels.searchBox}>

+ 128
- 3
src/pages/customer/independentList/index.jsx View File

10
 const { Option } = Select;
10
 const { Option } = Select;
11
 // eslint-disable-next-line @typescript-eslint/no-unused-vars
11
 // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
 const { Meta } = Card;
12
 const { Meta } = Card;
13
-
13
+/**
14
+ * 推荐客户
15
+ */
14
 class ModalTable extends React.Component {
16
 class ModalTable extends React.Component {
15
   constructor(props) {
17
   constructor(props) {
16
     super(props);
18
     super(props);
137
     );
139
     );
138
   }
140
   }
139
 }
141
 }
142
+
143
+
144
+/**
145
+ * 邀请客户
146
+ */
147
+class InviteTable extends React.Component {
148
+  constructor(props) {
149
+    super(props);
150
+    this.state = {
151
+       dataSource: { records: [] },
152
+       visibleData: { visible: false, customerId: '', realtyConsultant: '' },
153
+    }
154
+  }
155
+
156
+  // 挂载之后
157
+  componentDidMount() {
158
+    const { customerId } = this.state.visibleData
159
+    this.getList({ id: customerId, pageNumber: 1, pageSize: 5 })
160
+  }
161
+
162
+  componentDidUpdate(preProps, preState) {
163
+    const { customerId } = this.state.visibleData
164
+    if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
165
+      this.getList({ id: customerId, pageNumber: 1, pageSize: 5 })
166
+      this.setState({ visibleData: this.props.visibleData });
167
+    }
168
+  }
169
+
170
+  // 弹框确定按钮
171
+  // eslint-disable-next-line react/sort-comp
172
+  handleOk() {
173
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
174
+  }
175
+
176
+  // 弹框取消按钮
177
+  handleCancel() {
178
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
179
+  }
180
+
181
+  getList(params) {
182
+     const { customerId } = this.props.visibleData
183
+    if (customerId === '' || customerId === undefined) {
184
+      return
185
+    }
186
+    request({ ...apis.customer.InviteClientsList, params: { ...params } }).then(res => {
187
+      this.setState({ dataSource: res })
188
+    }).catch(err => {
189
+      // eslint-disable-next-line no-unused-expressions
190
+      <Alert
191
+        style={{
192
+          marginBottom: 24,
193
+        }}
194
+        message={err}
195
+        type="error"
196
+        showIcon
197
+      />
198
+    })
199
+  }
200
+
201
+   // 分页
202
+  onChange(pageNum) {
203
+    this.getList({ pageNumber: pageNum, pageSize: 5 })
204
+  }
205
+
206
+  render() {
207
+    const columns = [
208
+      {
209
+        title: '头像',
210
+        dataIndex: 'img',
211
+        key: 'img',
212
+        align: 'center',
213
+        render: (text, record) => <img src={record.avatarurl}  width = {50} height = {50}/>,
214
+      },
215
+      {
216
+        title: '用户姓名',
217
+        dataIndex: 'name',
218
+        key: 'name',
219
+        align: 'center',
220
+        render: text => <a>{text}</a>,
221
+      },
222
+      {
223
+        title: '电话',
224
+        dataIndex: 'tel',
225
+        key: 'tel',
226
+        align: 'center',
227
+      },
228
+      {
229
+        title: '性别',
230
+        dataIndex: 'sex',
231
+        key: 'sex',
232
+        align: 'center',
233
+        render: (text, list) => <span>{ list.sex === 1 ? '男' : '女' }</span>,
234
+      },
235
+    ]
236
+    return (
237
+      <>
238
+        <Modal
239
+            title="推荐客户"
240
+            destroyOnClose="true"
241
+            width={900}
242
+            footer={null}
243
+            visible={this.state.visibleData.visible}
244
+            // onOk={() => this.handleOk()}
245
+            onCancel={(e) => this.handleCancel(e)}
246
+          >
247
+            <Table dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
248
+          </Modal>
249
+      </>
250
+    );
251
+  }
252
+}
253
+
140
 /**
254
 /**
141
  *
255
  *
142
- *
256
+ *主题列表
143
  * @param {*} props
257
  * @param {*} props
144
  * @returns
258
  * @returns
145
  */
259
  */
182
   }
296
   }
183
   // eslint-disable-next-line react-hooks/rules-of-hooks
297
   // eslint-disable-next-line react-hooks/rules-of-hooks
184
   const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
298
   const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
299
+  // eslint-disable-next-line react-hooks/rules-of-hooks
300
+  const [gInviteData, setGInviteData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
185
   // Change 事件
301
   // Change 事件
186
   function handleSelectChange(e) {
302
   function handleSelectChange(e) {
187
     // eslint-disable-next-line no-console
303
     // eslint-disable-next-line no-console
189
   }
305
   }
190
   function gM(row) {
306
   function gM(row) {
191
     setGVisibleData({ visible: true, customerId: row.personId, realtyConsultant: row.realtyConsultant })
307
     setGVisibleData({ visible: true, customerId: row.personId, realtyConsultant: row.realtyConsultant })
308
+
309
+    setGInviteData({ visible: false })
310
+  }
311
+
312
+  function Invite(row) {
313
+    setGInviteData({ visible: true, customerId: row.personId, realtyConsultant: row.realtyConsultant })
314
+
315
+    setGVisibleData({ visible: false })
192
   }
316
   }
193
 
317
 
194
   // 分页
318
   // 分页
251
             <>
375
             <>
252
               <sapn style={{ color: 'rgba(239,39,58,1)' }}>查看详细</sapn>
376
               <sapn style={{ color: 'rgba(239,39,58,1)' }}>查看详细</sapn>
253
               &nbsp;&nbsp;&nbsp;&nbsp;
377
               &nbsp;&nbsp;&nbsp;&nbsp;
254
-              <sapn style={{ color: 'rgba(239,39,58,1)' }}>邀请经纪人</sapn>
378
+              <sapn style={{ color: 'rgba(239,39,58,1)' }} onClick={() => Invite(record)}>邀请经纪人</sapn>
255
               &nbsp;&nbsp;&nbsp;&nbsp;
379
               &nbsp;&nbsp;&nbsp;&nbsp;
256
               <sapn style={{ color: 'rgba(239,39,58,1)' }} onClick={() => gM(record)}>推荐客户</sapn>
380
               <sapn style={{ color: 'rgba(239,39,58,1)' }} onClick={() => gM(record)}>推荐客户</sapn>
257
             </>
381
             </>
290
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
414
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
291
             {/* 调整归属 */}
415
             {/* 调整归属 */}
292
         <ModalTable visibleData={gVisibleData} />
416
         <ModalTable visibleData={gVisibleData} />
417
+        <InviteTable visibleData={gInviteData} />
293
     </>
418
     </>
294
   );
419
   );
295
 }
420
 }

+ 4
- 0
src/services/apis.js View File

96
       method: 'GET',
96
       method: 'GET',
97
       url: `${prefix}/customer/recommend/id`,
97
       url: `${prefix}/customer/recommend/id`,
98
     },
98
     },
99
+    InviteClientsList: {
100
+      method: 'GET',
101
+      url: `${prefix}/channel/InviteClientsList`,
102
+    },
99
   },
103
   },
100
 }
104
 }