修复支持分页查找-姓名
This commit is contained in:
parent
07ca8b76ca
commit
be06c06f43
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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, "条记录");
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user