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

+ 1
- 1
src/components/List/index.jsx Voir le fichier

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

+ 8
- 3
src/hotel/components/shareRoom/ShareRoom.jsx Voir le fichier

19
   const handelEndDate = (e) => {
19
   const handelEndDate = (e) => {
20
     setEndDate(e.detail.value)
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
   const handelShare = () => {
28
   const handelShare = () => {
23
     setLoading(true)
29
     setLoading(true)
24
-    var myDate = new Date();
25
     shareRoom({
30
     shareRoom({
26
       hotelId: room.hotelId,
31
       hotelId: room.hotelId,
27
       personNum: roomNum == '' ? 0 : roomNum,
32
       personNum: roomNum == '' ? 0 : roomNum,
28
       roomId: room.roomId,
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
     }).then((res) => {
36
     }).then((res) => {
32
       onFinish(res)
37
       onFinish(res)
33
       setStartDate('')
38
       setStartDate('')

+ 6
- 7
src/pages/RoomOrder/index.jsx Voir le fichier

26
     formData[inx] = e;
26
     formData[inx] = e;
27
     setFormData([...formData])
27
     setFormData([...formData])
28
   }
28
   }
29
-
29
+  const [loading, setLoading] = useState(false)
30
   const handleSubmit = (e) => {
30
   const handleSubmit = (e) => {
31
-
31
+    setLoading(true)
32
     // 订阅消息
32
     // 订阅消息
33
     withSubscribeMessage([TPL_MESSAGE_HOTEL_CHECK_OUT], () => {
33
     withSubscribeMessage([TPL_MESSAGE_HOTEL_CHECK_OUT], () => {
34
       for (let i = 0, len = formData.length; i < len; i++) {
34
       for (let i = 0, len = formData.length; i < len; i++) {
42
         }
42
         }
43
       }
43
       }
44
       personSubmit(roomOrderId, formData).then(a => {
44
       personSubmit(roomOrderId, formData).then(a => {
45
-        // Taro.navigateBack({
46
-        //   delta: 1
47
-        // })
48
         Taro.reLaunch({
45
         Taro.reLaunch({
49
           url: `/pages/index/index?tab=1&roomId=${roomId}`
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
   useEffect(() => {
55
   useEffect(() => {
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
         </scroll-view>
83
         </scroll-view>
85
       </View>
84
       </View>
86
     </view>
85
     </view>