From 41cae0db072a3eea0c9fc5ec106fc882e4422e9e Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Wed, 17 Sep 2025 16:45:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=94=AF=E6=8C=81=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E6=9F=A5=E6=89=BE-=E6=97=B6=E9=97=B4=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../institutionalStructure/donationRecord.vue | 32 +++++----- .../mixins/data-manager.js | 5 +- .../mixins/donation-mixin.js | 58 +++++++++++++------ 3 files changed, 59 insertions(+), 36 deletions(-) diff --git a/pages/institutionalStructure/donationRecord.vue b/pages/institutionalStructure/donationRecord.vue index 017eb82..a32b480 100644 --- a/pages/institutionalStructure/donationRecord.vue +++ b/pages/institutionalStructure/donationRecord.vue @@ -55,18 +55,18 @@ 由高到低 由低到高 @@ -76,18 +76,18 @@ 由远及近 由近及远 @@ -138,7 +138,7 @@ 清空选择 - + 确定 @@ -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); // 触发排序操作 }, diff --git a/pages/institutionalStructure/mixins/data-manager.js b/pages/institutionalStructure/mixins/data-manager.js index 22a5db3..69a22fe 100644 --- a/pages/institutionalStructure/mixins/data-manager.js +++ b/pages/institutionalStructure/mixins/data-manager.js @@ -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, }); }, diff --git a/pages/institutionalStructure/mixins/donation-mixin.js b/pages/institutionalStructure/mixins/donation-mixin.js index 37321fd..a83c6ad 100644 --- a/pages/institutionalStructure/mixins/donation-mixin.js +++ b/pages/institutionalStructure/mixins/donation-mixin.js @@ -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, "条记录"); + }, + }, + ); + }, /** * 加载更多捐款记录