|
@@ -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
|
})
|