|
@@ -2,47 +2,52 @@ import React from 'react'
|
2
|
2
|
import Popup from '@/components/Popup'
|
3
|
3
|
import Taro from '@tarojs/taro'
|
4
|
4
|
import { Input, Button, View, Picker, Label } from '@tarojs/components'
|
|
5
|
+import { shareRoom } from '@/services/landlord'
|
5
|
6
|
import './ShareRoom.less'
|
6
|
7
|
import { useState } from 'react'
|
7
|
8
|
|
8
|
9
|
|
9
|
10
|
export default (props) => {
|
10
|
|
- const { showCutover, onClose,roomId } = props
|
|
11
|
+ const { showCutover, onClose, room, onFinish } = props
|
11
|
12
|
const [startDate, setStartDate] = useState('')
|
12
|
13
|
const [endDate, setEndDate] = useState('')
|
13
|
|
- const [roomNum, setRoomNum] = useState()
|
|
14
|
+ const [roomNum, setRoomNum] = useState('')
|
14
|
15
|
const handelStartDate = (e) => {
|
15
|
16
|
setStartDate(e.detail.value)
|
16
|
17
|
}
|
17
|
18
|
const handelEndDate = (e) => {
|
18
|
19
|
setEndDate(e.detail.value)
|
19
|
20
|
}
|
20
|
|
-const handelShare=()=>{
|
21
|
|
- if(roomNum!=''&&startDate!=''&&endDate!=''){
|
22
|
|
- console.log(roomNum,startDate,roomId)
|
|
21
|
+ const handelShare = () => {
|
|
22
|
+ if (roomNum != '' && startDate != '' && endDate != '') {
|
|
23
|
+ shareRoom({ hotelId: room.hotelId, personNum: roomNum, roomId: room.roomId, startDate: startDate, endDate: endDate }).then((res) => {
|
|
24
|
+ onFinish(res)
|
|
25
|
+ setStartDate('')
|
|
26
|
+ setEndDate('')
|
|
27
|
+ setRoomNum()
|
|
28
|
+ })
|
|
29
|
+ }
|
23
|
30
|
}
|
24
|
|
-}
|
25
|
31
|
return (
|
26
|
32
|
<Popup show={showCutover} onClose={onClose}>
|
27
|
|
- <Label style={{color:'black'}}>请输入入住人信息</Label>
|
28
|
|
- <View><Label>入住人数:</Label><Input focus dataField='nm' onInput={(e) => setRoomNum(e.detail.value )} value={roomNum} type='number' placeholder='请输入入住人数' /></View>
|
29
|
|
- <View>
|
30
|
|
- <Label>入住开始时间:</Label>
|
31
|
|
- <Picker mode='date' onChange={handelStartDate}>
|
32
|
|
- <View className='picker' >
|
|
33
|
+ <View className='from-room'>
|
|
34
|
+ <Label style={{ color: 'black' }}>请输入入住人信息</Label>
|
|
35
|
+ <View className='flex'>
|
|
36
|
+ <Label>入住人数:</Label><Input focus dataField='nm' onInput={(e) => setRoomNum(e.detail.value)} value={roomNum} type='number' placeholder='请输入入住人数' /></View>
|
|
37
|
+ <View className='flex'>
|
|
38
|
+ <Label>入住开始时间:</Label>
|
|
39
|
+ <Picker mode='date' className='picker' onChange={handelStartDate}>
|
33
|
40
|
{startDate == '' ? '请选择入住开始时间' : startDate}
|
34
|
|
- </View>
|
35
|
|
- </Picker>
|
36
|
|
- </View>
|
37
|
|
- <View>
|
38
|
|
- <Label>入住结束时间:</Label>
|
39
|
|
- <Picker mode='date' onChange={handelEndDate}>
|
40
|
|
- <View className='picker' >
|
|
41
|
+ </Picker>
|
|
42
|
+ </View>
|
|
43
|
+ <View className='flex'>
|
|
44
|
+ <Label>入住结束时间:</Label>
|
|
45
|
+ <Picker className='picker' mode='date' onChange={handelEndDate}>
|
41
|
46
|
{endDate == '' ? '请选择入住结束时间' : endDate}
|
42
|
|
- </View>
|
43
|
|
- </Picker>
|
|
47
|
+ </Picker>
|
|
48
|
+ </View>
|
|
49
|
+ <View><Button className='cancel' onClick={onClose}>取消</Button><Button className='btn' onClick={handelShare}>分享</Button></View>
|
44
|
50
|
</View>
|
45
|
|
- <View><Button className='btn' onClick={onClose}>取消</Button><Button className='btn' onClick={handelShare}>分享</Button></View>
|
46
|
51
|
</Popup>
|
47
|
52
|
)
|
48
|
53
|
}
|