Pārlūkot izejas kodu

优化带条件的订单查询数据渲染一直loading的问题

cgp 3 dienas atpakaļ
vecāks
revīzija
ce06311dc0
1 mainītis faili ar 6 papildinājumiem un 9 dzēšanām
  1. 6 9
      src/views/his/storeOrder/order1.vue

+ 6 - 9
src/views/his/storeOrder/order1.vue

@@ -1382,15 +1382,9 @@ export default {
           this.payRemainTotal = "0"
           this.payRemainTotal = "0"
           this.productInfo = response.productInfo;
           this.productInfo = response.productInfo;
         }
         }
-        
-        this.loading = false;
-        
-        if(response.msg == 'jnmy'){
-          this.SFDFopen = true;
-        } else{
-          this.SFDFopen = false;
-        }
-        
+
+        this.SFDFopen = false;
+
         // 如果有排序,显示排序结果提示
         // 如果有排序,显示排序结果提示
         if (this.currentSort.prop) {
         if (this.currentSort.prop) {
           const fieldLabel = this.getSortLabel(this.currentSort.prop);
           const fieldLabel = this.getSortLabel(this.currentSort.prop);
@@ -1401,6 +1395,9 @@ export default {
         console.error('查询失败:', error);
         console.error('查询失败:', error);
         this.loading = false;
         this.loading = false;
         this.$message.error('查询数据失败');
         this.$message.error('查询数据失败');
+      }).finally(() => {
+        //无论如何都会执行,确保 loading 关闭
+        this.loading = false;
       });
       });
     },
     },
     // 处理键盘按下事件
     // 处理键盘按下事件