Browse Source

封装意向楼盘

Baozhangchao 3 years ago
parent
commit
32705ec120
1 changed files with 24 additions and 5 deletions
  1. 24
    5
      src/pages/mine/addCustomer/index.jsx

+ 24
- 5
src/pages/mine/addCustomer/index.jsx View File

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