修复支持分页查找-时间金额筛选

This commit is contained in:
WindowBird 2025-09-17 16:45:01 +08:00
parent be06c06f43
commit 41cae0db07
3 changed files with 59 additions and 36 deletions

View File

@ -55,18 +55,18 @@
<view <view
:class="[ :class="[
'custom-radio-button', 'custom-radio-button',
filter.sortAmount === 'desc' ? 'checked' : '', filter.orderAmount === 'desc' ? 'checked' : '',
]" ]"
@click="changeSortAmount('desc')" @click="changeorderAmount('desc')"
> >
由高到低 由高到低
</view> </view>
<view <view
:class="[ :class="[
'custom-radio-button', 'custom-radio-button',
filter.sortAmount === 'asc' ? 'checked' : '', filter.orderAmount === 'asc' ? 'checked' : '',
]" ]"
@click="changeSortAmount('asc')" @click="changeorderAmount('asc')"
> >
由低到高 由低到高
</view> </view>
@ -76,18 +76,18 @@
<view <view
:class="[ :class="[
'custom-radio-button', 'custom-radio-button',
filter.sortTime === 'desc' ? 'checked' : '', filter.orderTime === 'desc' ? 'checked' : '',
]" ]"
@click="changeSortTime('desc')" @click="changeorderTime('desc')"
> >
由远及近 由远及近
</view> </view>
<view <view
:class="[ :class="[
'custom-radio-button', 'custom-radio-button',
filter.sortTime === 'asc' ? 'checked' : '', filter.orderTime === 'asc' ? 'checked' : '',
]" ]"
@click="changeSortTime('asc')" @click="changeorderTime('asc')"
> >
由近及远 由近及远
</view> </view>
@ -138,7 +138,7 @@
<view class="reset"> <view class="reset">
<text>清空选择</text> <text>清空选择</text>
</view> </view>
<view class="confirm"> <view class="confirm" @click="filterSearch(filter)">
<text>确定</text> <text>确定</text>
</view> </view>
</view> </view>
@ -191,8 +191,10 @@ export default {
filter: { filter: {
minAmount: "", minAmount: "",
maxAmount: "", maxAmount: "",
sortAmount: "desc", orderAmount: "desc",
sortTime: "desc", orderTime: "desc",
sortAmount: "amount",
sortTime: "time",
}, },
CommonEnum, CommonEnum,
@ -210,13 +212,13 @@ export default {
this.loadMoreDonationRecords(); this.loadMoreDonationRecords();
}, },
methods: { methods: {
changeSortAmount(order) { changeorderAmount(order) {
this.filter.sortAmount = order; this.filter.orderAmount = order;
console.log("当前选择的排序方式:", order); console.log("当前选择的排序方式:", order);
// //
}, },
changeSortTime(order) { changeorderTime(order) {
this.filter.sortTime = order; this.filter.orderTime = order;
console.log("当前选择的排序方式:", order); console.log("当前选择的排序方式:", order);
// //
}, },

View File

@ -41,13 +41,13 @@ export const dataManagerMixin = {
isLoadMore = false, isLoadMore = false,
apiCall, apiCall,
dataTransformer, dataTransformer,
params = {},
dataPath = "rows", dataPath = "rows",
totalPath = "total", totalPath = "total",
onSuccess, onSuccess,
onError, onError,
showLoading = true, showLoading = true,
showError = true, showError = true,
params = {},
} = options; } = options;
if (!apiCall) { if (!apiCall) {
@ -189,8 +189,9 @@ export const dataManagerMixin = {
searchData(searchParams = {}, options = {}) { searchData(searchParams = {}, options = {}) {
return this.fetchData({ return this.fetchData({
// isLoadMore: false, // isLoadMore: false,
params: searchParams,
...options, ...options,
params: searchParams,
}); });
}, },

View File

@ -18,6 +18,15 @@ export const donationMixin = {
searchKeyword: "", searchKeyword: "",
// 项目ID // 项目ID
formedId: "", formedId: "",
getBaseParams: {
minAmount: 0,
maxAmount: 10000,
sortAmount: "amount",
orderAmount: "asc",
sortTime: "time",
orderTime: "desc",
},
}; };
}, },
@ -90,27 +99,12 @@ export const donationMixin = {
return `${year}/${month}/${day}`; return `${year}/${month}/${day}`;
}, },
/**
* 获取基础查询参数
*/
getBaseParams() {
return {
formedId: this.formedId,
minAmount: 1,
maxAmount: 10000,
sortAmount: "amount",
orderAmount: "asc",
sortTime: "time",
orderTime: "desc",
};
},
/** /**
* 获取捐款记录 * 获取捐款记录
* @param {string} keyword 搜索关键词 * @param {string} keyword 搜索关键词
*/ */
async loadDonationRecords(keyword = "") { async loadDonationRecords(keyword = "") {
const baseParams = this.getBaseParams(); const baseParams = { ...this.getBaseParams, formedId: this.formedId };
// 如果有搜索关键词,添加姓名搜索 // 如果有搜索关键词,添加姓名搜索
if (keyword) { if (keyword) {
@ -137,13 +131,17 @@ export const donationMixin = {
* @param {string} val 搜索关键词 * @param {string} val 搜索关键词
*/ */
async onSearch(val) { async onSearch(val) {
console.log("@@@@@@@@@@val", val); console.log("val", val);
this.searchKeyword = val; this.searchKeyword = val;
console.log("@@@@@@@@@@", this.searchKeyword); console.log("this.searchKeyword", this.searchKeyword);
await this.searchData( await this.searchData(
{ ...this.getBaseParams(), realName: val.trim() }, {
...this.getBaseParams,
formedId: this.formedId,
realName: val.trim(),
},
{ {
apiCall: getDonorList, apiCall: getDonorList,
dataTransformer: this.transformDonationData, dataTransformer: this.transformDonationData,
@ -159,6 +157,28 @@ export const donationMixin = {
/** /**
* 筛选功能 * 筛选功能
*/ */
async filterSearch(params) {
this.getBaseParams = params;
console.log("this.searchKeyword", this.searchKeyword);
await this.searchData(
{
...this.getBaseParams,
formedId: this.formedId,
realName: this.searchKeyword.trim(),
},
{
apiCall: getDonorList,
dataTransformer: this.transformDonationData,
dataPath: "data.list.rows",
totalPath: "data.list.total",
onSuccess: (data, response) => {
console.log("搜索完成,找到:", data.length, "条记录");
},
},
);
},
/** /**
* 加载更多捐款记录 * 加载更多捐款记录