2 Commit-ok 4472042484 ... f5aa64225c

Szerző SHA1 Üzenet Dátum
  liangan f5aa64225c Merge branch 'development' 1 hete
  liangan 64f69f8448 fix: 修复订单详情轮询问题/修改冻结金额列表取参 1 hete
2 módosított fájl, 28 hozzáadás és 4 törlés
  1. 27 3
      src/pages/myOrders/orderDetail.vue
  2. 1 1
      src/pages/wallet/frozenRecord.vue

+ 27 - 3
src/pages/myOrders/orderDetail.vue

@@ -36,6 +36,7 @@ const openRedEnvelopeRate = ref<any>()
 const joinRedEnvelopeRate = ref<any>()
 const countdown = ref('00:00')
 const timer = ref()
+const hasCountdownEnded = ref(false) // 标记倒计时是否已结束并查询过
 
 // DialogBox 函数式调用配置
 const dialogConfig = ref<any>({})
@@ -83,6 +84,9 @@ function startCountdown() {
     return
   }
 
+  // 重置倒计时结束标记
+  hasCountdownEnded.value = false
+
   // 计算过期时间(创建时间 + 20分钟)
   const createTime = new Date(detail.value.createTime).getTime()
   const expireTime = createTime + 20 * 60 * 1000
@@ -94,7 +98,11 @@ function startCountdown() {
     if (diff <= 0) {
       clearInterval(timer.value)
       countdown.value = '00:00'
-      getDetail() // 刷新订单状态
+      // 只在第一次倒计时结束时查询一次
+      if (!hasCountdownEnded.value) {
+        hasCountdownEnded.value = true
+        getDetail() // 刷新订单状态
+      }
       return
     }
 
@@ -104,6 +112,13 @@ function startCountdown() {
   }, 1000)
 }
 
+// 用户主动刷新时调用此函数
+async function handleRefresh() {
+  // 重置倒计时结束标记,允许重新查询
+  hasCountdownEnded.value = false
+  await getDetail()
+}
+
 async function getDetail() {
   try {
     isPageLoading.value = true
@@ -117,12 +132,19 @@ async function getDetail() {
         id.value = detail.value.orderId
       }
       if (detail.value?.status === 1) {
-        startCountdown() // 开始倒计时
+        // 只有在倒计时未结束时才启动倒计时,防止倒计时结束后重复查询
+        if (!hasCountdownEnded.value) {
+          startCountdown() // 开始倒计时
+        }
         // if (isPayOrder.value) {
         //   // 自动调用支付接口
         //   await goPay()
         // }
       }
+      else {
+        // 状态已变化,重置标记
+        hasCountdownEnded.value = false
+      }
       await getPink()
       paging.value.complete()
     }
@@ -297,6 +319,8 @@ onLoad(async (options) => {
 })
 const balance = ref<number>(0)
 onShow(async () => {
+  // 重置倒计时结束标记,允许重新查询
+  hasCountdownEnded.value = false
   await getDetail()
   if (isPayOrder.value && detail.value?.status === 1) {
     const res = await getWalletAccountInfo()
@@ -320,7 +344,7 @@ onUnmounted(() => {
 </script>
 
 <template>
-  <z-paging ref="paging" refresher-only @refresh="getDetail">
+  <z-paging ref="paging" refresher-only @refresh="handleRefresh">
     <!-- 页面加载时显示骨架屏 -->
     <template v-if="isPageLoading">
       <view class="pt-20rpx">

+ 1 - 1
src/pages/wallet/frozenRecord.vue

@@ -50,7 +50,7 @@ onLoad((options) => {
     <view class="py-20rpx">
       <view v-for="item in dataList" :key="item.id" class="bg-white px-22rpx py-18rpx">
         <view class="mb-8rpx flex items-center justify-between">
-          <view>{{ $t('myOrders.order.id') }}: {{ item.id }}</view>
+          <view>{{ $t('myOrders.order.id') }}: {{ item.bizNo }}</view>
           <view>{{ formatNumber(item.freezeAmount) }}</view>
         </view>
         <view class="flex items-center justify-between text-22rpx text-#3A444C">