|
@@ -6,7 +6,9 @@ import del from '@/assets/icons/landlord/delete.png'
|
6
|
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
|
|
-import { getRoomList, saveRoom, deleteRoom } from '@/services/landlord'
|
|
9
|
+import { getRoomList, saveRoom, deleteRoom, saveExtend } from '@/services/landlord'
|
|
10
|
+import { getExtendContent } from "@/services/home";
|
|
11
|
+import Spin3 from '@/components/Spin/Spin3';
|
10
|
12
|
import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
|
11
|
13
|
import ToggleRole from '@/components/toggleRole/ToggleRole'
|
12
|
14
|
import List from '@/components/List';
|
|
@@ -20,12 +22,12 @@ import './houseManage.less'
|
20
|
22
|
export default React.forwardRef((props, ref) => {
|
21
|
23
|
const { hotel, hotelList, onHotelChange } = props
|
22
|
24
|
const [detail, setDetail] = useState([])
|
23
|
|
- const [search,setSearch]=useState()
|
|
25
|
+ const [search, setSearch] = useState()
|
24
|
26
|
|
25
|
27
|
const queryParams = useMemo(() => ({
|
26
|
28
|
hotelId: hotel.hotelId,
|
27
|
29
|
roomName: search
|
28
|
|
- }), [hotel.hotelId,search])
|
|
30
|
+ }), [hotel.hotelId, search])
|
29
|
31
|
|
30
|
32
|
const shareDataRef = useRef()
|
31
|
33
|
|
|
@@ -90,7 +92,7 @@ export default React.forwardRef((props, ref) => {
|
90
|
92
|
//当前页面切换到前台时
|
91
|
93
|
useDidShow(() => {
|
92
|
94
|
if (mounted.current) {
|
93
|
|
- getRoomList({ hotelId: hotel.hotelId,roomName: search,pageSize:'500' }).then((res) => {
|
|
95
|
+ getRoomList({ hotelId: hotel.hotelId, roomName: search, pageSize: '500' }).then((res) => {
|
94
|
96
|
setDetail(res.records || [])
|
95
|
97
|
})
|
96
|
98
|
}
|
|
@@ -134,18 +136,34 @@ export default React.forwardRef((props, ref) => {
|
134
|
136
|
})
|
135
|
137
|
}
|
136
|
138
|
}
|
|
139
|
+ //本店指南
|
|
140
|
+ const [loading,setLoading]=useState(false)
|
137
|
141
|
const handelCopy = (e, val) => {
|
138
|
142
|
//阻止冒泡不允许执行父元素的点击事件
|
139
|
143
|
e.stopPropagation()
|
|
144
|
+ setLoading(true)
|
140
|
145
|
let copy = 0
|
141
|
146
|
detail.map((item, index) => {
|
142
|
147
|
if (item.roomId === val.roomId) {
|
143
|
148
|
copy = index
|
144
|
149
|
}
|
145
|
150
|
})
|
146
|
|
- saveRoom({ ...val, roomId: null, roomName: val.roomName + '复制' }).then((res) => {
|
147
|
|
- setDetail([...detail.slice(0, copy), res, ...detail.slice(copy)])
|
|
151
|
+ getExtendContent('room', val.roomId, { pageSize: 500 }).then((res2) => {
|
|
152
|
+ saveRoom({ ...val, roomId: null, roomName: val.roomName + '复制' }).then((res) => {
|
|
153
|
+ res2.records.lenght != 0 ?
|
|
154
|
+ //如果原房源有更多指引查出列表遍历每条拿出来放到新的房源的更多指引里
|
|
155
|
+ res2.records.map((item) => {
|
|
156
|
+ saveExtend({ ...item, targetId: res.roomId })
|
|
157
|
+ }) :null
|
|
158
|
+ setLoading(false)
|
|
159
|
+ Taro.showToast({
|
|
160
|
+ title: '复制房源成功',
|
|
161
|
+ icon: 'none',
|
|
162
|
+ })
|
|
163
|
+ setDetail([...detail.slice(0, copy), res, ...detail.slice(copy)])
|
|
164
|
+ })
|
148
|
165
|
})
|
|
166
|
+
|
149
|
167
|
}
|
150
|
168
|
const [showCutover3, setShowCutover3] = useState(false)
|
151
|
169
|
const ShowMoldeOn3 = () => {
|
|
@@ -156,6 +174,7 @@ export default React.forwardRef((props, ref) => {
|
156
|
174
|
}
|
157
|
175
|
return (
|
158
|
176
|
<View style={{ padding: '0 30rpx', height: '100%', display: 'flex', flexDirection: 'column' }}>
|
|
177
|
+ <Spin3 show={loading} />
|
159
|
178
|
<ToggleRole role='hotel' showCutover={showCutover3} maskClosable={showCutover3} onClose={onClose3} />
|
160
|
179
|
<View style={{ flex: 'none' }}>
|
161
|
180
|
<view className='storeName'>店名:<Picker style={{ display: 'inline-block' }} placeholder="请选择民宿" value={hotel?.hotelId} kv={['hotelName', 'hotelId']} dicts={hotelList} onChange={handleHotelChange} /></view>
|