李志伟 il y a 3 ans
Parent
révision
657bf26c48

+ 6
- 2
src/hotel/components/HouseManage/houseManage.jsx Voir le fichier

@@ -7,6 +7,7 @@ import iconsearch from '@/assets/icons/housemantj/search.png'
7 7
 import React,{useState, useEffect,useRef, useImperativeHandle } from 'react'
8 8
 import {getRoomList,deleteRoom} from '@/services/landlord'
9 9
 import ShareRoom from '../shareRoom/ShareRoom.jsx'
10
+import ShareCard from '../shareCard/shareCard'
10 11
 import './houseManage.less'
11 12
 
12 13
 export default React.forwardRef((props, ref) => {
@@ -34,6 +35,7 @@ export default React.forwardRef((props, ref) => {
34 35
   }
35 36
 
36 37
   const [showCutover, setShowCutover] = useState(false)
38
+  const [showCard, setShowCard] = useState(false)
37 39
   const [room, setRoom] = useState({})
38 40
   const ShowMoldeOn = (room) => {
39 41
     setRoom(room)
@@ -64,9 +66,9 @@ export default React.forwardRef((props, ref) => {
64 66
   useImperativeHandle(ref, () => ({
65 67
     getShareMessage: () => {
66 68
       const { shareImage, roomOrderId } = shareDataRef.current
67
-
69
+      setShowCard(false)
68 70
       return {
69
-        title: '',
71
+        title: room.roomName,
70 72
         path: `/pages/index/index?tab=1&roomId=${room.roomId}&roomOrderId=${roomOrderId}`,
71 73
         imageUrl: shareImage,
72 74
       }
@@ -77,6 +79,7 @@ export default React.forwardRef((props, ref) => {
77 79
     shareDataRef.current = val
78 80
     setShowCutover(false)
79 81
     // 打开分享弹窗
82
+    setShowCard(true)
80 83
   }
81 84
 
82 85
   return (
@@ -88,6 +91,7 @@ export default React.forwardRef((props, ref) => {
88 91
             <view className="searchword">请输入关键字搜索</view>
89 92
           </view>
90 93
           <ShareRoom showCutover={showCutover} onClose={onClose}  room={room} onFinish={handleFinish} />
94
+          <ShareCard showCutover={showCard} onClose={onClose}/>
91 95
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 255px)' }}>
92 96
 
93 97
           <view>

+ 21
- 0
src/hotel/components/shareCard/shareCard.jsx Voir le fichier

@@ -0,0 +1,21 @@
1
+import React from 'react'
2
+import Popup from '@/components/Popup'
3
+import Taro from '@tarojs/taro'
4
+import { Input, Button, View, Picker, Label } from '@tarojs/components'
5
+import {shareRoom} from '@/services/landlord'
6
+import { useState } from 'react'
7
+import './shareCard.less'
8
+
9
+
10
+export default (props) => {
11
+  const { showCutover, onClose} = props
12
+
13
+  return (
14
+    <Popup show={showCutover} onClose={onClose}>
15
+      <View className='card'>
16
+      <Label style={{color:'black',fontSize:'45rpx'}}>确认分享给游客</Label>      
17
+      <View><Button  className='cancel' onClick={onClose}>取消</Button><Button openType='share' className='btn'>确认</Button></View>
18
+    </View>
19
+    </Popup>
20
+  )
21
+}

+ 24
- 0
src/hotel/components/shareCard/shareCard.less Voir le fichier

@@ -0,0 +1,24 @@
1
+.card{
2
+  font-size: 34px;
3
+  padding-top: 40px;
4
+}
5
+.cancel{
6
+  width: 150px;
7
+  height: 70px;
8
+  display: inline-block;
9
+  line-height: 70px;
10
+  border-radius: 12px;
11
+  font-size: 36px;
12
+  margin-top: 15px;
13
+  margin-right: 20px;
14
+}
15
+.btn {
16
+  width: 150px;
17
+  height: 70px;
18
+  background: #1A3B83;
19
+  display: inline-block;
20
+  line-height: 70px;
21
+  border-radius: 12px;
22
+  font-size: 36px;
23
+  color: #fff;
24
+}

+ 27
- 22
src/hotel/components/shareRoom/ShareRoom.jsx Voir le fichier

@@ -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
 }

+ 34
- 13
src/hotel/components/shareRoom/ShareRoom.less Voir le fichier

@@ -1,17 +1,38 @@
1 1
   .from-room{
2
-    width: 100%;
3
-    box-shadow: 0px 8px 32px 0px rgba(0, 0, 0, 0.08);
4
-    border-radius: 24px;
5
-    font-size: 1.1em;
6
-    padding: 20px;
7
-    .btn {
8
-      width: 100px;
9
-      height: 92px;
2
+    font-size: 34px;
3
+    padding-top: 30px;
4
+    .flex{
5
+      display: flex;
6
+      margin: 10px 0;
7
+      Input{
8
+        width: 345px;
9
+        border-radius: 15px;
10
+        border: solid 1px rgb(121, 116, 116);
11
+        margin-left: 70px;
12
+      }
13
+      .picker{
14
+        width: 345px;
15
+        border-radius: 15px;
16
+        border: solid 1px rgb(121, 116, 116);
17
+      }
18
+    }
19
+  }
20
+  .cancel{
21
+      width: 150px;
22
+      height: 70px;
23
+      display: inline-block;
24
+      line-height: 70px;
25
+      border-radius: 12px;
26
+      font-size: 36px;
27
+      margin-right: 20px;
28
+  }
29
+  .btn {
30
+      width: 150px;
31
+      height: 70px;
10 32
       background: #1A3B83;
11
-      line-height: 92px;
33
+      display: inline-block;
34
+      line-height: 70px;
12 35
       border-radius: 12px;
13
-      font-size: 40px;
14
-      color: #ffffff;
15
-    }
36
+      font-size: 36px;
37
+      color: #fff;
16 38
   }
17
-