李志伟 3 years ago
parent
commit
96dad834da

+ 53
- 32
src/hotel/components/HouseManage/houseManage.jsx View File

1
 import Taro, { useDidShow } from '@tarojs/taro'
1
 import Taro, { useDidShow } from '@tarojs/taro'
2
-import { View, Image} from '@tarojs/components';
2
+import { View, Image } from '@tarojs/components';
3
 import see from '@/assets/icons/landlord/lookPerson.png'
3
 import see from '@/assets/icons/landlord/lookPerson.png'
4
 import share from '@/assets/icons/landlord/shareLink.png'
4
 import share from '@/assets/icons/landlord/shareLink.png'
5
 import del from '@/assets/icons/landlord/delete.png'
5
 import del from '@/assets/icons/landlord/delete.png'
9
 import { getRoomList, saveRoom, deleteRoom } from '@/services/landlord'
9
 import { getRoomList, saveRoom, deleteRoom } from '@/services/landlord'
10
 import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
10
 import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
11
 import ToggleRole from '@/components/toggleRole/ToggleRole'
11
 import ToggleRole from '@/components/toggleRole/ToggleRole'
12
+import SpinBox from "@/components/Spin/SpinBox";
13
+import NoData from '@/components/NoData'
12
 import List from '@/components/List';
14
 import List from '@/components/List';
13
 import Picker from '@/components/Picker'
15
 import Picker from '@/components/Picker'
14
 import SearchBar from '@/components/SearchBar'
16
 import SearchBar from '@/components/SearchBar'
21
   const { hotel, hotelList, onHotelChange } = props
23
   const { hotel, hotelList, onHotelChange } = props
22
   const [detail, setDetail] = useState([])
24
   const [detail, setDetail] = useState([])
23
 
25
 
24
-  const fetchAPI = useMemo(() => hotel.hotelId ? () => getRoomList({ hotelId: hotel.hotelId }) : undefined, [hotel?.hotelId])
25
-  const queryParams = useMemo(() => ({}), [])
26
+  // const fetchAPI = useMemo(() => hotel.hotelId ? () => getRoomList({ hotelId: hotel.hotelId }) : undefined, [hotel?.hotelId])
27
+  // const queryParams = useMemo(() => ({}), [])
28
+  const [queryParams, setQueryParams] = useState({ hotelId: hotel.hotelId, pageNum: 1, pageSize: 10})
29
+
30
+  const [loading, setLoading] = useState(false)
26
 
31
 
27
   const shareDataRef = useRef()
32
   const shareDataRef = useRef()
28
 
33
 
128
     }
133
     }
129
   }
134
   }
130
   const handelCopy = (e, val) => {
135
   const handelCopy = (e, val) => {
136
+    setLoading(true)
131
     //阻止冒泡不允许执行父元素的点击事件
137
     //阻止冒泡不允许执行父元素的点击事件
132
     e.stopPropagation()
138
     e.stopPropagation()
133
-    saveRoom({ ...val, roomId: null, roomName: val.roomName + '复制' }).then(() => {
139
+    saveRoom({ ...val, roomId: null, roomName: val.roomName + '复制', createDate: null }).then((res) => {
140
+      // setDetail(...detail,res)
141
+      // detail.push(res)
134
       getRoomList({ hotelId: hotel.hotelId }).then((res) => {
142
       getRoomList({ hotelId: hotel.hotelId }).then((res) => {
135
         setDetail(res.records || [])
143
         setDetail(res.records || [])
136
       })
144
       })
145
+      setLoading(false)
137
     })
146
     })
138
   }
147
   }
139
   const [showCutover3, setShowCutover3] = useState(false)
148
   const [showCutover3, setShowCutover3] = useState(false)
144
     setShowCutover3(false)
153
     setShowCutover3(false)
145
   }
154
   }
146
   return (
155
   return (
147
-    <view>
148
-      <view style={{ padding: '0 30rpx', height: '100%' }}>
156
+    <View style={{ display: 'flex', flexDirection: 'column', overflow: 'hidden', boxSizing: 'border-box',height:'100%' }}>
149
       <ToggleRole role='hotel' showCutover={showCutover3} maskClosable={showCutover3} onClose={onClose3} />
157
       <ToggleRole role='hotel' showCutover={showCutover3} maskClosable={showCutover3} onClose={onClose3} />
150
-
151
-        <View>
158
+      <View style={{ flex: 'none' }}>
152
         <view className='storeName'>店名:<Picker style={{ display: 'inline-block' }} placeholder="请选择民宿" value={hotel?.hotelId} kv={['hotelName', 'hotelId']} dicts={hotelList} onChange={handleHotelChange} /></view>
159
         <view className='storeName'>店名:<Picker style={{ display: 'inline-block' }} placeholder="请选择民宿" value={hotel?.hotelId} kv={['hotelName', 'hotelId']} dicts={hotelList} onChange={handleHotelChange} /></view>
153
         <view onClick={ShowMoldeOn3} className='User-info-cutover'>
160
         <view onClick={ShowMoldeOn3} className='User-info-cutover'>
154
-            <image className='User-info-cutover-image' src={cutoverUser} />
155
-          </view>
156
-        </View>
161
+          <image className='User-info-cutover-image' src={cutoverUser} />
162
+        </view>
163
+      </View>
164
+      <View style={{ flex: 'none' }}>
157
         <SearchBar placeholder='请输入房源名搜索' onBlur={onSearch} />
165
         <SearchBar placeholder='请输入房源名搜索' onBlur={onSearch} />
158
-        <ShareRoom showCutover={showCutover} onClose={onClose} room={room} onFinish={handleFinish} />
159
-        <ShareCard showCutover={showCard} onClose={onClose2} />
166
+      </View>
167
+      <ShareRoom showCutover={showCutover} onClose={onClose} room={room} onFinish={handleFinish} />
168
+      <ShareCard showCutover={showCard} onClose={onClose2} />
169
+      <SpinBox loading={loading} style={{ padding: '0 30rpx', flex: 'auto' }}>
160
         <List
170
         <List
161
-          style={{ height: 'calc(100vh - 244px)' }}
162
-          request={fetchAPI}
171
+          // style={{ height: 'calc(100vh - 280px)' }}
172
+          // request={fetchAPI}
173
+          // params={queryParams}
174
+          // onDataChange={setDetail}
175
+          // noData="暂无房源信息"
176
+
177
+          style={{ height: '100%' }}
178
+          // style={{ height: 'calc(100% - 280px)' }}
179
+          request={getRoomList}
163
           params={queryParams}
180
           params={queryParams}
164
           onDataChange={setDetail}
181
           onDataChange={setDetail}
165
-          noData="暂无房源信息"
166
         >
182
         >
167
-          <view className='waterfall'>
168
-            {
169
-              detail.map((item, index) =>
170
-                <view className='houseCard' key={index}>
171
-                  <View className='houseName' onClick={() => handelDetail(item)}>{item.roomName || ''}<Image src={copyRoom} onClick={(e) => handelCopy(e, item)} /></View>
172
-                  <view className='operation'>
173
-                    <view onClick={() => handelOrder(item)}><image src={see} />查看入住人</view>
174
-                    <view onClick={() => ShowMoldeOn(item)}><image src={share} />分享链接</view>
175
-                    <view onClick={() => handelDelete(item)}><image src={del} />删除房源</view>
176
-                  </view>
177
-                </view>)
178
-            }
179
-          </view>
183
+          {
184
+            detail.length == 0 ?
185
+              <NoData /> :
186
+              <view className='waterfall'>
187
+                {
188
+
189
+                  detail.map((item, index) =>
190
+                    <view className='houseCard' key={index}>
191
+                      <View className='houseName' onClick={() => handelDetail(item)}>{item.roomName || ''}<Image src={copyRoom} onClick={(e) => handelCopy(e, item)} /></View>
192
+                      <view className='operation'>
193
+                        <view onClick={() => handelOrder(item)}><image src={see} />查看入住人</view>
194
+                        <view onClick={() => ShowMoldeOn(item)}><image src={share} />分享链接</view>
195
+                        <view onClick={() => handelDelete(item)}><image src={del} />删除房源</view>
196
+                      </view>
197
+                    </view>)
198
+                }
199
+              </view>
200
+          }
180
         </List>
201
         </List>
181
-      </view>
182
-      <view className='addHouse' onClick={handelClick}>
202
+      </SpinBox>
203
+      <view className='addHouse' style={{ flex: 'none' }} onClick={handelClick}>
183
         <image className='addImg' src={addImg} />添加房源
204
         <image className='addImg' src={addImg} />添加房源
184
       </view>
205
       </view>
185
 
206
 
186
-    </view>
207
+    </View>
187
   )
208
   )
188
 })
209
 })

+ 1
- 4
src/hotel/components/HouseManage/houseManage.less View File

51
   }
51
   }
52
 }
52
 }
53
 .addHouse{
53
 .addHouse{
54
-  width: calc(100% - 60px);
55
-  margin: 0 30px;
54
+  margin: 0 30px 50px;
56
   height: 88px;
55
   height: 88px;
57
   background: #274291;
56
   background: #274291;
58
   border-radius: 12px;
57
   border-radius: 12px;
60
   color: #FFFFFF;
59
   color: #FFFFFF;
61
   text-align: center;
60
   text-align: center;
62
   line-height: 88px;
61
   line-height: 88px;
63
-  position: absolute;
64
   letter-spacing: 5px;
62
   letter-spacing: 5px;
65
-  bottom: 18px;
66
   image{
63
   image{
67
     width: 32px;
64
     width: 32px;
68
     height: 32px;
65
     height: 32px;

+ 14
- 12
src/hotel/pages/landlord/addRoom/addRoom.jsx View File

1
 import withLayout from '@/layouts'
1
 import withLayout from '@/layouts'
2
 import Taro from '@tarojs/taro'
2
 import Taro from '@tarojs/taro'
3
 import CustomNav from '@/components/CustomNav'
3
 import CustomNav from '@/components/CustomNav'
4
-import { View, Input, Button, Label, Textarea, Text,Image } from '@tarojs/components';
4
+import { View, Input, Button, Label, Textarea, Text, Image } from '@tarojs/components';
5
 import { useEffect, useState } from "react"
5
 import { useEffect, useState } from "react"
6
 import { saveRoom, getRoomDetail, updateRoom } from '@/services/landlord'
6
 import { saveRoom, getRoomDetail, updateRoom } from '@/services/landlord'
7
 import GPS from '@/assets/icons/GuideCheck/GPS.png'
7
 import GPS from '@/assets/icons/GuideCheck/GPS.png'
26
     wifiName: '',
26
     wifiName: '',
27
     wifiPassword: '',
27
     wifiPassword: '',
28
     weight: '',
28
     weight: '',
29
+    locName: '',
30
+    pkLocName: ''
29
   })
31
   })
30
   const [paddress, setpAddress] = useState()
32
   const [paddress, setpAddress] = useState()
31
   const [wifiName, setwifiName] = useState()
33
   const [wifiName, setwifiName] = useState()
32
   const onRoomMap = () => {
34
   const onRoomMap = () => {
33
     Taro.chooseLocation().then((res) => {
35
     Taro.chooseLocation().then((res) => {
34
-      setRoomModel({ ...roomModel, location: res.longitude + ',' + res.latitude })
35
-
36
+      setRoomModel({ ...roomModel, location: res.longitude + ',' + res.latitude,locName: res.name })
36
     })
37
     })
37
   }
38
   }
38
   const onParkMap = () => {
39
   const onParkMap = () => {
39
     Taro.chooseLocation().then((res) => {
40
     Taro.chooseLocation().then((res) => {
40
-      setRoomModel({ ...roomModel, parkingLocation: res.longitude + ',' + res.latitude })
41
-
41
+      setRoomModel({ ...roomModel, parkingLocation: res.longitude + ',' + res.latitude, pkLocName: res.name  })
42
     })
42
     })
43
   }
43
   }
44
   const sumbit = () => {
44
   const sumbit = () => {
190
             <mp-cells title='房屋位置'>
190
             <mp-cells title='房屋位置'>
191
               <mp-cell>
191
               <mp-cell>
192
                 <View className='roomloc'>
192
                 <View className='roomloc'>
193
-                <Input style={{ color: '#000', fontWeight: 'bold'}} onInput={(e) => setRoomModel({ ...roomModel, address: e.detail.value })} value={roomModel.address} placeholder='请输入房屋位置(必填)' />
194
-                <Label style={{display:'none' }} onClick={onRoomMap}>{isError(roomModel.location) ? '房间定位(必填)' : roomModel.location}</Label>
195
-                <Image className='location' src={GPS} onClick={onRoomMap} />
193
+                  <Label style={{ color: '#666', lineHeight: '30px' }} onClick={onRoomMap} >{roomModel.locName || '请选择定位'}</Label>
194
+                  <Textarea style={{height:'60px',width:'100%'}} onInput={(e) => setRoomModel({ ...roomModel, address: e.detail.value })} value={roomModel.address} placeholder='请输入房屋位置(必填)' />
195
+                  <Label style={{ display: 'none' }} >{isError(roomModel.location) ? '房间定位(必填)' : roomModel.location}</Label>
196
+                  <Image className='location' src={GPS} onClick={onRoomMap} />
196
                 </View>
197
                 </View>
197
               </mp-cell>
198
               </mp-cell>
198
             </mp-cells>
199
             </mp-cells>
200
               paddress != '' ?
201
               paddress != '' ?
201
                 <mp-cells title='停车场位置'>
202
                 <mp-cells title='停车场位置'>
202
                   <mp-cell>
203
                   <mp-cell>
203
-                  <View className='roomloc'>
204
-                    <Input onInput={(e) => setRoomModel({ ...roomModel, parkingAddress: e.detail.value })} value={roomModel.parkingAddress} placeholder='请输入停车场位置' />
205
-                    <Label style={{ color: '#666', lineHeight: '30px',display:'none' }} onClick={onParkMap}>{isError(roomModel.parkingLocation) ? '停车场定位' : roomModel.parkingLocation}</Label>
206
-                    <Image className='location' src={GPS} onClick={onParkMap} />
204
+                    <View className='roomloc'>
205
+                      <Label style={{ color: '#666', lineHeight: '30px' }} onClick={onParkMap}>{roomModel.pkLocName || '请选择定位'}</Label>
206
+                      <Textarea  style={{height:'60px',width:'100%'}} onInput={(e) => setRoomModel({ ...roomModel, parkingAddress: e.detail.value })} value={roomModel.parkingAddress} placeholder='请输入停车场位置' />
207
+                      <Label style={{display: 'none' }}>{isError(roomModel.parkingLocation) ? '停车场定位' : roomModel.parkingLocation}</Label>
208
+                      <Image className='location' src={GPS} onClick={onParkMap} />
207
                     </View>
209
                     </View>
208
                   </mp-cell>
210
                   </mp-cell>
209
                 </mp-cells> : null
211
                 </mp-cells> : null

+ 0
- 2
src/hotel/pages/landlord/landlord.jsx View File

68
         {currentTab === 1 && <Income hotel={hotel} account={account} />}
68
         {currentTab === 1 && <Income hotel={hotel} account={account} />}
69
         {hotel?.hotelId ? currentTab === 0 && <HouseManage hotelList={hotelList} hotel={hotel} onHotelChange={handleHotelChange} ref={houseRef} disabled={!hotel.hotelId} /> : <NoData />}
69
         {hotel?.hotelId ? currentTab === 0 && <HouseManage hotelList={hotelList} hotel={hotel} onHotelChange={handleHotelChange} ref={houseRef} disabled={!hotel.hotelId} /> : <NoData />}
70
       </view>
70
       </view>
71
-      <view className='index-tabbar'>
72
-      </view>
73
       <view className='index-tabbar'>
71
       <view className='index-tabbar'>
74
         <mp-tabbar extClass='custom-tabbar' current={currentTab} list={tabList} onChange={handleTabChange}></mp-tabbar>
72
         <mp-tabbar extClass='custom-tabbar' current={currentTab} list={tabList} onChange={handleTabChange}></mp-tabbar>
75
       </view>
73
       </view>

+ 6
- 6
src/pages/MineUserAll/ContactMe/index.jsx View File

29
           duration: 1500
29
           duration: 1500
30
         }).then(
30
         }).then(
31
           setTimeout(() => {
31
           setTimeout(() => {
32
-          Taro.navigateBack({
33
-            delta: 1
34
-          })
35
-          setLoading(false)
36
-        },1500)
37
-          )
32
+            Taro.navigateBack({
33
+              delta: 1
34
+            })
35
+            setLoading(false)
36
+          }, 1500)
37
+        )
38
       })
38
       })
39
     }
39
     }
40
     else {
40
     else {

+ 0
- 12
src/pages/index/tabs/Guide.jsx View File

87
         setAllextNum(res.total)
87
         setAllextNum(res.total)
88
         setNewextNum(res.records.length)
88
         setNewextNum(res.records.length)
89
       })
89
       })
90
-      // getRecommendList({ location: RoomLocation }).then((res) => {
91
-      //   setPackage(res || [])
92
-      // })
93
       getRecommendList({ location: location }).then((res) => {
90
       getRecommendList({ location: location }).then((res) => {
94
         setPackage(res || [])
91
         setPackage(res || [])
95
       })
92
       })
96
-
97
     } else {
93
     } else {
98
       getRecommendList({ location: location }).then((res) => {
94
       getRecommendList({ location: location }).then((res) => {
99
         setPackage(res || [])
95
         setPackage(res || [])
100
       })
96
       })
101
-
102
       return
97
       return
103
     }
98
     }
104
-    // extend?.records === []
105
-
106
-
107
     if (taRoomContent?.wifiPassword === "") {
99
     if (taRoomContent?.wifiPassword === "") {
108
       setWifiButtonStyle('none')
100
       setWifiButtonStyle('none')
109
     }
101
     }
110
     if (taRoomContent?.parkingAddress === "") {
102
     if (taRoomContent?.parkingAddress === "") {
111
       setParkingButtonStyle('none')
103
       setParkingButtonStyle('none')
112
     }
104
     }
113
-
114
-
115
   }, [roomId, RoomLocation, taRoomContent?.wifiPassword, taRoomContent?.parkingAddress, location])
105
   }, [roomId, RoomLocation, taRoomContent?.wifiPassword, taRoomContent?.parkingAddress, location])
116
 
106
 
117
 
107
 
158
     <scroll-view scrollY style='height:100%;'  >
148
     <scroll-view scrollY style='height:100%;'  >
159
 
149
 
160
       <view className='Guide-Home-box'>
150
       <view className='Guide-Home-box'>
161
-
162
-
163
         {
151
         {
164
           ifroomId === 'havenot' && (
152
           ifroomId === 'havenot' && (
165
             <view className='Guide-image-text-box'>
153
             <view className='Guide-image-text-box'>