Commit c779c57a authored by 李驰骋's avatar 李驰骋

票账管理页面调整

parent b4df8231
......@@ -31,7 +31,7 @@
</view>
</view>
</view>
<view class="text-block" v-if="condition.option === 'BT'">
<view class="text-block" v-if="condition.option === 'BT'" key="start-date">
<text class="middle-date">开始日期</text>
<view class="middle-date-des">
<view class="picker-year">
......@@ -47,7 +47,7 @@
</view>
</view>
</view>
<view class="text-block text-block-last" v-if="condition.option === 'BT'">
<view class="text-block text-block-last" v-if="condition.option === 'BT'" key="end-date">
<text class="middle-date">结束日期</text>
<view class="middle-date-des">
<view class="picker-year">
......@@ -69,9 +69,7 @@
<text class="btn-text">查询</text>
</button>
</view>
<scroll-view :style='scrollHeight' class="scroll-area" scroll-y="true" lower-threshold='150'
@scrolltolower='scrolltolower'>
<list class="scroll-area view" loadmoreoffset='100' show-scrollbar='false' @loadmore="scrolltolower">
<list class="scroll-area view" scrollable loadmoreoffset='100' show-scrollbar='false' @loadmore="scrolltolower">
<cell class="list-cell" v-for="(item,index) in lists" :key='index'>
<view class="middle view planout-block-item">
<view class="text-block">
......@@ -99,14 +97,15 @@
</cell>
<cell>
<view class="loading-more" v-if='lists.length>0'>
<text class="loading-more-text">-- 到底了 --</text>
<text class="loading-more-text" v-if="lists.length >= page.totalCount && page.totalCount > 0">-- 到底了 --</text>
<text class="loading-more-text" v-else-if="isLoading">加载中...</text>
<text class="loading-more-text" v-else>上拉加载更多</text>
</view>
<view class="loading-more" v-else>
<text class="loading-more-text">暂无数据</text>
</view>
</cell>
</list>
</scroll-view>
</view>
</view>
......@@ -129,6 +128,7 @@
loadingText: '加载中...',
refreshing: false,
isOpened: 'none',
isLoading: false, // 添加加载状态,防止重复请求
// 日期查询选项:是、介于、小于等于、大于等于
dateOptions: [
{ label: '是', value: 'EQ' },
......@@ -162,11 +162,6 @@
'height': `${this.sysinfo.safeArea.height }px`,
}
},
scrollHeight() {
return {
'height': `${this.sysinfo.safeArea.height - 180 - 44}px`,
}
},
...mapState(['sysinfo', 'userInfo', 'userBpData'])
},
created() {
......@@ -194,16 +189,28 @@
search() {
this.lists = [];
this.page.page = 1;
this.page.totalCount = 0; // 重置总数
this.queryData(1);
},
scrolltolower() {
if (this.lists.length >= this.page.totalCount) {
// 防止重复请求
if (this.isLoading) {
return;
}
// 判断是否已加载完所有数据
if (this.lists.length >= this.page.totalCount && this.page.totalCount > 0) {
return;
}
this.page.page++;
this.queryData(this.page.page);
},
async queryData(pageNo) {
// 防止重复请求
if (this.isLoading) {
return;
}
this.isLoading = true;
// 构建查询条件对象,与PC端格式保持一致
const allConditions = {}
......@@ -254,22 +261,41 @@
...allConditions,
page: pageNo,
pagesize: this.page.pagesize,
totalCount: this.page.totalCount,
totalCount: pageNo === 1 ? 0 : this.page.totalCount, // 第一页时重置totalCount
is_result: 1,
sort: []
}
try {
if (pageNo === 1) {
uni.showLoading({
title: '加载中'
});
}
const res = await apiGetMarketSupportFee(params);
if (pageNo === 1) {
uni.hideLoading();
}
if (res && res.data) {
if (pageNo === 1) {
this.lists = res.data || [];
} else {
this.lists = this.lists.concat(res.data || []);
}
this.page.totalCount = res?.TOTALCOUNT || res?.totalCount || res?.Total || this.page.totalCount;
// 更新总数,优先使用后端返回的总数
const totalCount = res?.TOTALCOUNT || res?.totalCount || res?.Total || 0;
if (totalCount > 0) {
this.page.totalCount = totalCount;
}
}
} catch (error) {
console.error('查询失败', error);
if (pageNo === 1) {
uni.hideLoading();
}
} finally {
this.isLoading = false;
}
}
}
......@@ -315,8 +341,10 @@
.main {
position: relative;
flex-direction: column;
flex: 1;
margin-top: -164rpx;
padding: 0 16rpx;
min-height: 0;
}
.middle {
......@@ -475,7 +503,7 @@
}
.scroll-area {
overflow-y: scroll;
flex: 1;
}
.list-cell {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment