chenrui 4 лет назад
Родитель
Сommit
7f6269e467
1 измененных файлов с 13 добавлено и 5 удалено
  1. 13 5
      src/pages/pagesA/usageRecord/index.vue

+ 13 - 5
src/pages/pagesA/usageRecord/index.vue

@@ -30,7 +30,8 @@ export default {
       pageNo: 1,  //  页码
       pageSize: 20,  //  每页多少条
       isLastPage: false,  //  是否最后一页
-      billNo: ''  //  订单编号
+      billNo: '',  //  订单编号
+      doneLoading: false  //  数据请求反馈状态
     };
   },
   methods: {
@@ -40,7 +41,12 @@ export default {
         mask: true,
         title: '加载中'
       })
+      if(_this.doneLoading){  //  防止多次请求同一页的数据
+        return
+      }
+      _this.doneLoading = true
       queryByOrderList({billNo: _this.billNo, pageNo: _this.pageNo, pageSize: _this.pageSize}).then(res => {
+        _this.doneLoading = false
         wx.hideLoading()
         if(res.status == 200){
           res.data.list.map(item => {
@@ -54,10 +60,14 @@ export default {
           if(_this.listData.length>=res.data.count){
             if(_this.pageNo!=1){
               wx.showToast({
+                icon: 'none',
                 title: '已经是最后一页'
               })
             }
             _this.isLastPage = true
+          }else{
+            _this.isLastPage = false
+            _this.pageNo++
           }
         }
       })
@@ -65,19 +75,17 @@ export default {
     // 监听用户上拉触底事件
     scrolltolower() {
     	if(!this.isLastPage){
-    		this.pageNo = this.pageNo + 1
     		this.getList()
     	}
     }
   },
-  onShow() {
-
-  },
+  onShow() {},
   onLoad(options){
     this.billNo = options.billNo
     this.pageNo = 1
     this.listData = []
     this.isLastPage = false
+    this.doneLoading = false
     this.getList()
   }
 };