From 354369fba09283d58fa3f893e9a8956ec44f7eac Mon Sep 17 00:00:00 2001 From: dengj <209192278@qq.com> Date: Mon, 20 Nov 2023 13:54:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=82=93=E6=B4=81=20:=20=E6=89=BE=E5=BA=97?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E4=B8=8B=E6=8B=89=E5=88=B7=E6=96=B0=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/shopAddress/shopAddress.vue | 63 +++++++++++++++++++++++++---- pages/shopTransfer/shopTransfer.vue | 12 +----- 2 files changed, 56 insertions(+), 19 deletions(-) diff --git a/pages/shopAddress/shopAddress.vue b/pages/shopAddress/shopAddress.vue index 7142d05..5476e2f 100644 --- a/pages/shopAddress/shopAddress.vue +++ b/pages/shopAddress/shopAddress.vue @@ -13,7 +13,10 @@ - + + 没有符合条件的数据, 请下拉刷新重置数据~ + + @@ -26,27 +29,65 @@ }, data() { return { - pageSize: 5, + pageSize: 3, pageNum: 1, searchInfoList: [], customQuery: {}, searchListLength: '', + showNull: false, + refresh: false } }, + onPullDownRefresh() { + this.refresh=true + // if (this.showNull = true) { + const q = this.$u.queryParams({ + type: 2, + pageSize: this.pageSize, + pageNum: 1, + }) + // if(this.showNull=true){ + // this.pageNum=1 + // } + this.getShopList(q, "refresh") + + // } + }, onReachBottom() { - if (this.searchListLength !== 0) { + if (!this.refresh&&this.searchListLength !== 0) { this.pageNum++ this.getShopList() console.log("触底加载"); + }else if(this.searchListLength == 0){ + this.pageNum=1 } }, methods: { - getShopList(q){ - let query = this.getQueryInfo(q) + getShopList(q, type){ + let query = {} + if (type == "refresh") { + query = q + } else { + query = this.getQueryInfo(q) + } console.log("listquery",query); this.$api.getShopList(query).then(res => { this.searchListLength = res.data.data.length - this.searchInfoList = [...this.searchInfoList, ...res.data.data] + if (query.includes('business') || query.includes('areatype') || query.includes('sortType') || query + .includes('region')||this.refresh) { + console.log('筛选'); + // this.resetQuery(q) + this.searchInfoList = res.data.data + this.refresh=false + if (res.data.data.length == 0) { + this.showNull = true + } else { + this.showNull = false + } + } else { + console.log('查询'); + this.searchInfoList = [...this.searchInfoList, ...res.data.data] + } console.log(this.searchInfoList); }) }, @@ -58,9 +99,8 @@ pageNum: this.pageNum, ...query }) - this.customQuery = q return q - }, + } }, created() { this.getShopList() @@ -69,6 +109,13 @@