|
@@ -1,19 +1,20 @@
|
1
|
|
-import Taro from '@tarojs/taro'
|
|
1
|
+import Taro, {useDidShow } from '@tarojs/taro'
|
2
|
2
|
import see from '@/assets/icons/landlord/查看入住人.png'
|
3
|
3
|
import share from '@/assets/icons/landlord/分享链接.png'
|
4
|
4
|
import del from '@/assets/icons/landlord/删除.png'
|
5
|
5
|
import addImg from '@/assets/icons/landlord/添加.png'
|
6
|
6
|
import iconsearch from '@/assets/icons/housemantj/search.png'
|
7
|
|
-import './houseManage.less'
|
8
|
|
-import {useState, useEffect,useRef } from 'react'
|
9
|
|
-import {useDidShow } from '@tarojs/taro'
|
|
7
|
+import React,{useState, useEffect,useRef, useImperativeHandle } from 'react'
|
10
|
8
|
import {getRoomList,deleteRoom} from '@/services/landlord'
|
11
|
9
|
import ShareRoom from '../shareRoom/ShareRoom.jsx'
|
|
10
|
+import './houseManage.less'
|
12
|
11
|
|
13
|
|
-
|
14
|
|
-export default (props) => {
|
|
12
|
+export default React.forwardRef((props, ref) => {
|
15
|
13
|
const {hotel}=props
|
16
|
14
|
const [detail, setDetail] = useState([])
|
|
15
|
+
|
|
16
|
+ const shareDataRef = useRef()
|
|
17
|
+
|
17
|
18
|
// 判断是否首次加载
|
18
|
19
|
const mounted = useRef(false)
|
19
|
20
|
|
|
@@ -33,9 +34,9 @@ export default (props) => {
|
33
|
34
|
}
|
34
|
35
|
|
35
|
36
|
const [showCutover, setShowCutover] = useState(false)
|
36
|
|
- const [roomId, setRoomId] = useState()
|
37
|
|
- const ShowMoldeOn = (roomId) => {
|
38
|
|
- setRoomId(roomId)
|
|
37
|
+ const [room, setRoom] = useState({})
|
|
38
|
+ const ShowMoldeOn = (room) => {
|
|
39
|
+ setRoom(room)
|
39
|
40
|
setShowCutover(true)
|
40
|
41
|
}
|
41
|
42
|
const onClose = () => {
|
|
@@ -60,6 +61,24 @@ export default (props) => {
|
60
|
61
|
}
|
61
|
62
|
})
|
62
|
63
|
|
|
64
|
+ useImperativeHandle(ref, () => ({
|
|
65
|
+ getShareMessage: () => {
|
|
66
|
+ const { shareImage, roomOrderId } = shareDataRef.current
|
|
67
|
+
|
|
68
|
+ return {
|
|
69
|
+ title: '',
|
|
70
|
+ path: `/pages/index/index?tab=1&roomId=${room.roomId}&roomOrderId=${roomOrderId}`,
|
|
71
|
+ imageUrl: shareImage,
|
|
72
|
+ }
|
|
73
|
+ }
|
|
74
|
+ }))
|
|
75
|
+
|
|
76
|
+ const handleFinish = (val) => {
|
|
77
|
+ shareDataRef.current = val
|
|
78
|
+ setShowCutover(false)
|
|
79
|
+ // 打开分享弹窗
|
|
80
|
+ }
|
|
81
|
+
|
63
|
82
|
return (
|
64
|
83
|
<view>
|
65
|
84
|
<view style={{ padding: '0 30rpx', height: '100%' }}>
|
|
@@ -68,7 +87,7 @@ export default (props) => {
|
68
|
87
|
<image className='searchicon' src={iconsearch} />
|
69
|
88
|
<view className="searchword">请输入关键字搜索</view>
|
70
|
89
|
</view>
|
71
|
|
- <ShareRoom showCutover={showCutover} onClose={onClose} roomId={roomId}/>
|
|
90
|
+ <ShareRoom showCutover={showCutover} onClose={onClose} room={room} onFinish={handleFinish} />
|
72
|
91
|
<scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 255px)' }}>
|
73
|
92
|
|
74
|
93
|
<view>
|
|
@@ -78,7 +97,7 @@ export default (props) => {
|
78
|
97
|
<view className='houseName'>{item.roomName}</view>
|
79
|
98
|
<view className='operation'>
|
80
|
99
|
<view><image src={see} />查看入住人</view>
|
81
|
|
- <view onClick={()=>ShowMoldeOn(item.roomId)}><image src={share}/>分享链接</view>
|
|
100
|
+ <view onClick={()=>ShowMoldeOn(item)}><image src={share}/>分享链接</view>
|
82
|
101
|
<view onClick={()=>{handelDelete(item.roomId)}}><image src={del} />删除房源</view>
|
83
|
102
|
</view>
|
84
|
103
|
</view>
|
|
@@ -95,4 +114,4 @@ export default (props) => {
|
95
|
114
|
|
96
|
115
|
</view>
|
97
|
116
|
)
|
98
|
|
-}
|
|
117
|
+})
|