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

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

View File

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

View File

@ -18,6 +18,15 @@ export const donationMixin = {
searchKeyword: "",
// 项目ID
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}`;
},
/**
* 获取基础查询参数
*/
getBaseParams() {
return {
formedId: this.formedId,
minAmount: 1,
maxAmount: 10000,
sortAmount: "amount",
orderAmount: "asc",
sortTime: "time",
orderTime: "desc",
};
},
/**
* 获取捐款记录
* @param {string} keyword 搜索关键词
*/
async loadDonationRecords(keyword = "") {
const baseParams = this.getBaseParams();
const baseParams = { ...this.getBaseParams, formedId: this.formedId };
// 如果有搜索关键词,添加姓名搜索
if (keyword) {
@ -137,13 +131,17 @@ export const donationMixin = {
* @param {string} val 搜索关键词
*/
async onSearch(val) {
console.log("@@@@@@@@@@val", val);
console.log("val", val);
this.searchKeyword = val;
console.log("@@@@@@@@@@", this.searchKeyword);
console.log("this.searchKeyword", this.searchKeyword);
await this.searchData(
{ ...this.getBaseParams(), realName: val.trim() },
{
...this.getBaseParams,
formedId: this.formedId,
realName: val.trim(),
},
{
apiCall: getDonorList,
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, "条记录");
},
},
);
},
/**
* 加载更多捐款记录