李志伟 3 年之前
父節點
當前提交
a0d9e19ff8

+ 9
- 3
src/hotel/components/HouseManage/houseManage.jsx 查看文件

@@ -91,7 +91,7 @@ export default React.forwardRef((props, ref) => {
91 91
       })
92 92
     }
93 93
   })
94
-
94
+  //分享房源
95 95
   useImperativeHandle(ref, () => ({
96 96
     getShareMessage: () => {
97 97
       const { shareImage, roomOrderId } = shareDataRef.current
@@ -111,8 +111,9 @@ export default React.forwardRef((props, ref) => {
111 111
     // 打开分享弹窗
112 112
     setShowCard(true)
113 113
   }
114
+  //查看入住人
114 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 119
   const onSearch = (e) => {
@@ -130,7 +131,12 @@ export default React.forwardRef((props, ref) => {
130 131
   const handelCopy = (e, val) => {
131 132
     //阻止冒泡不允许执行父元素的点击事件
132 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 140
       getRoomList({ hotelId: hotel.hotelId }).then((res) => {
135 141
         setDetail(res.records || [])
136 142
       })

+ 5
- 2
src/hotel/pages/landlord/landlord.jsx 查看文件

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

+ 18
- 6
src/hotel/pages/landlord/roomOrder/roomOrder.jsx 查看文件

@@ -2,23 +2,35 @@ import withLayout from '@/layouts'
2 2
 import React, { useState, useEffect, useRef } from 'react'
3 3
 import CustomNav from '@/components/CustomNav'
4 4
 import Taro from '@tarojs/taro'
5
+import { useModel } from '@/store'
5 6
 import copy from '@/assets/icons/landlord/copy.png'
6 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 9
 import './roomOrder.less'
9 10
 
10 11
 
11 12
 
12 13
 
13 14
 export default withLayout((props) => {
14
-  const { roomId, roomName } = props.router.params
15
+  const { hotelId, roomId, roomName } = props.router.params
15 16
   const [detail, setDetail] = useState([])
17
+  const { setHotel } = useModel('hotel')
16 18
 
17 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 35
   const CopyName = (val) => {
24 36
     Taro.setClipboardData({

+ 3
- 0
src/store/models/hotel.js 查看文件

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