修复支持分页查找-姓名

This commit is contained in:
WindowBird 2025-09-17 16:00:22 +08:00
parent 07ca8b76ca
commit be06c06f43
3 changed files with 29 additions and 10 deletions

View File

@ -9,7 +9,7 @@
:width="'100%'"
btn-text="搜索"
placeholder="请输入搜索关键词"
@search="onSearch"
@search="onSearch()"
/>
<view class="filter-btn" @click="show = true">
<image
@ -204,6 +204,11 @@ export default {
this.initData(options.formedId);
}
},
onReachBottom() {
//
this.loadMoreDonationRecords();
},
methods: {
changeSortAmount(order) {
this.filter.sortAmount = order;

View File

@ -61,21 +61,23 @@ export const dataManagerMixin = {
}
try {
console.log("isLoadMore", isLoadMore);
// 更新页码
if (isLoadMore) {
this.pageNum++;
console.log("this.pageNum", this.pageNum);
} else {
this.pageNum = 1;
}
// 构建请求参数
const requestParams = {
pageNum: this.pageNum,
pageSize: this.pageSize,
...this.currentParams,
...params,
pageNum: this.pageNum,
pageSize: this.pageSize,
};
console.log("requestParams", requestParams);
// 调用API
const response = await apiCall(requestParams);
@ -109,8 +111,16 @@ export const dataManagerMixin = {
// 更新状态
this.total = total;
this.hasMore = newData.length === this.pageSize;
this.currentParams = { ...requestParams };
console.log("@@@hasMore", this.hasMore);
this.hasMore =
this.pageSize * this.currentParams.pageNum < this.total;
console.log("this.hasMore", this.hasMore);
console.log("this.total", this.total);
console.log("this.pageSize", this.pageSize);
console.log("this.currentParams.pageNum", this.currentParams.pageNum);
// 成功回调
if (onSuccess) {
@ -178,7 +188,7 @@ export const dataManagerMixin = {
*/
searchData(searchParams = {}, options = {}) {
return this.fetchData({
isLoadMore: false,
// isLoadMore: false,
params: searchParams,
...options,
});

View File

@ -122,7 +122,7 @@ export const donationMixin = {
dataTransformer: this.transformDonationData,
params: baseParams,
dataPath: "data.list.rows",
totalPath: "data.total",
totalPath: "data.list.total",
onSuccess: (data, response) => {
console.log("捐款记录加载成功:", data.length, "条");
},
@ -137,14 +137,18 @@ export const donationMixin = {
* @param {string} val 搜索关键词
*/
async onSearch(val) {
console.log("@@@@@@@@@@val", val);
this.searchKeyword = val;
console.log("@@@@@@@@@@", this.searchKeyword);
await this.searchData(
{ ...this.getBaseParams(), realName: val },
{ ...this.getBaseParams(), realName: val.trim() },
{
apiCall: getDonorList,
dataTransformer: this.transformDonationData,
dataPath: "data.list.rows",
totalPath: "data.total",
totalPath: "data.list.total",
onSuccess: (data, response) => {
console.log("搜索完成,找到:", data.length, "条记录");
},
@ -167,7 +171,7 @@ export const donationMixin = {
dataTransformer: this.transformDonationData,
params: currentParams,
dataPath: "data.list.rows",
totalPath: "data.total",
totalPath: "data.list.total",
onSuccess: (data, response) => {
console.log("加载更多完成,新增:", data.length, "条记录");
},