From 230ad793435f4fc65fcafc088151eaeaff07235f Mon Sep 17 00:00:00 2001 From: wangyx <2838268875@qq.com> Date: Fri, 15 Aug 2025 17:57:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9C=8B=E6=88=BF=E4=B8=8A=E6=8B=89=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagesA/kfPage/list.vue | 158 +++++++++++++++++++++-------------------- 1 file changed, 81 insertions(+), 77 deletions(-) diff --git a/pagesA/kfPage/list.vue b/pagesA/kfPage/list.vue index c76166a..708d056 100644 --- a/pagesA/kfPage/list.vue +++ b/pagesA/kfPage/list.vue @@ -24,12 +24,9 @@ scroll-y="true" :lower-threshold="150" @scrolltolower="handleLoadMore" - @scroll="handleScroll" :refresher-enabled="true" :refresher-triggered="refreshing" @refresherrefresh="handleRefresh" - :scroll-top="scrollTop" - :scroll-with-animation="false" :enable-back-to-top="true" > - 加载中... - 没有更多了 + + 加载中... + + + 没有更多数据了 + - + + 暂无预约信息 + { - this.isScrolling = false; - }, 100); - }, + // 上拉加载更多 - handleLoadMore() { - if (this.loading || this.loadingMore || !this.hasMore || this.isScrolling) return; - this.loadingMore = true; - this.loadAppointmentList(); + async handleLoadMore() { + if (!this.hasMore || this.loading) return; + + await this.loadAppointmentList(); }, // 加载预约列表 - loadAppointmentList() { - if (this.loading || this.refreshing || this.loadingMore) { - // 防抖,避免重复请求 - } - // 首屏或非刷新加载时展示整页 loading - if (this.queryParams.pageNum === 1 && !this.refreshing) { - this.loading = true; - } - listViewing(this.queryParams) - .then((response) => { + async loadAppointmentList(isRefresh = false) { + if (this.loading) return; + + this.loading = true; + + try { + const response = await listViewing(this.queryParams); + + if (response.code === 200) { const rows = Array.isArray(response?.rows) ? response.rows : []; - if (this.queryParams.pageNum === 1) { + + if (isRefresh) { this.appointmentList = rows; - } else if (rows.length) { + this.queryParams.pageNum = 1; + } else { this.appointmentList = [...this.appointmentList, ...rows]; } + this.total = Number(response?.total || 0); - // 是否还有更多:优先用返回条数与 pageSize 判断,兼容 total - const pageHasMore = rows.length >= this.queryParams.pageSize; - const totalHasMore = this.appointmentList.length < this.total; - this.hasMore = pageHasMore && (this.total ? totalHasMore : true); - if (this.hasMore) { + + // 判断是否还有更多数据 + if (rows.length < this.queryParams.pageSize) { + this.hasMore = false; + } else { + this.hasMore = true; this.queryParams.pageNum++; } - }) - .catch((err) => { - // 错误时不改变已有列表,仅结束本次加载状态 - }) - .finally(() => { - // 统一收敛状态 - if (this.refreshing) { - uni.stopPullDownRefresh(); - this.refreshing = false; - } - this.loading = false; - this.loadingMore = false; - }); + } + } catch (error) { + console.error("加载预约列表失败:", error); + } finally { + this.loading = false; + this.refreshing = false; + } }, // 搜索预约 - handleSearch(value) { + async handleSearch(value) { this.queryParams.pageNum = 1; - this.loadAppointmentList(); + this.hasMore = true; + await this.loadAppointmentList(true); }, // 清空搜索 - handleClear() { + async handleClear() { this.queryParams = { pageNum: 1, pageSize: 10, telephone: "", }; - this.loadAppointmentList(); + this.hasMore = true; + await this.loadAppointmentList(true); }, // 看房登记 @@ -696,4 +678,26 @@ export default { font-size: 26rpx; padding: 20rpx 0; } + +.loading-more, +.no-more { + text-align: center; + padding: 30rpx; + color: #999; + font-size: 26rpx; +} + +.empty-state { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 100rpx 30rpx; + color: #999; +} + +.empty-text { + font-size: 28rpx; + color: #999; +}