diff --git a/common/js/globalData.js b/common/js/globalData.js index 00f2545..82173e6 100644 --- a/common/js/globalData.js +++ b/common/js/globalData.js @@ -2,7 +2,7 @@ export default { deptId: 101, from: 'customer', initPageNum: 1, - initPageSize: 20, + initPageSize: 1, timeRangeList: [ '08:00-08:30', '08:30-09:00', diff --git a/pages/index/home.vue b/pages/index/home.vue index 41cdca6..e2af360 100644 --- a/pages/index/home.vue +++ b/pages/index/home.vue @@ -122,7 +122,7 @@ this.loadRegionList(); // 加载热门商品 let hotGoodsRes = await this.$request.getHotGoods({ - pageNum: 0, + pageNum: 1, pageSize: 50, status: 0 }); diff --git a/pages/index/worker-home.vue b/pages/index/worker-home.vue index 18f2e37..2b83151 100644 --- a/pages/index/worker-home.vue +++ b/pages/index/worker-home.vue @@ -133,6 +133,7 @@ }, methods: { async loadData() { + this.pageNum = this.$globalData.initPageNum; this.pageSize = this.$globalData.initPageSize; this.loadCategoryList(); await this.loadRegionList(); @@ -140,7 +141,7 @@ this.searchGoods(); }, async reloadData(params = {}) { - this.pageNum = 0; + this.pageNum = this.$globalData.initPageNum; this.workerInfos = []; this.loadWorkerPage(params); }, diff --git a/pages/my/my-order.vue b/pages/my/my-order.vue index a5133b6..c9635d2 100644 --- a/pages/my/my-order.vue +++ b/pages/my/my-order.vue @@ -156,7 +156,7 @@ this.curUserInfo = this.$request.getCurUserInfo(); for(let i = 0; i < this.tabHeaderList.length; i++) { this.pageParams.push({ - pageNum: 0 + pageNum: this.$globalData.initPageNum }); } // 真实对接口的时候使用 @@ -168,7 +168,7 @@ this.pageParams = []; for(let i = 0; i < this.tabHeaderList.length; i++) { this.pageParams.push({ - pageNum: 0 + pageNum: this.$globalData.initPageNum }); } this.myOrders = []; diff --git a/pages/product/filtered-products.vue b/pages/product/filtered-products.vue index 4b12f50..87568c7 100644 --- a/pages/product/filtered-products.vue +++ b/pages/product/filtered-products.vue @@ -167,7 +167,9 @@ this.loadData(); }, methods: { - loadData() { + loadData() { + this.pageNum = this.$globalData.initPageNum; + this.pageSize = this.$globalData.initPageSize; this.loadCategoryList(); this.loadRegionList(); this.loadProductData(); @@ -195,7 +197,7 @@ } }, reloadProductPage() { - this.pageNum = 0; + this.pageNum = this.$globalData.initPageNum; this.pageSize = this.$globalData.initPageSize; this.loadProductData(); }, @@ -204,13 +206,10 @@ // this.productList = shopInfo.productList; let res = await this.$request.qryProductPage(params); let rowsLength = res[1].data.rows.length; - if (rowsLength == 0) { - this.productList = []; - return; - } else if (rowsLength === this.pageSize) { + if (rowsLength === this.pageSize) { this.hasMoreData = true; } - if (this.pageNum === 0) { + if (this.pageNum === this.$globalData.initPageNum) { this.productList = res[1].data.rows; } else { this.productList = this.productList.concat(res[1].data.rows);