Procházet zdrojové kódy

Merge branch 'main' of http://git.ycjcjy.com/marketing/miniapp into main

Your Name před 3 roky
rodič
revize
6ae1d3c00a

+ 18
- 6
src/pages/mine/addCustomer/components/BuildingPicker.jsx Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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
     }
@@ -103,6 +109,10 @@ export default withLayout((props) => {
103 109
     setFormData(Data)
104 110
   }
105 111
 
112
+  const BuildingChange = (e) => {
113
+    setBuildingId(e)
114
+  }
115
+
106 116
   return (
107 117
     <view className='Page addCustomer'>
108 118
 
@@ -137,14 +147,14 @@ export default withLayout((props) => {
137 147
               <text>意向楼盘</text>
138 148
               <view className='FormLine flex-h'>
139 149
                 <view className='flex-item'>
140
-                  <BuildingPicker onChange={setBuildingId} value={buildingId} />
150
+                  <BuildingPicker change={BuildingChange} value={buildingId} type={type} />
141 151
                 </view>
142 152
               </view>
143 153
 
144 154
               <text>内场接待(选填)</text>
145 155
               <view className='FormLine flex-h'>
146 156
                 <view className='flex-item'>
147
-                  <ConsultantPicker buildingId={buildingId} onChange={setCardId} value={CardId} />
157
+                  <ConsultantPicker onChange={setCardId} value={CardId} buildingId={buildingId} />
148 158
                 </view>
149 159
                 <Image mode='heightFix' src={defaultSpecialImage}></Image>
150 160
                 <text>选择</text>