瀏覽代碼

静态页面

1002884655 3 年之前
父節點
當前提交
7d4a5671f9
共有 2 個文件被更改,包括 31 次插入9 次删除
  1. 18
    6
      src/pages/mine/addCustomer/components/BuildingPicker.jsx
  2. 13
    3
      src/pages/mine/addCustomer/index.jsx

+ 18
- 6
src/pages/mine/addCustomer/components/BuildingPicker.jsx 查看文件

@@ -1,18 +1,30 @@
1
-import React, { useEffect, useState } from 'react'
1
+import { useEffect, useState } from 'react'
2 2
 import Picker from '@/components/Picker'
3 3
 import { fetch } from '@/utils/request'
4
-import { API_GET_AGENT_BUILDINGS } from '@/constants/api'
4
+import { API_GET_AGENT_BUILDINGS, API_ITEMS_LIST } from '@/constants/api'
5 5
 
6 6
 export default (props) => {
7
+
8
+  const { type = '', change = () => {} } = props
7 9
   const [dicts, setDicts] = useState([])
8 10
 
9 11
   useEffect(() => {
10
-    fetch({ url: API_GET_AGENT_BUILDINGS }).then((res) => {
11
-      setDicts(res || [])
12
-    })
12
+    if (type === 'customer') {
13
+      fetch({ url: API_ITEMS_LIST, payload: { pageNumber: 1, pageSize: 1000 } }).then((res) => {
14
+        setDicts(res.records || [])
15
+      })
16
+    } else {
17
+      fetch({ url: API_GET_AGENT_BUILDINGS }).then((res) => {
18
+        setDicts(res || [])
19
+      })
20
+    }
13 21
   }, [])
14 22
 
23
+  const BuildingChange = (value) => {
24
+    change(value)
25
+  }
26
+
15 27
   return (
16
-    <Picker kv={['buildingName', 'buildingId']} dicts={dicts} {...props} />
28
+    <Picker kv={['buildingName', 'buildingId']} dicts={dicts} {...props} onChange={BuildingChange} />
17 29
   )
18 30
 }

+ 13
- 3
src/pages/mine/addCustomer/index.jsx 查看文件

@@ -39,6 +39,12 @@ export default withLayout((props) => {
39 39
 
40 40
   const postSubmit = getSubmitor(person)
41 41
 
42
+  useEffect(() => {
43
+    if(buildingId) {
44
+
45
+    }
46
+  }, [buildingId])
47
+
42 48
   const preSubmit = (payload) => {
43 49
     if (payload.name === '') {
44 50
       Taro.showToast({ title: '请填写客户姓名', icon: 'none' })
@@ -56,7 +62,7 @@ export default withLayout((props) => {
56 62
       Taro.showToast({ title: '请填写正确的客户电话', icon: 'none' })
57 63
       return false
58 64
     }
59
-    if (buildingId === null && personType !== ROLE_CODE.CONSULTANT) {
65
+    if (buildingId === null && personType !== ROLE_CODE.CONSULTANT && personType !== ROLE_CODE.CUSTOMER) {
60 66
       Taro.showToast({ title: '请选择客户的意向楼盘', icon: 'none' })
61 67
       return false
62 68
     }
@@ -99,6 +105,10 @@ export default withLayout((props) => {
99 105
     setFormData(Data)
100 106
   }
101 107
 
108
+  const BuildingChange = (e) => {
109
+    setBuildingId(e)
110
+  }
111
+
102 112
   return (
103 113
     <view className='Page addCustomer'>
104 114
 
@@ -133,14 +143,14 @@ export default withLayout((props) => {
133 143
               <text>意向楼盘</text>
134 144
               <view className='FormLine flex-h'>
135 145
                 <view className='flex-item'>
136
-                  <BuildingPicker onChange={setBuildingId} value={buildingId} />
146
+                  <BuildingPicker change={BuildingChange} value={buildingId} type={type} />
137 147
                 </view>
138 148
               </view>
139 149
 
140 150
               <text>内场接待(选填)</text>
141 151
               <view className='FormLine flex-h'>
142 152
                 <view className='flex-item'>
143
-                  <ConsultantPicker onChange={setCardId} value={CardId} />
153
+                  <ConsultantPicker onChange={setCardId} value={CardId} buildingId={buildingId} />
144 154
                 </view>
145 155
                 <Image mode='heightFix' src={defaultSpecialImage}></Image>
146 156
                 <text>选择</text>