Browse Source

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

Your Name 3 years ago
parent
commit
6ae1d3c00a

+ 18
- 6
src/pages/mine/addCustomer/components/BuildingPicker.jsx View File

1
-import React, { useEffect, useState } from 'react'
1
+import { useEffect, useState } from 'react'
2
 import Picker from '@/components/Picker'
2
 import Picker from '@/components/Picker'
3
 import { fetch } from '@/utils/request'
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
 export default (props) => {
6
 export default (props) => {
7
+
8
+  const { type = '', change = () => {} } = props
7
   const [dicts, setDicts] = useState([])
9
   const [dicts, setDicts] = useState([])
8
 
10
 
9
   useEffect(() => {
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
   return (
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 View File

39
 
39
 
40
   const postSubmit = getSubmitor(person)
40
   const postSubmit = getSubmitor(person)
41
 
41
 
42
+  useEffect(() => {
43
+    if(buildingId) {
44
+
45
+    }
46
+  }, [buildingId])
47
+
42
   const preSubmit = (payload) => {
48
   const preSubmit = (payload) => {
43
     if (payload.name === '') {
49
     if (payload.name === '') {
44
       Taro.showToast({ title: '请填写客户姓名', icon: 'none' })
50
       Taro.showToast({ title: '请填写客户姓名', icon: 'none' })
56
       Taro.showToast({ title: '请填写正确的客户电话', icon: 'none' })
62
       Taro.showToast({ title: '请填写正确的客户电话', icon: 'none' })
57
       return false
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
       Taro.showToast({ title: '请选择客户的意向楼盘', icon: 'none' })
66
       Taro.showToast({ title: '请选择客户的意向楼盘', icon: 'none' })
61
       return false
67
       return false
62
     }
68
     }
103
     setFormData(Data)
109
     setFormData(Data)
104
   }
110
   }
105
 
111
 
112
+  const BuildingChange = (e) => {
113
+    setBuildingId(e)
114
+  }
115
+
106
   return (
116
   return (
107
     <view className='Page addCustomer'>
117
     <view className='Page addCustomer'>
108
 
118
 
137
               <text>意向楼盘</text>
147
               <text>意向楼盘</text>
138
               <view className='FormLine flex-h'>
148
               <view className='FormLine flex-h'>
139
                 <view className='flex-item'>
149
                 <view className='flex-item'>
140
-                  <BuildingPicker onChange={setBuildingId} value={buildingId} />
150
+                  <BuildingPicker change={BuildingChange} value={buildingId} type={type} />
141
                 </view>
151
                 </view>
142
               </view>
152
               </view>
143
 
153
 
144
               <text>内场接待(选填)</text>
154
               <text>内场接待(选填)</text>
145
               <view className='FormLine flex-h'>
155
               <view className='FormLine flex-h'>
146
                 <view className='flex-item'>
156
                 <view className='flex-item'>
147
-                  <ConsultantPicker buildingId={buildingId} onChange={setCardId} value={CardId} />
157
+                  <ConsultantPicker onChange={setCardId} value={CardId} buildingId={buildingId} />
148
                 </view>
158
                 </view>
149
                 <Image mode='heightFix' src={defaultSpecialImage}></Image>
159
                 <Image mode='heightFix' src={defaultSpecialImage}></Image>
150
                 <text>选择</text>
160
                 <text>选择</text>