|
@@ -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'
|
|
@@ -7,10 +7,6 @@ import addImg from '@/assets/icons/landlord/add.png'
|
7
|
7
|
import copyRoom from '@/assets/icons/landlord/copyroom.png'
|
8
|
8
|
import React, { useState, useEffect, useRef, useImperativeHandle, useMemo } from 'react'
|
9
|
9
|
import { getRoomList, saveRoom, deleteRoom } from '@/services/landlord'
|
10
|
|
-import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
|
11
|
|
-import ToggleRole from '@/components/toggleRole/ToggleRole'
|
12
|
|
-import SpinBox from "@/components/Spin/SpinBox";
|
13
|
|
-import NoData from '@/components/NoData'
|
14
|
10
|
import List from '@/components/List';
|
15
|
11
|
import Picker from '@/components/Picker'
|
16
|
12
|
import SearchBar from '@/components/SearchBar'
|
|
@@ -24,13 +20,13 @@ export default React.forwardRef((props, ref) => {
|
24
|
20
|
const [detail, setDetail] = useState([])
|
25
|
21
|
|
26
|
22
|
const fetchAPI = useMemo(() => hotel.hotelId ? () => getRoomList({ hotelId: hotel.hotelId }) : undefined, [hotel?.hotelId])
|
27
|
|
- const queryParams = useMemo(() => ({ pageNum: 1, pageSize: 0, }), [])
|
|
23
|
+ const queryParams = useMemo(() => ({}), [])
|
28
|
24
|
|
29
|
25
|
const shareDataRef = useRef()
|
30
|
26
|
|
31
|
27
|
// 判断是否首次加载
|
32
|
|
-
|
33
|
28
|
const mounted = useRef(false)
|
|
29
|
+
|
34
|
30
|
const handelClick = () => {
|
35
|
31
|
Taro.navigateTo({ url: `/hotel/pages/landlord/addRoom/addRoom?hotelId=${hotel.hotelId}&hotelName=${hotel.hotelName}` });
|
36
|
32
|
}
|
|
@@ -98,7 +94,7 @@ export default React.forwardRef((props, ref) => {
|
98
|
94
|
getShareMessage: () => {
|
99
|
95
|
const { shareImage, roomOrderId } = shareDataRef.current
|
100
|
96
|
setShowCard(false)
|
101
|
|
- // console.log(`/pages/index/index?tab=1&roomId=${room.roomId}&roomOrderId=${roomOrderId}&fromType=hotel&recommender=${hotel.hotelId}`)
|
|
97
|
+ console.log(`/pages/index/index?tab=1&roomId=${room.roomId}&roomOrderId=${roomOrderId}&fromType=hotel&recommender=${hotel.hotelId}`)
|
102
|
98
|
return {
|
103
|
99
|
title: room.roomName,
|
104
|
100
|
path: `/pages/index/index?tab=1&roomId=${room.roomId}&roomOrderId=${roomOrderId}&fromType=hotel&recommender=${hotel.hotelId}`,
|
|
@@ -124,86 +120,53 @@ export default React.forwardRef((props, ref) => {
|
124
|
120
|
})
|
125
|
121
|
}
|
126
|
122
|
else {
|
127
|
|
- // setVal('')
|
128
|
123
|
getRoomList({ hotelId: hotel.hotelId, roomName: e.detail.value }).then((res) => {
|
129
|
124
|
setDetail(res.records || [])
|
130
|
125
|
})
|
131
|
126
|
}
|
132
|
127
|
}
|
133
|
|
- const handelCopy = (e, val, index) => {
|
|
128
|
+ const handelCopy = (e, val) => {
|
134
|
129
|
//阻止冒泡不允许执行父元素的点击事件
|
135
|
130
|
e.stopPropagation()
|
136
|
|
- saveRoom({ ...val, roomId: null, roomName: val.roomName + '复制', createDate: null }).then((res) => {
|
137
|
|
- // setDetail(...detail,res)
|
138
|
|
- // detail.push(res)
|
|
131
|
+ saveRoom({ ...val, roomId: null, roomName: val.roomName + '复制' }).then(() => {
|
139
|
132
|
getRoomList({ hotelId: hotel.hotelId }).then((res) => {
|
140
|
133
|
setDetail(res.records || [])
|
141
|
134
|
})
|
142
|
|
- setLoading(false)
|
143
|
135
|
})
|
144
|
|
-
|
145
|
|
-
|
146
|
|
- }
|
147
|
|
- const [showCutover3, setShowCutover3] = useState(false)
|
148
|
|
- const ShowMoldeOn3 = () => {
|
149
|
|
- setShowCutover3(true)
|
150
|
136
|
}
|
151
|
|
- const onClose3 = () => {
|
152
|
|
- setShowCutover3(false)
|
153
|
|
- }
|
154
|
|
- const [val, setVal] = useState()
|
155
|
137
|
return (
|
156
|
|
- <View style={{ display: 'flex', flexDirection: 'column', overflow: 'hidden', boxSizing: 'border-box',height:'100%' }}>
|
157
|
|
- <ToggleRole role='hotel' showCutover={showCutover3} maskClosable={showCutover3} onClose={onClose3} />
|
158
|
|
- <View style={{ flex: 'none' }}>
|
|
138
|
+ <view>
|
|
139
|
+ <view style={{ padding: '0 30rpx', height: '100%' }}>
|
159
|
140
|
<view className='storeName'>店名:<Picker style={{ display: 'inline-block' }} placeholder="请选择民宿" value={hotel?.hotelId} kv={['hotelName', 'hotelId']} dicts={hotelList} onChange={handleHotelChange} /></view>
|
160
|
|
- <view onClick={ShowMoldeOn3} className='User-info-cutover'>
|
161
|
|
- <image className='User-info-cutover-image' src={cutoverUser} />
|
162
|
|
- </view>
|
163
|
|
- </View>
|
164
|
|
- <View style={{ flex: 'none' }}>
|
165
|
141
|
<SearchBar placeholder='请输入房源名搜索' onBlur={onSearch} />
|
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' }}>
|
|
142
|
+ <ShareRoom showCutover={showCutover} onClose={onClose} room={room} onFinish={handleFinish} />
|
|
143
|
+ <ShareCard showCutover={showCard} onClose={onClose2} />
|
170
|
144
|
<List
|
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}
|
|
145
|
+ style={{ height: 'calc(100vh - 244px)' }}
|
|
146
|
+ request={fetchAPI}
|
180
|
147
|
params={queryParams}
|
181
|
148
|
onDataChange={setDetail}
|
|
149
|
+ noData="暂无房源信息"
|
182
|
150
|
>
|
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
|
|
- }
|
|
151
|
+ <view className='waterfall'>
|
|
152
|
+ {
|
|
153
|
+ detail.map((item, index) =>
|
|
154
|
+ <view className='houseCard' key={index}>
|
|
155
|
+ <View className='houseName' onClick={() => handelDetail(item)}>{item.roomName || ''}<Image src={copyRoom} onClick={(e) => handelCopy(e, item)} /></View>
|
|
156
|
+ <view className='operation'>
|
|
157
|
+ <view onClick={() => handelOrder(item)}><image src={see} />查看入住人</view>
|
|
158
|
+ <view onClick={() => ShowMoldeOn(item)}><image src={share} />分享链接</view>
|
|
159
|
+ <view onClick={() => handelDelete(item)}><image src={del} />删除房源</view>
|
|
160
|
+ </view>
|
|
161
|
+ </view>)
|
|
162
|
+ }
|
|
163
|
+ </view>
|
201
|
164
|
</List>
|
202
|
|
- </SpinBox>
|
203
|
|
- <view className='addHouse' style={{ flex: 'none' }} onClick={handelClick}>
|
|
165
|
+ </view>
|
|
166
|
+ <view className='addHouse' onClick={handelClick}>
|
204
|
167
|
<image className='addImg' src={addImg} />添加房源
|
205
|
168
|
</view>
|
206
|
169
|
|
207
|
|
- </View>
|
|
170
|
+ </view>
|
208
|
171
|
)
|
209
|
172
|
})
|