Jelajahi Sumber

剩余支付时间

lifanagju_citu 4 bulan lalu
induk
melakukan
22a0df8504
1 mengubah file dengan 3 tambahan dan 3 penghapusan
  1. 3 3
      src/views/mall/components/confirm_order/pay.vue

+ 3 - 3
src/views/mall/components/confirm_order/pay.vue

@@ -345,9 +345,9 @@ const countdown = () => {
     return '支付已过期'
   }
 
-  const seconds = Math.floor((distance / 1000) % 60)
-  const minutes = Math.floor((distance / (1000 * 60)) % 60)
-  const hours = Math.floor((distance / (1000 * 60 * 60)) % 24)
+  const seconds = Math.floor((distance / 1000) % 60).toString().padStart(2, '0')
+  const minutes = Math.floor((distance / (1000 * 60)) % 60).toString().padStart(2, '0')
+  const hours = Math.floor((distance / (1000 * 60 * 60)) % 24).toString().padStart(2, '0')
   // const days = Math.floor(distance / (1000 * 60 * 60 * 24))
 
   countdownText.value = '剩余支付时间: ' + hours + ':' + minutes + ':' + seconds