李志伟 3 years ago
parent
commit
a0d9e19ff8

+ 9
- 3
src/hotel/components/HouseManage/houseManage.jsx View File

91
       })
91
       })
92
     }
92
     }
93
   })
93
   })
94
-
94
+  //分享房源
95
   useImperativeHandle(ref, () => ({
95
   useImperativeHandle(ref, () => ({
96
     getShareMessage: () => {
96
     getShareMessage: () => {
97
       const { shareImage, roomOrderId } = shareDataRef.current
97
       const { shareImage, roomOrderId } = shareDataRef.current
111
     // 打开分享弹窗
111
     // 打开分享弹窗
112
     setShowCard(true)
112
     setShowCard(true)
113
   }
113
   }
114
+  //查看入住人
114
   const handelOrder = (val) => {
115
   const handelOrder = (val) => {
115
-    Taro.navigateTo({ url: `/hotel/pages/landlord/roomOrder/roomOrder?roomId=${val.roomId}&roomName=${val.roomName}` });
116
+    Taro.navigateTo({ url: `/hotel/pages/landlord/roomOrder/roomOrder?roomId=${val.roomId}&roomName=${val.roomName}&hotelId=${hotel.hotelId}` });
116
   }
117
   }
117
 
118
 
118
   const onSearch = (e) => {
119
   const onSearch = (e) => {
130
   const handelCopy = (e, val) => {
131
   const handelCopy = (e, val) => {
131
     //阻止冒泡不允许执行父元素的点击事件
132
     //阻止冒泡不允许执行父元素的点击事件
132
     e.stopPropagation()
133
     e.stopPropagation()
133
-    saveRoom({ ...val, roomId: null, roomName: val.roomName + '复制' }).then(() => {
134
+    // detail.map((item,index)=>{
135
+    //   if (item.roomId==val.roomId) {
136
+    //     console.log(index)
137
+    //   }
138
+    // })
139
+    saveRoom({ ...val, roomId: null, roomName: val.roomName + '复制' }).then((res) => {
134
       getRoomList({ hotelId: hotel.hotelId }).then((res) => {
140
       getRoomList({ hotelId: hotel.hotelId }).then((res) => {
135
         setDetail(res.records || [])
141
         setDetail(res.records || [])
136
       })
142
       })

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

6
 import CustomNav from '@/components/CustomNav'
6
 import CustomNav from '@/components/CustomNav'
7
 import { withSubscribeMessage } from '@/utils/subscribeMessage'
7
 import { withSubscribeMessage } from '@/utils/subscribeMessage'
8
 import { TPL_MESSAGE_HOTEL_CHECK_IN } from '@/utils/constants'
8
 import { TPL_MESSAGE_HOTEL_CHECK_IN } from '@/utils/constants'
9
+import { useModel } from '@/store'
9
 import HouseManage from '../../components/HouseManage/houseManage'
10
 import HouseManage from '../../components/HouseManage/houseManage'
10
 import Income from '../../components/Income/income'
11
 import Income from '../../components/Income/income'
11
 import tabList from './Roomtabbar'
12
 import tabList from './Roomtabbar'
17
   const { tab } = params || {}
18
   const { tab } = params || {}
18
 
19
 
19
   const [hotelList, setHotelList] = useState([])
20
   const [hotelList, setHotelList] = useState([])
20
-  const [hotel, setHotel] = useState()
21
+  const {hotel, setHotel} = useModel('hotel')
21
   const [account, setAccount] = useState({})
22
   const [account, setAccount] = useState({})
22
 
23
 
23
   const houseRef = useRef()
24
   const houseRef = useRef()
28
     getHotelManage().then((res) => {
29
     getHotelManage().then((res) => {
29
       const { hotelList: list, account: acc, hotel: current } = res
30
       const { hotelList: list, account: acc, hotel: current } = res
30
       setHotelList(list)
31
       setHotelList(list)
31
-      setHotel(current)
32
+      if (!hotel) {
33
+        setHotel(current)
34
+      }
32
       setAccount(acc)
35
       setAccount(acc)
33
     })
36
     })
34
   }, [])
37
   }, [])

+ 18
- 6
src/hotel/pages/landlord/roomOrder/roomOrder.jsx View File

2
 import React, { useState, useEffect, useRef } from 'react'
2
 import React, { useState, useEffect, useRef } from 'react'
3
 import CustomNav from '@/components/CustomNav'
3
 import CustomNav from '@/components/CustomNav'
4
 import Taro from '@tarojs/taro'
4
 import Taro from '@tarojs/taro'
5
+import { useModel } from '@/store'
5
 import copy from '@/assets/icons/landlord/copy.png'
6
 import copy from '@/assets/icons/landlord/copy.png'
6
 import { Input, Button, View, Picker, Label, Image } from '@tarojs/components'
7
 import { Input, Button, View, Picker, Label, Image } from '@tarojs/components'
7
-import { getRoomOrderList } from '@/services/landlord'
8
+import { getRoomOrderList,getHotelDetail } from '@/services/landlord'
8
 import './roomOrder.less'
9
 import './roomOrder.less'
9
 
10
 
10
 
11
 
11
 
12
 
12
 
13
 
13
 export default withLayout((props) => {
14
 export default withLayout((props) => {
14
-  const { roomId, roomName } = props.router.params
15
+  const { hotelId, roomId, roomName } = props.router.params
15
   const [detail, setDetail] = useState([])
16
   const [detail, setDetail] = useState([])
17
+  const { setHotel } = useModel('hotel')
16
 
18
 
17
   useEffect(() => {
19
   useEffect(() => {
18
-    getRoomOrderList({ roomId: roomId }).then((res) => {
19
-      setDetail(res.records || [])
20
-    })
21
-  }, [])
20
+    if (roomId) {
21
+      getRoomOrderList({ roomId: roomId }).then((res) => {
22
+        setDetail(res.records || [])
23
+      })
24
+    }
25
+  }, [roomId])
26
+  
27
+  useEffect(() => {
28
+    if (hotelId) {
29
+      getHotelDetail(hotelId).then((res)=>{
30
+        setHotel(res)
31
+      }) 
32
+    }
33
+  }, [hotelId])
22
 
34
 
23
   const CopyName = (val) => {
35
   const CopyName = (val) => {
24
     Taro.setClipboardData({
36
     Taro.setClipboardData({

+ 3
- 0
src/store/models/hotel.js View File

2
 
2
 
3
 export default function useHotel() {
3
 export default function useHotel() {
4
   const [roomId, setRoomId] = useState()
4
   const [roomId, setRoomId] = useState()
5
+  const [hotel, setHotel] = useState()
5
 
6
 
6
   return {
7
   return {
7
     roomId,
8
     roomId,
8
     setRoomId,
9
     setRoomId,
10
+    hotel,
11
+    setHotel,
9
   }
12
   }
10
 }
13
 }