Bläddra i källkod

封装意向楼盘

Baozhangchao 3 år sedan
förälder
incheckning
32705ec120
1 ändrade filer med 24 tillägg och 5 borttagningar
  1. 24
    5
      src/pages/mine/addCustomer/index.jsx

+ 24
- 5
src/pages/mine/addCustomer/index.jsx Visa fil

@@ -1,9 +1,11 @@
1 1
 import { useState, useEffect } from 'react'
2 2
 import withLayout from '@/layout'
3
-import { ScrollView, Input, Image, Block } from '@tarojs/components'
3
+import { ScrollView, Input, Image, Block, View } from '@tarojs/components'
4 4
 import '@/assets/css/iconfont.css'
5 5
 import { fetch } from '@/utils/request'
6
-import { API_REPORT_CUETOMER, API_USER_ADD_CUSTOMER, API_CHANNEL_REPORT } from '@/constants/api'
6
+import BottomMoadl from '@/components/BottomMoadl/index'
7
+
8
+import { API_REPORT_CUETOMER, API_GET_AGENT_BUILDINGS, API_ITEMS_LIST, API_USER_ADD_CUSTOMER, API_CHANNEL_REPORT } from '@/constants/api'
7 9
 import { ROLE_CODE } from '@/constants/user'
8 10
 import Taro from '@tarojs/taro'
9 11
 import Picker from '@/components/Picker'
@@ -25,6 +27,9 @@ export default withLayout((props) => {
25 27
   const { personId, personType } = person
26 28
   const { buildingId: originBuiding } = router.params
27 29
 
30
+  const [showFrame, setShowFrame] = useState(false)
31
+  const [buidName, setBuidName] = useState('请选择意向楼盘')
32
+
28 33
   const [loading, setLoading] = useState(false)
29 34
   const [buildingId, setBuildingId] = useState(null)
30 35
   const [CardId, setCardId] = useState(null)
@@ -76,6 +81,12 @@ export default withLayout((props) => {
76 81
     return true
77 82
   }
78 83
 
84
+  const closeModal = (e) => {
85
+
86
+    setShowFrame(!showFrame)
87
+
88
+  }
89
+
79 90
   const onSubmit = () => {
80 91
     const payload = personType === ROLE_CODE.CONSULTANT ?
81 92
       {
@@ -127,10 +138,14 @@ export default withLayout((props) => {
127 138
 
128 139
   const BuildingChange = (e) => {
129 140
     setBuildingId(e)
141
+    console.log("🚀 ~ file: index父组件接收的 e", e, originBuiding)
142
+
143
+
130 144
   }
131 145
 
132 146
   return (
133 147
     <view className='Page addCustomer'>
148
+      <BottomMoadl setBuidName={setBuidName} closeModal={closeModal} onChange={BuildingChange} frameTitle='意向楼盘' value={buildingId} type={personType} flag={showFrame} />
134 149
 
135 150
       <ScrollView scroll-y refresher-enabled={false} refresher-background='#fff'>
136 151
         <view className='PageContent'>
@@ -160,7 +175,9 @@ export default withLayout((props) => {
160 175
           <text>意向楼盘</text>
161 176
           <view className='FormLine flex-h'>
162 177
             <view className='flex-item'>
163
-              <BuildingPicker change={BuildingChange} value={buildingId} type={personType} />
178
+              {/* <BuildingPicker change={BuildingChange} value={buildingId} type={personType} /> */}
179
+              <View onClick={closeModal} >{buidName}</View>
180
+
164 181
             </view>
165 182
           </view>
166 183
 
@@ -179,12 +196,14 @@ export default withLayout((props) => {
179 196
                 <text>备注</text>
180 197
                 <view className='FormLine flex-h'>
181 198
                   <view className='flex-item'>
182
-                    <Input placeholder='补充说明(选填)' data-type='remark' onInput={FormInput.bind(this)}></Input>
199
+                    {
200
+                      //解决事件穿透
201
+                      !showFrame && <Input placeholder='补充说明(选填)' dataType='remark' onInput={FormInput.bind(this)}></Input>
202
+                    }
183 203
                   </view>
184 204
                 </view>
185 205
               </Block> : ''
186 206
           }
187
-
188 207
           <view className='Btn'>
189 208
             <button loading={loading} onClick={onSubmit}>提交</button>
190 209
           </view>