李志伟 3 anni fa
parent
commit
96dad834da

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

@@ -1,5 +1,5 @@
1 1
 import Taro, { useDidShow } from '@tarojs/taro'
2
-import { View, Image} from '@tarojs/components';
2
+import { View, Image } from '@tarojs/components';
3 3
 import see from '@/assets/icons/landlord/lookPerson.png'
4 4
 import share from '@/assets/icons/landlord/shareLink.png'
5 5
 import del from '@/assets/icons/landlord/delete.png'
@@ -9,6 +9,8 @@ import React, { useState, useEffect, useRef, useImperativeHandle, useMemo } from
9 9
 import { getRoomList, saveRoom, deleteRoom } from '@/services/landlord'
10 10
 import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
11 11
 import ToggleRole from '@/components/toggleRole/ToggleRole'
12
+import SpinBox from "@/components/Spin/SpinBox";
13
+import NoData from '@/components/NoData'
12 14
 import List from '@/components/List';
13 15
 import Picker from '@/components/Picker'
14 16
 import SearchBar from '@/components/SearchBar'
@@ -21,8 +23,11 @@ export default React.forwardRef((props, ref) => {
21 23
   const { hotel, hotelList, onHotelChange } = props
22 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 32
   const shareDataRef = useRef()
28 33
 
@@ -128,12 +133,16 @@ export default React.forwardRef((props, ref) => {
128 133
     }
129 134
   }
130 135
   const handelCopy = (e, val) => {
136
+    setLoading(true)
131 137
     //阻止冒泡不允许执行父元素的点击事件
132 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 142
       getRoomList({ hotelId: hotel.hotelId }).then((res) => {
135 143
         setDetail(res.records || [])
136 144
       })
145
+      setLoading(false)
137 146
     })
138 147
   }
139 148
   const [showCutover3, setShowCutover3] = useState(false)
@@ -144,45 +153,57 @@ export default React.forwardRef((props, ref) => {
144 153
     setShowCutover3(false)
145 154
   }
146 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 157
       <ToggleRole role='hotel' showCutover={showCutover3} maskClosable={showCutover3} onClose={onClose3} />
150
-
151
-        <View>
158
+      <View style={{ flex: 'none' }}>
152 159
         <view className='storeName'>店名:<Picker style={{ display: 'inline-block' }} placeholder="请选择民宿" value={hotel?.hotelId} kv={['hotelName', 'hotelId']} dicts={hotelList} onChange={handleHotelChange} /></view>
153 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 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 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 180
           params={queryParams}
164 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 201
         </List>
181
-      </view>
182
-      <view className='addHouse' onClick={handelClick}>
202
+      </SpinBox>
203
+      <view className='addHouse' style={{ flex: 'none' }} onClick={handelClick}>
183 204
         <image className='addImg' src={addImg} />添加房源
184 205
       </view>
185 206
 
186
-    </view>
207
+    </View>
187 208
   )
188 209
 })

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

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

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

@@ -1,7 +1,7 @@
1 1
 import withLayout from '@/layouts'
2 2
 import Taro from '@tarojs/taro'
3 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 5
 import { useEffect, useState } from "react"
6 6
 import { saveRoom, getRoomDetail, updateRoom } from '@/services/landlord'
7 7
 import GPS from '@/assets/icons/GuideCheck/GPS.png'
@@ -26,19 +26,19 @@ export default withLayout((props) => {
26 26
     wifiName: '',
27 27
     wifiPassword: '',
28 28
     weight: '',
29
+    locName: '',
30
+    pkLocName: ''
29 31
   })
30 32
   const [paddress, setpAddress] = useState()
31 33
   const [wifiName, setwifiName] = useState()
32 34
   const onRoomMap = () => {
33 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 39
   const onParkMap = () => {
39 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 44
   const sumbit = () => {
@@ -190,9 +190,10 @@ export default withLayout((props) => {
190 190
             <mp-cells title='房屋位置'>
191 191
               <mp-cell>
192 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 197
                 </View>
197 198
               </mp-cell>
198 199
             </mp-cells>
@@ -200,10 +201,11 @@ export default withLayout((props) => {
200 201
               paddress != '' ?
201 202
                 <mp-cells title='停车场位置'>
202 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 209
                     </View>
208 210
                   </mp-cell>
209 211
                 </mp-cells> : null

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

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

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

@@ -29,12 +29,12 @@ export default withLayout((props) => {
29 29
           duration: 1500
30 30
         }).then(
31 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 40
     else {

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

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