1002884655 hace 3 años
padre
commit
382947dbc4

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

@@ -124,6 +124,8 @@ export const API_CHANNEL_REPORT = resolvePath('channel/report')
124 124
 // 驻场
125 125
 export const API_MANAGE_CUSTOMER_LIST = resolvePath('marking/customers')
126 126
 export const API_TOBE_MANAGER = resolvePath('marketing')
127
+export const API_MY_BUILDINGIDS = resolvePath('building/mine')
128
+
127 129
 
128 130
 // report
129 131
 export const API_REPORT_CUETOMER = resolvePath('customer/manualReport ')

+ 2
- 2
src/pages/mine/components/ResidentListItem/index.jsx Ver fichero

@@ -17,13 +17,13 @@ export default function ResidentListItem (props) {
17 17
       <view className='flex-h'>
18 18
         <text>客户姓名:</text>
19 19
         <view className='flex-item'>
20
-          <text></text>
20
+          <text>{data.name}</text>
21 21
         </view>
22 22
       </view>
23 23
       <view className='flex-h'>
24 24
         <text>手机号码:</text>
25 25
         <view className='flex-item'>
26
-          <text>136****9434</text>
26
+          <text>{data.phone}</text>
27 27
         </view>
28 28
         <Image mode='heightFix' src={require('@/assets/mine-icon27.png')}></Image>
29 29
         <text className='Type'>结佣</text>

+ 44
- 9
src/pages/mine/residentManager/index.jsx Ver fichero

@@ -4,7 +4,7 @@ import { ScrollView, Input } from '@tarojs/components'
4 4
 import '@/assets/css/iconfont.css'
5 5
 import { useSelector } from 'react-redux'
6 6
 import { fetch } from '@/utils/request'
7
-import { API_MANAGE_CUSTOMER_LIST } from '@/constants/api'
7
+import { API_MANAGE_CUSTOMER_LIST, API_MY_BUILDINGIDS } from '@/constants/api'
8 8
 import './index.scss'
9 9
 import ResidentListItem from '../components/ResidentListItem/index'
10 10
 
@@ -27,11 +27,14 @@ export default withLayout(() => {
27 27
   // }
28 28
 
29 29
   const user = useSelector(state => state.user)
30
+  const [BuildingIds, setBuildingIds] = useState([])
30 31
   const [PageList, setPageList] = useState([])
31 32
   const [IsPull, setPull] = useState(false)
32 33
   const [PersonId, setPersonId] = useState(null)
33 34
   const [pageNumber, setPageNumber] = useState(1)
34 35
   const [HasNextPage, setHasNextPage] = useState(true)
36
+  const [CurrentBuildingId, setCurrentBuildingId] = useState(null)
37
+  const [CurrentBuildingName, setCurrentBuildingName] = useState(null)
35 38
   const [FilterData, setFilterData] = useState({})
36 39
 
37 40
   useEffect(() => {
@@ -42,20 +45,43 @@ export default withLayout(() => {
42 45
 
43 46
   useEffect(() => {
44 47
     if (PersonId) {
45
-      GetPageList()
48
+      GetMyBuildingIds()
46 49
     }
47
-  }, [pageNumber, PersonId])
50
+  }, [PersonId])
48 51
 
49 52
   useEffect(() => {
50
-    if(FilterData.keywords) {
51
-      if(pageNumber === 1) {
53
+    if (FilterData.keywords) {
54
+      if (pageNumber === 1) {
52 55
         GetPageList()
53 56
       } else {
54
-        setPageNumber(2)
57
+        setPageNumber(1)
55 58
       }
56 59
     }
57 60
   }, [FilterData])
58 61
 
62
+  useEffect(() => {
63
+    if (BuildingIds.length) {
64
+      setCurrentBuildingId(BuildingIds[0].buildingId)
65
+      setCurrentBuildingName(BuildingIds[0].name)
66
+    }
67
+  }, [BuildingIds])
68
+
69
+  useEffect(() => {
70
+    if (CurrentBuildingId) {
71
+      if (pageNumber === 1) {
72
+        GetPageList()
73
+      } else {
74
+        setPageNumber(1)
75
+      }
76
+    }
77
+  }, [CurrentBuildingId])
78
+
79
+  const GetMyBuildingIds = () => {
80
+    fetch({ url: API_MY_BUILDINGIDS, method: 'get' }).then((res) => {
81
+      setBuildingIds(res || [])
82
+    })
83
+  }
84
+
59 85
   // useEffect(() => {
60 86
   //   if(CurrentFilterMenuId) {
61 87
   //     if(pageNumber === 1) {
@@ -72,7 +98,7 @@ export default withLayout(() => {
72 98
 
73 99
   const GetPageList = () => {
74 100
     setHasNextPage(false)
75
-    fetch({ url: API_MANAGE_CUSTOMER_LIST, method: 'get', payload: { pageNumber, pageSize: 10, ...FilterData, buildingId: user.userInfo.person.buildingId } }).then((res) => {
101
+    fetch({ url: API_MANAGE_CUSTOMER_LIST, method: 'get', payload: { pageNumber, pageSize: 10, ...FilterData, buildingId: CurrentBuildingId } }).then((res) => {
76 102
       setPageList(pageNumber === 1 ? res.records || [] : PageList.concat(res.records || []))
77 103
       setHasNextPage(res.current < res.pages)
78 104
       setPull(false)
@@ -95,6 +121,11 @@ export default withLayout(() => {
95 121
     }
96 122
   }, [IsPull])
97 123
 
124
+  const PickerChange = (e) => {
125
+    setCurrentBuildingId(BuildingIds[e.detail.value - 0].buildingId)
126
+    setCurrentBuildingName(BuildingIds[e.detail.value - 0].name)
127
+  }
128
+
98 129
   const SearchConfirm = (e) => {
99 130
     setFilterData({ ...FilterData, keywords: e.detail.value })
100 131
   }
@@ -102,11 +133,15 @@ export default withLayout(() => {
102 133
   return (
103 134
     <view className='Page residentManager flex-v'>
104 135
 
105
-      <view className='Search'>
106
-        <view>
136
+      <view className='Search flex-h'>
137
+        <view className='flex-item'>
107 138
           <text className='iconfont icon-sousuo'></text>
108 139
           <Input confirm-type='search' placeholder='请输入关键字搜索' onConfirm={SearchConfirm} onscrolltolower={PageLoadMore}></Input>
109 140
         </view>
141
+        <text>{CurrentBuildingName}</text>
142
+        <picker value={0} range-key='name' onChange={PickerChange} range={BuildingIds}>
143
+          <view class='picker'>更换</view>
144
+        </picker>
110 145
       </view>
111 146
 
112 147
       <view className='flex-item'>

+ 17
- 1
src/pages/mine/residentManager/index.scss Ver fichero

@@ -3,10 +3,11 @@
3 3
   position: relative;
4 4
   overflow: hidden;
5 5
   >.Search {
6
-    padding: 0 50px 20px;
6
+    padding: 0 30px 20px;
7 7
     position: relative;
8 8
     overflow: hidden;
9 9
     margin-top: 20px;
10
+    align-items: center;
10 11
     >view {
11 12
       position: relative;
12 13
       overflow: hidden;
@@ -32,6 +33,21 @@
32 33
         text-align: left;
33 34
       }
34 35
     }
36
+    >text {
37
+      font-size: 28px;
38
+      line-height: 40px;
39
+      max-width: 160px;
40
+      white-space: nowrap;
41
+      overflow: hidden;
42
+      text-overflow: ellipsis;
43
+      margin-left: 20px;
44
+      margin-right: 10px;
45
+    }
46
+    .picker {
47
+      font-size: 28px;
48
+      line-height: 40px;
49
+      color: #193C83;
50
+    }
35 51
   }
36 52
   > .flex-item {
37 53
     position: relative;

+ 2
- 2
src/pages/mine/tabData.js Ver fichero

@@ -2,7 +2,6 @@ const MineMenuList = {
2 2
   User: [ // 普通用户
3 3
     [
4 4
       { name: '推荐客户', icon: require('../../assets/mine-icon8.png'), router: '/pages/mine/addCustomer/index?type=customer' },
5
-      { name: '成为驻场管理', icon: require('../../assets/mine-icon8.png'), router: '/pages/mine/toBeManager/index' }
6 5
     ],
7 6
     [
8 7
       { name: '我的分享', icon: require('../../assets/mine-icon9.png'), router: '/pages/mine/myShare/index' },
@@ -15,6 +14,7 @@ const MineMenuList = {
15 14
       { name: '意见反馈', icon: require('../../assets/mine-icon16.png'), router: '/pages/mine/feedBack/index' }
16 15
     ],
17 16
     [
17
+      { name: '成为驻场管理', icon: require('../../assets/mine-icon8.png'), router: '/pages/mine/toBeManager/index' },
18 18
       { name: '成为置业顾问', icon: require('../../assets/mine-icon4.png'), router: 'propertyConsultant' },
19 19
       { name: '成为专业经纪人', icon: require('../../assets/mine-icon2.png'), router: null }
20 20
     ]
@@ -60,7 +60,7 @@ const MineMenuList = {
60 60
   ],
61 61
   Resident: [ // 驻场管理
62 62
     [
63
-      // { name: '推荐客户', icon: require('../../assets/mine-icon8.png'), router: '/pages/mine/addCustomer/index?type=manager' },
63
+      { name: '绑定楼盘码', icon: require('../../assets/mine-icon8.png'), router: '/pages/mine/toBeManager/index' },
64 64
       { name: '驻场管理', icon: require('../../assets/mine-icon17.png'), router: '/pages/mine/residentManager/index' }
65 65
     ],
66 66
     [

+ 1
- 3
src/pages/mine/toBeManager/index.jsx Ver fichero

@@ -4,7 +4,6 @@ import withLayout from '@/layout'
4 4
 import { ScrollView, Input } from '@tarojs/components'
5 5
 import { fetch } from '@/utils/request'
6 6
 import { API_TOBE_MANAGER } from '@/constants/api'
7
-import login from '@/utils/login'
8 7
 import './index.scss'
9 8
 
10 9
 export default withLayout(() => {
@@ -15,10 +14,9 @@ export default withLayout(() => {
15 14
     if (Code !== '') {
16 15
       fetch({ url: API_TOBE_MANAGER, method: 'post', payload: { marketingCode: Code } }).then((res) => {
17 16
         Taro.showToast({
18
-          title: '提交成功',
17
+          title: '绑定成功',
19 18
           icon: 'none'
20 19
         })
21
-        login({ path: '', scene: '' })
22 20
       })
23 21
     } else {
24 22
       Taro.showToast({