Browse Source

优化首页订单搜索加载状态

yuhao 2 years ago
parent
commit
9adc008d15
1 changed files with 15 additions and 5 deletions
  1. 15 5
      src/pages/home/index.vue

+ 15 - 5
src/pages/home/index.vue

@@ -118,7 +118,7 @@
118
           />
118
           />
119
         </div>
119
         </div>
120
       </div>
120
       </div>
121
-      <div class="list-info">
121
+      <div v-loading="searchLoading" class="list-info">
122
         <van-list
122
         <van-list
123
           v-model="loading"
123
           v-model="loading"
124
           :finished="finished"
124
           :finished="finished"
@@ -193,7 +193,7 @@ import api from "@/server/home";
193
 import vanList from "vant/lib/list";
193
 import vanList from "vant/lib/list";
194
 import minePupop from "../../components/minePupop/index.vue";
194
 import minePupop from "../../components/minePupop/index.vue";
195
 import "vant/lib/list/style";
195
 import "vant/lib/list/style";
196
-import { log } from 'console';
196
+import { log } from "console";
197
 export default {
197
 export default {
198
   data() {
198
   data() {
199
     return {
199
     return {
@@ -229,6 +229,7 @@ export default {
229
       goodsCode: "", //美妆核销码
229
       goodsCode: "", //美妆核销码
230
       goodsList: "", //美妆核销信息
230
       goodsList: "", //美妆核销信息
231
       orderKeyWord: "", //订单搜索关键字
231
       orderKeyWord: "", //订单搜索关键字
232
+      searchLoading: false, //订单搜索加载
232
     };
233
     };
233
   },
234
   },
234
   components: {
235
   components: {
@@ -248,7 +249,7 @@ export default {
248
     // 美妆产品核销
249
     // 美妆产品核销
249
     goodsPickUp() {
250
     goodsPickUp() {
250
       api.goodsPickUp({ code: this.goodsCode }).then((res) => {
251
       api.goodsPickUp({ code: this.goodsCode }).then((res) => {
251
-        if(res.code==200){
252
+        if (res.code == 200) {
252
           this.goodsList = res.data;
253
           this.goodsList = res.data;
253
           this.isGoodsPanel = true;
254
           this.isGoodsPanel = true;
254
         }
255
         }
@@ -350,7 +351,10 @@ export default {
350
           let date = new Date();
351
           let date = new Date();
351
           this.date = date.getMonth() + 1 + "月" + date.getDate() + "日";
352
           this.date = date.getMonth() + 1 + "月" + date.getDate() + "日";
352
           // 订单总数
353
           // 订单总数
353
-          this.totalSum = Number(res.data.order_num)+Number(res.data.wait_pay_num)+Number(res.data.cancel_num)
354
+          this.totalSum =
355
+            Number(res.data.order_num) +
356
+            Number(res.data.wait_pay_num) +
357
+            Number(res.data.cancel_num);
354
         }
358
         }
355
       });
359
       });
356
     },
360
     },
@@ -361,10 +365,11 @@ export default {
361
       this.loading = true;
365
       this.loading = true;
362
       this.finished = false;
366
       this.finished = false;
363
       this.page = 1;
367
       this.page = 1;
364
-      this.getToday()
368
+      this.getToday();
365
     },
369
     },
366
     //搜索订单
370
     //搜索订单
367
     searchOrder() {
371
     searchOrder() {
372
+      this.searchLoading = true;
368
       setTimeout(() => {
373
       setTimeout(() => {
369
         api
374
         api
370
           .getToday({
375
           .getToday({
@@ -376,6 +381,7 @@ export default {
376
           .then((res) => {
381
           .then((res) => {
377
             if ((res.code = 200)) {
382
             if ((res.code = 200)) {
378
               this.orderList = res.data.list;
383
               this.orderList = res.data.list;
384
+              this.searchLoading = false;
379
             }
385
             }
380
           });
386
           });
381
       }, 1000);
387
       }, 1000);
@@ -904,4 +910,8 @@ export default {
904
 .color-3 {
910
 .color-3 {
905
   color: #fc3019 !important;
911
   color: #fc3019 !important;
906
 }
912
 }
913
+// 加载中修改颜色
914
+/deep/.el-loading-spinner .path {
915
+  stroke: #fa7d22;
916
+}
907
 </style>
917
 </style>