李志伟 3 lat temu
rodzic
commit
4fb91f42e1
1 zmienionych plików z 14 dodań i 9 usunięć
  1. 14
    9
      src/hotel/components/shareRoom/ShareRoom.jsx

+ 14
- 9
src/hotel/components/shareRoom/ShareRoom.jsx Wyświetl plik

19
     setEndDate(e.detail.value)
19
     setEndDate(e.detail.value)
20
   }
20
   }
21
   const handelShare = () => {
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
-    }
22
+    var myDate = new Date();
23
+    shareRoom({
24
+      hotelId: room.hotelId,
25
+      personNum: roomNum == '' ? 0 : roomNum, roomId: room.roomId,
26
+      startDate: startDate == '' ? myDate.toLocaleDateString() : startDate,
27
+      endDate: endDate == '' ? myDate.toLocaleDateString() : endDate
28
+    }).then((res) => {
29
+      onFinish(res)
30
+      setStartDate('')
31
+      setEndDate('')
32
+      setRoomNum()
33
+    })
34
+
30
   }
35
   }
31
   return (
36
   return (
32
     <Popup show={showCutover} onClose={onClose}>
37
     <Popup show={showCutover} onClose={onClose}>
33
       <View className='from-room srl'>
38
       <View className='from-room srl'>
34
-        <View style={{marginBottom:'25px'}}>
39
+        <View style={{ marginBottom: '25px' }}>
35
           <View className='rzline' /><Label className='srl mg'>请输入入住人信息</Label><View className='rzline' />
40
           <View className='rzline' /><Label className='srl mg'>请输入入住人信息</Label><View className='rzline' />
36
         </View>
41
         </View>
37
         <View className='srleft'>
42
         <View className='srleft'>