李志伟 3 年 前
コミット
c536051530
共有3 個のファイルを変更した15 個の追加11 個の削除を含む
  1. 1
    1
      src/components/List/index.jsx
  2. 8
    3
      src/hotel/components/shareRoom/ShareRoom.jsx
  3. 6
    7
      src/pages/RoomOrder/index.jsx

+ 1
- 1
src/components/List/index.jsx ファイルの表示

@@ -127,7 +127,7 @@ export default React.forwardRef((props, ref) => {
127 127
   useEffect(() => {
128 128
     Taro.nextTick(() => {
129 129
       Taro.createSelectorQuery().select(`.${uqCls}`).node(function (res) {
130
-        contextRef.current = res.node
130
+        contextRef.current = res?.node
131 131
       }).exec()
132 132
     })
133 133
   }, [])

+ 8
- 3
src/hotel/components/shareRoom/ShareRoom.jsx ファイルの表示

@@ -19,15 +19,20 @@ export default (props) => {
19 19
   const handelEndDate = (e) => {
20 20
     setEndDate(e.detail.value)
21 21
   }
22
+  const nowDate=()=>{
23
+    var myDate = new Date();
24
+    let mouth=myDate.getUTCMonth()<9?'0'+(myDate.getUTCMonth()+1):(myDate.getUTCMonth()+1)
25
+    let day=myDate.getDate()<10?'0'+myDate.getDate():myDate.getDate
26
+    return myDate.getUTCFullYear()+'-'+mouth+'-'+day
27
+  }
22 28
   const handelShare = () => {
23 29
     setLoading(true)
24
-    var myDate = new Date();
25 30
     shareRoom({
26 31
       hotelId: room.hotelId,
27 32
       personNum: roomNum == '' ? 0 : roomNum,
28 33
       roomId: room.roomId,
29
-      startDate: startDate == '' ? myDate.toLocaleDateString() : startDate,
30
-      endDate: endDate == '' ? myDate.toLocaleDateString() : endDate
34
+      startDate: startDate == '' ? nowDate(): startDate,
35
+      endDate: endDate == '' ? nowDate(): endDate
31 36
     }).then((res) => {
32 37
       onFinish(res)
33 38
       setStartDate('')

+ 6
- 7
src/pages/RoomOrder/index.jsx ファイルの表示

@@ -26,9 +26,9 @@ export default withLayout((props) => {
26 26
     formData[inx] = e;
27 27
     setFormData([...formData])
28 28
   }
29
-
29
+  const [loading, setLoading] = useState(false)
30 30
   const handleSubmit = (e) => {
31
-
31
+    setLoading(true)
32 32
     // 订阅消息
33 33
     withSubscribeMessage([TPL_MESSAGE_HOTEL_CHECK_OUT], () => {
34 34
       for (let i = 0, len = formData.length; i < len; i++) {
@@ -42,15 +42,14 @@ export default withLayout((props) => {
42 42
         }
43 43
       }
44 44
       personSubmit(roomOrderId, formData).then(a => {
45
-        // Taro.navigateBack({
46
-        //   delta: 1
47
-        // })
48 45
         Taro.reLaunch({
49 46
           url: `/pages/index/index?tab=1&roomId=${roomId}`
50 47
         })
51 48
       })
52 49
     })
53
-
50
+    setTimeout(() => {
51
+      setLoading(false)
52
+    }, 1000)
54 53
   }
55 54
 
56 55
   useEffect(() => {
@@ -80,7 +79,7 @@ export default withLayout((props) => {
80 79
               )
81 80
             })
82 81
           }
83
-          <button className='button-OK' onClick={handleSubmit} >确定</button>
82
+          <button className='button-OK' onClick={handleSubmit} loading={loading} disabled={loading}>确定</button>
84 83
         </scroll-view>
85 84
       </View>
86 85
     </view>