Explorar el Código

经纪人信息

Baozhangchao hace 3 años
padre
commit
0e256bfb5f

+ 1
- 0
src/components/Auth/AuthPage/index.jsx Ver fichero

@@ -13,6 +13,7 @@ export default (props) => {
13 13
     page,
14 14
   } = props
15 15
 
16
+
16 17
   const [loading, setLoading] = useState(false)
17 18
   const { updatePhoneNumber } = useAuth(consultant, router, page)
18 19
 

+ 3
- 0
src/constants/api.js Ver fichero

@@ -28,6 +28,9 @@ export const API_INVALID = resolvePath('marking/invalidCustomer') // 无效
28 28
 
29 29
 // 获取经纪人绑定楼盘列表
30 30
 export const API_GET_AGENT_BUILDINGS = resolvePath('buildingChannel/buildings')
31
+//获取经纪人信息
32
+export const API_GET_AGENTS = resolvePath('customer/agents')
33
+
31 34
 
32 35
 // 课程
33 36
 export const API_COURSE_LIST = resolvePath('curriculum') // 课程列表

+ 9
- 1
src/services/card.js Ver fichero

@@ -6,7 +6,7 @@ import {
6 6
   API_CARDS_UV,
7 7
   API_CARDS_LIKE,
8 8
   API_FORM_ID,
9
-  API_CARDS_SHARE,
9
+  API_GET_AGENTS,
10 10
   API_CARD_FAVOR,
11 11
   API_UPDATE_PHOTO
12 12
 } from '@/constants/api'
@@ -19,6 +19,14 @@ import {
19 19
 export const getCardList = payload => fetch({ url: API_CARDS_LIST, payload })
20 20
 
21 21
 
22
+/**
23
+ * 获取经纪人信息
24
+ * @param {*} payload 
25
+ */
26
+export const getAgents = payload => fetch({ url: API_GET_AGENTS, payload })
27
+
28
+
29
+
22 30
 /**
23 31
  * 获取名片详情
24 32
  * @param {*} id

+ 34
- 11
src/subpackages/pages/marketing/changeVisit/index.jsx Ver fichero

@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react'
2 2
 import withLayout from '@/layout'
3 3
 import { ScrollView, Input, Image, Block, Picker } from '@tarojs/components'
4 4
 import '@/assets/css/iconfont.css'
5
-import { getCardList } from '@/services/card'
5
+import { getCardList, getAgents } from '@/services/card'
6 6
 import { fetch } from '@/utils/request'
7 7
 import Taro from '@tarojs/taro'
8 8
 import { formatDate } from "@/utils/chatDate";
@@ -14,12 +14,14 @@ export default withLayout((props) => {
14 14
   const { router } = props
15 15
   const { name, buildingId, type, id, channelId } = router.params
16 16
 
17
+
17 18
   const [RenChouData, setRenChouData] = useState({
18 19
     name,
19 20
     realtyConsultant: '',
20 21
     remark: '',
21 22
   })
22 23
 
24
+
23 25
   const [QianYueData, setQianYueData] = useState({
24 26
     name,
25 27
     realtyConsultant: '',
@@ -64,34 +66,52 @@ export default withLayout((props) => {
64 66
     }
65 67
   }, [buildingId])
66 68
 
69
+
70
+
71
+  const [agentsInfo, setAgentsInfo] = useState({
72
+    name: '',
73
+    channelName: ' ',
74
+  })
75
+
76
+
67 77
   useEffect(() => {
68 78
     fetch({ url: `${API_CUSTOMER_DETAILINFO}/${id}`, method: 'get' }).then((res) => {
69
-      if(CurrentStatusId - 0 === 3) {
79
+      //获取经纪人信息
80
+      setAgentsInfo({ name: res.name })
81
+      getAgents({ personId: res?.recommendPerson }).then((e) => {
82
+        let ganentsList = e.records
83
+        if ((ganentsList || []).length) {
84
+          // ganentsList
85
+          setAgentsInfo({ name: res.name, channelName: ganentsList[0].channelName })
86
+        }
87
+      })
88
+      if (CurrentStatusId - 0 === 3) {
70 89
         setFormData({ ...FormData, ...res?.customerPreparatory, realtyConsultant: res.customerPreparatory?.realtyConsultant })
71 90
       }
72 91
       setChannelCustomerId(res?.channelCustomer?.channelCustomerId)
73 92
       setRenChouData({ ...RenChouData, ...res?.customerPreparatory, realtyConsultant: res.customerPreparatory?.realtyConsultant })
74
-      if((res.customerSignatory || []).length) {
93
+      if ((res.customerSignatory || []).length) {
75 94
         let customerSignatory = res.customerSignatory[0]
76 95
         customerSignatory.dividendsPer = customerSignatory.dividendsName.substring(customerSignatory.dividendsName.indexOf('|') + 1, customerSignatory.dividendsName.indexOf('%'))
77 96
         customerSignatory.dividendsName = customerSignatory.dividendsName.substring(0, customerSignatory.dividendsName.indexOf('|'))
78
-        setQianYueData({...QianYueData, ...customerSignatory, realtyConsultant: (res.customerSignatory|| []).length ? res.customerSignatory[0].realtyConsultant : null})
97
+        setQianYueData({ ...QianYueData, ...customerSignatory, realtyConsultant: (res.customerSignatory || []).length ? res.customerSignatory[0].realtyConsultant : null })
98
+
79 99
         HouseTypeList.map((item) => {
80
-          if(item.apartmentId === res.customerSignatory[0].houseType) {
100
+          if (item.apartmentId === res.customerSignatory[0].houseType) {
81 101
             setCurrentRoomTypeId(item.apartmentId)
82 102
           }
83 103
         })
84 104
         setSuccessDate(res.customerSignatory[0].successDate.substring(0, 10))
85 105
       }
86
-      const ConsultantId = CurrentStatusId === 3 ? res.customerPreparatory?.realtyConsultant : (res.customerSignatory|| []).length ? res.customerSignatory[0].realtyConsultant : null
106
+      const ConsultantId = CurrentStatusId === 3 ? res.customerPreparatory?.realtyConsultant : (res.customerSignatory || []).length ? res.customerSignatory[0].realtyConsultant : null
87 107
       console.log(`ConsultantId is`, ConsultantId)
88 108
       ConsultantList.map((item) => {
89
-        if(item.id === ConsultantId) {
109
+        if (item.id === ConsultantId) {
90 110
           setCurrnetConsultant(item)
91 111
         }
92 112
       })
93 113
     })
94
-  }, [ConsultantList, HouseTypeList])
114
+  }, [ConsultantList, HouseTypeList, CurrentStatusId])
95 115
 
96 116
   useEffect(() => {
97 117
     if (CurrentStatusId - 0 !== 3 && buildingId) {
@@ -102,7 +122,7 @@ export default withLayout((props) => {
102 122
   }, [CurrentStatusId, buildingId])
103 123
 
104 124
   useEffect(() => {
105
-    console.log(FormData)
125
+    console.log('FormData', FormData)
106 126
   }, [FormData])
107 127
 
108 128
   const CutStatus = (item) => {
@@ -110,8 +130,10 @@ export default withLayout((props) => {
110 130
       setCurrentStatusId(item.id)
111 131
       if (item.id - 0 === 3) {
112 132
         setFormData({ ...RenChouData })
133
+
113 134
       } else if (item.id - 0 === 4) {
114 135
         setFormData({ ...QianYueData })
136
+
115 137
       } else if (item.id - 0 === 5) {
116 138
         setFormData({ ...QianYueData })
117 139
       }
@@ -205,6 +227,7 @@ export default withLayout((props) => {
205 227
     setSuccessDate(e.detail.value)
206 228
   }
207 229
 
230
+
208 231
   return (
209 232
     <view className='Page changeVisit'>
210 233
 
@@ -233,7 +256,7 @@ export default withLayout((props) => {
233 256
           <text className='required'>客户姓名</text>
234 257
           <view className='FormLine flex-h'>
235 258
             <view className='flex-item'>
236
-              <Input placeholder='请输入姓名' disabled={CurrentStatusId === 5} value={FormData.name} onInput={InputChange.bind(this, 'name')}></Input>
259
+              <Input placeholder='请输入姓名' disabled={CurrentStatusId === 5} value={agentsInfo.name} onInput={InputChange.bind(this, 'name')}></Input>
237 260
             </view>
238 261
           </view>
239 262
 
@@ -241,7 +264,7 @@ export default withLayout((props) => {
241 264
           <text>归属渠道</text>
242 265
           <view className='FormLine flex-h'>
243 266
             <view className='flex-item'>
244
-              <Input placeholder='请输入渠道' disabled value={type === 'customer' ? '-' : ''}></Input>
267
+              <Input placeholder='请输入渠道' disabled value={agentsInfo.channelName}></Input>
245 268
             </view>
246 269
           </view>
247 270