祈福记录-实现筛选功能

This commit is contained in:
WindowBird 2025-09-23 14:16:29 +08:00
parent f5bf135827
commit 6d5c51a0cd
2 changed files with 171 additions and 3 deletions

View File

@ -2,6 +2,27 @@
<view class="page"> <view class="page">
<base-background /> <base-background />
<custom-navbar ref="customNavbar" title="祈福记录" /> <custom-navbar ref="customNavbar" title="祈福记录" />
<view class="search-filter-row">
<search-box
v-model="filterOptions.name"
:width="'100%'"
btn-text="搜索"
placeholder="请输入搜索关键词"
@search="onSearch()"
/>
<view class="filter-btn" @click="show = true">
<image :src="CommonEnum.FILTER" class="filter-icon" mode="aspectFit" />
<text class="filter-text">筛选</text>
</view>
</view>
<view
v-if="filterOptions.isOthers || filterOptions.type"
class="filter-tips"
>
{{ filterOptions.isOthers | prayerIsOthersFilter
}}{{ filterOptions.type | prayerTypeFilter }}
</view>
<view class="header"> <view class="header">
<template> <template>
<view class="blessing-container"> <view class="blessing-container">
@ -57,6 +78,42 @@
</view> </view>
</template> </template>
</view> </view>
<template>
<u-select
v-model="show"
:list="list"
confirm-color="#BFA16B"
confirm-text="筛选"
mode="mutil-column"
@confirm="confirm"
></u-select>
</template>
<!-- <u-popup-->
<!-- v-model="show"-->
<!-- border-radius="30"-->
<!-- height="880rpx"-->
<!-- mode="bottom"-->
<!-- width="750rpx"-->
<!-- z-index="9999"-->
<!-- >-->
<!-- <view style="flex-direction: column; display: flex">-->
<!-- <view-->
<!-- style="-->
<!-- display: flex;-->
<!-- justify-content: space-around;-->
<!-- align-items: center;-->
<!-- "-->
<!-- >-->
<!-- <text> 是否为他人祈福</text>-->
<!-- <u-switch-->
<!-- v-model="filterOptions.isOthers"-->
<!-- activeColor="#C7A26D"-->
<!-- ></u-switch>-->
<!-- </view>-->
<!-- </view>-->
<!-- &lt;!&ndash; methods &ndash;&gt;-->
<!-- </u-popup>-->
<!-- 捐赠弹窗 --> <!-- 捐赠弹窗 -->
</view> </view>
@ -66,15 +123,49 @@
import { createPagination } from "../../composables/winB_Pagination"; import { createPagination } from "../../composables/winB_Pagination";
import { getUserPrayerList } from "../../api/pray/pray"; import { getUserPrayerList } from "../../api/pray/pray";
import CommonEnum from "../../enum/common"; import CommonEnum from "../../enum/common";
import SearchBox from "../../components/search-box/search-box.vue";
export default { export default {
components: { SearchBox },
computed: { computed: {
CommonEnum() { CommonEnum() {
return CommonEnum; return CommonEnum;
}, },
}, },
data() { data() {
return {}; return {
show: false,
show1: false,
filterOptions: {
isOthers: "",
type: "",
name: "",
},
list: [
[
{
value: "0",
label: "所有",
},
{
value: "1",
label: "为他人",
},
{
value: "2",
label: "为自己",
},
],
[
{ value: 0, label: "所有" },
{ value: 1, label: "学业" },
{ value: 2, label: "健康" },
{ value: 3, label: "姻缘" },
{ value: 4, label: "财运" },
{ value: 5, label: "消灾" },
],
],
};
}, },
filters: { filters: {
prayerTypeFilter(value) { prayerTypeFilter(value) {
@ -85,9 +176,17 @@ export default {
4: "财运", 4: "财运",
5: "消灾", 5: "消灾",
}; };
return types[value] || "其他"; return types[value] || "";
},
prayerIsOthersFilter(value) {
const types = {
1: "为他人",
2: "为自己",
};
return types[value] || "";
}, },
}, },
mixins: [ mixins: [
createPagination({ createPagination({
fetchData: getUserPrayerList, fetchData: getUserPrayerList,
@ -101,6 +200,25 @@ export default {
this.winB_GetList(); this.winB_GetList();
}, },
methods: { methods: {
onSearch() {
this.winB_UpdateParams(this.filterOptions);
},
//
confirm(e) {
if (e[0].value === "0") {
this.filterOptions.isOthers = "";
} else {
this.filterOptions.isOthers = e[0].value;
}
if (e[1].value === 0) {
this.filterOptions.type = "";
} else {
this.filterOptions.type = e[1].value;
}
this.onSearch();
},
// //
async loadPageData() { async loadPageData() {
this.loading = true; this.loading = true;
@ -130,6 +248,8 @@ page {
} }
.page { .page {
display: flex;
flex-direction: column;
position: relative; position: relative;
width: 100%; width: 100%;
min-height: 100vh; min-height: 100vh;
@ -144,6 +264,19 @@ page {
padding: 0 15rpx; padding: 0 15rpx;
} }
.filter-tips {
justify-content: center;
display: flex;
width: 680rpx;
margin: 0 auto;
background-color: #8b4513; //
color: #fff;
font-size: 28rpx;
font-weight: 500;
padding: 8rpx 20rpx;
border-radius: 6rpx;
}
.blessing-container { .blessing-container {
padding: 30rpx; padding: 30rpx;
//background-color: #faf8f5; // //background-color: #faf8f5; //
@ -328,4 +461,38 @@ page {
background-color: #555 !important; background-color: #555 !important;
} }
} }
.search-filter-row {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
margin: 10rpx 0 10rpx 0;
padding: 0 35rpx;
.search-filter-row search-box {
flex: 1;
}
.filter-btn {
display: flex;
align-items: center;
margin-left: 20rpx;
//padding: 0 16rpx;
height: 70rpx;
border-radius: 10rpx;
cursor: pointer;
.filter-icon {
width: 32rpx;
height: 32rpx;
margin-right: 8rpx;
}
.filter-text {
color: #6b4a1b;
font-size: 28rpx;
}
}
}
</style> </style>

View File

@ -6,8 +6,9 @@ import debounce from "uview-ui/libs/function/debounce";
const ENV_CONFIG = { const ENV_CONFIG = {
release: { release: {
// 正式版 // 正式版
baseUrl: "http://192.168.2.158:4501", // baseUrl: "http://192.168.2.158:4501",
// baseUrl: "https://tech-ape.top/prod-api", // baseUrl: "https://tech-ape.top/prod-api",
baseUrl: "https://tech-ape.top/prod-api",
appId: 1, appId: 1,
}, },
}; };