|
@@ -1,12 +1,13 @@
|
1
|
1
|
import withLayout from '@/layouts'
|
2
|
|
-import React, { useState, useEffect, useRef } from 'react'
|
|
2
|
+import React, { useState, useEffect, useRef, useMemo } from 'react'
|
3
|
3
|
import CustomNav from '@/components/CustomNav'
|
4
|
4
|
import Taro from '@tarojs/taro'
|
5
|
5
|
import { useModel } from '@/store'
|
6
|
6
|
import SpinBox from "@/components/Spin/SpinBox";
|
7
|
7
|
import copy from '@/assets/icons/landlord/copy.png'
|
8
|
8
|
import { Input, Button, View, Picker, Label, Image } from '@tarojs/components'
|
9
|
|
-import { getRoomOrderList,getHotelDetail } from '@/services/landlord'
|
|
9
|
+import List from '@/components/List';
|
|
10
|
+import { getRoomOrderList, getHotelDetail } from '@/services/landlord'
|
10
|
11
|
import './roomOrder.less'
|
11
|
12
|
|
12
|
13
|
|
|
@@ -14,23 +15,16 @@ export default withLayout((props) => {
|
14
|
15
|
const { hotelId, roomId, roomName } = props.router.params
|
15
|
16
|
const [detail, setDetail] = useState([])
|
16
|
17
|
const { setHotel } = useModel('hotel')
|
17
|
|
- const [loading, setLoading] = useState(false)
|
18
|
18
|
|
19
|
|
- useEffect(() => {
|
20
|
|
- setLoading(true)
|
21
|
|
- if (roomId) {
|
22
|
|
- getRoomOrderList({ roomId: roomId }).then((res) => {
|
23
|
|
- setDetail(res.records || [])
|
24
|
|
- setLoading(false)
|
25
|
|
- })
|
26
|
|
- }
|
27
|
|
- }, [roomId])
|
28
|
|
-
|
|
19
|
+ const queryParams = useMemo(() => ({
|
|
20
|
+ roomId: roomId
|
|
21
|
+ }), [roomId])
|
|
22
|
+
|
29
|
23
|
useEffect(() => {
|
30
|
24
|
if (hotelId) {
|
31
|
|
- getHotelDetail(hotelId).then((res)=>{
|
|
25
|
+ getHotelDetail(hotelId).then((res) => {
|
32
|
26
|
setHotel(res)
|
33
|
|
- })
|
|
27
|
+ })
|
34
|
28
|
}
|
35
|
29
|
}, [hotelId])
|
36
|
30
|
|
|
@@ -61,40 +55,44 @@ export default withLayout((props) => {
|
61
|
55
|
}
|
62
|
56
|
|
63
|
57
|
return (
|
64
|
|
- <View style={{ padding: '0 30px' }}>
|
|
58
|
+ <View className='page-index'>
|
65
|
59
|
<view className='index-navbar'>
|
66
|
60
|
<CustomNav title={roomName ? decodeURIComponent(roomName) : '房间名'} />
|
67
|
61
|
</view>
|
68
|
|
- <SpinBox loading={loading}>
|
69
|
|
- <scroll-view scrollY style={{ height: 'calc(100vh - 65px)' }}>
|
70
|
|
-
|
71
|
|
- {
|
72
|
|
- detail.length == 0 ? <View className='houseCard'>暂无入住人数据</View>
|
73
|
|
- : detail.map((item, index) =>
|
74
|
|
- <View className='houseCard' key={index}>
|
75
|
|
- {
|
76
|
|
- (item.personList || []).map((item2, inx) =>
|
77
|
|
- <View className='operation' key={inx}>
|
78
|
|
- <View style={{ display: 'inline-block' }} onClick={() => CopyName(item2.customerName)}>
|
79
|
|
- <Label>{item2.customerName}</Label>
|
80
|
|
- <Image src={copy} />
|
81
|
|
- </View>
|
82
|
|
- <View style={{ display: 'inline-block', marginLeft: '40rpx' }} onClick={() => CopyPhone(item2.customerPhone)}>
|
83
|
|
- <Label>{item2.customerPhone}</Label>
|
84
|
|
- <Image src={copy} />
|
|
62
|
+ <View className='index-container'>
|
|
63
|
+ <List
|
|
64
|
+ style={{ height: '100%' }}
|
|
65
|
+ request={getRoomOrderList}
|
|
66
|
+ params={queryParams}
|
|
67
|
+ onDataChange={setDetail}
|
|
68
|
+ refresherEnabled={false}
|
|
69
|
+ noData={<View style={{ padding: '15px 30px' }}><View className='houseCard'>暂无入住人数据</View></View>}
|
|
70
|
+ >
|
|
71
|
+ {
|
|
72
|
+ detail.map((item, index) =>
|
|
73
|
+ <View style={{ padding: '15px 30px' }}>
|
|
74
|
+ <View className='houseCard' key={index}>
|
|
75
|
+ {
|
|
76
|
+ (item.personList || []).map((item2, inx) =>
|
|
77
|
+ <View className='operation' key={inx}>
|
|
78
|
+ <View style={{ display: 'inline-block' }} onClick={() => CopyName(item2.customerName)}>
|
|
79
|
+ <Label>{item2.customerName}</Label>
|
|
80
|
+ <Image src={copy} />
|
|
81
|
+ </View>
|
|
82
|
+ <View style={{ display: 'inline-block', marginLeft: '40rpx' }} onClick={() => CopyPhone(item2.customerPhone)}>
|
|
83
|
+ <Label>{item2.customerPhone}</Label>
|
|
84
|
+ <Image src={copy} />
|
|
85
|
+ </View>
|
85
|
86
|
</View>
|
86
|
|
- </View>
|
87
|
|
-
|
88
|
|
- )
|
89
|
|
- }
|
90
|
|
- <View className='operation'>入住时间:{item.startDate} - {item.endDate}</View>
|
91
|
|
-
|
|
87
|
+ )
|
|
88
|
+ }
|
|
89
|
+ <View className='operation'>入住时间:{item.startDate} - {item.endDate}</View>
|
|
90
|
+ </View>
|
92
|
91
|
</View>
|
93
|
92
|
)
|
94
|
|
- }
|
95
|
|
-
|
96
|
|
- </scroll-view>
|
97
|
|
- </SpinBox>
|
|
93
|
+ }
|
|
94
|
+ </List>
|
|
95
|
+ </View>
|
98
|
96
|
</View>
|
99
|
97
|
)
|
100
|
98
|
})
|