buddhism/pages/institutionalStructure/donationRecord.vue

416 lines
10 KiB
Vue
Raw Normal View History

2025-07-31 16:16:42 +08:00
<template>
<view class="page">
<custom-navbar title="捐款记录" />
2025-08-01 08:59:07 +08:00
<tile-grid />
2025-07-31 16:16:42 +08:00
<view class="header" :style="{ backgroundColor: CommonEnum.BASE_COLOR }">
2025-07-31 18:01:11 +08:00
<view class="search-filter-row">
<search-box
2025-07-31 17:32:45 +08:00
v-model="searchKeyword"
:width="'100%'"
placeholder="请输入搜索关键词"
btn-text="搜索"
@search="onSearch"
2025-07-31 18:01:11 +08:00
/>
<view class="filter-btn" @click="onFilter">
<image class="filter-icon" :src="CommonEnum.FILTER" mode="aspectFit" />
<text class="filter-text">筛选</text>
</view>
</view>
2025-08-01 10:04:14 +08:00
2025-08-01 10:50:21 +08:00
<!-- 项目描述 -->
<view class="project-info">
<text class="project-title">始建"乾峰寺"(初建)</text>
<text class="project-desc">天王殿为"三门"内第一殿正中供奉弥勒菩萨弥勒菩萨背后供奉韦驮菩萨东西两侧为四大天王面阔五间采用歇 山式重檐建筑装饰剪瓷具有浓厚的南方特色使殿堂显得极其庄严肃穆四大天王像于1981年重塑时采用国家级"非遗"漆线雕工艺装饰此殿于19 25年重修2020年重建</text>
</view>
2025-08-01 10:04:14 +08:00
<!-- 捐款统计区域 -->
2025-08-01 10:50:21 +08:00
<view class="donation-summary" :class="{ 'completed': isCompleted }">
2025-08-01 10:04:14 +08:00
<view class="summary-item">
2025-08-01 10:50:21 +08:00
<text class="summary-label">{{ amountLabel }}</text>
2025-08-01 10:04:14 +08:00
<text class="summary-value">{{ totalAmount.toLocaleString() }}</text>
</view>
<view class="summary-item">
<text class="summary-label">参与捐款人次</text>
<text class="summary-value">{{ participantCount.toLocaleString() }}</text>
</view>
</view>
2025-08-01 10:50:21 +08:00
<!-- &lt;!&ndash; 刷新提示 &ndash;&gt;-->
<!-- <view class="refresh-tip" @click="refreshData">-->
<!-- <text class="tip-text">下列信息实时更新,</text>-->
<!-- <text class="refresh-text">点击刷新</text>-->
<!-- <image class="refresh-icon" :src="CommonEnum.REFRESH" mode="aspectFit" />-->
<!-- </view>-->
2025-08-01 10:04:14 +08:00
<!-- 捐款记录列表 -->
<view class="donation-list">
<view class="list-header">
<text class="header-item">编号</text>
<text class="header-item">姓名</text>
<text class="header-item">捐款金额()</text>
<text class="header-item">捐款时间</text>
</view>
<view class="list-item" v-for="(item, index) in donationList" :key="index">
<text class="item-id">{{ item.id }}</text>
<text class="item-name">{{ item.name }}</text>
<text class="item-amount">{{ item.amount.toLocaleString() }}</text>
<text class="item-time">{{ item.time }}</text>
</view>
</view>
2025-07-31 18:01:11 +08:00
<status-display
v-if="loading"
type="loading"
loading-text="加载中..."
2025-07-31 17:32:45 +08:00
/>
2025-07-31 16:16:42 +08:00
</view>
2025-08-01 10:50:21 +08:00
<!-- 底部固定按钮 -->
<view class="bottom-button" :class="{ 'completed': isCompleted }" @click="handleBottomAction">
<text class="button-text">{{ bottomButtonText }}</text>
</view>
2025-07-31 16:16:42 +08:00
</view>
</template>
<script>
import CustomNavbar from "../../components/custom-navbar/custom-navbar.vue";
import TileGrid from "../../components/tile-grid/tile-grid.vue";
import CommonEnum from "../../enum/common";
import StatusDisplay from "../../components/status-display/status-display.vue";
2025-07-31 17:32:45 +08:00
import SearchBox from "../../components/search-box/search-box.vue";
2025-07-31 16:16:42 +08:00
export default {
components: {
CustomNavbar,
TileGrid,
2025-07-31 17:32:45 +08:00
StatusDisplay,
SearchBox
2025-07-31 16:16:42 +08:00
},
data() {
return {
CommonEnum,
2025-07-31 17:32:45 +08:00
loading: false,
2025-08-01 10:04:14 +08:00
searchKeyword: '',
2025-08-01 10:50:21 +08:00
// 页面状态:'active' 或 'completed'
pageStatus: 'active',
2025-08-01 10:04:14 +08:00
totalAmount: 28040062,
participantCount: 9062,
2025-08-01 10:50:21 +08:00
donationList: []
2025-07-31 16:16:42 +08:00
}
},
2025-08-01 10:50:21 +08:00
computed: {
// 是否已完成募捐
isCompleted() {
return this.pageStatus === 'completed'
},
// 金额标签
amountLabel() {
return this.isCompleted ? '总造价(元)' : '当前筹款金额(元)'
},
// 底部按钮文字
bottomButtonText() {
return this.isCompleted ? '募捐结束' : '我要捐助'
}
},
onLoad(options) {
// 获取页面参数
if (options.status) {
this.pageStatus = options.status
}
2025-07-31 16:16:42 +08:00
// 页面加载时获取数据
this.loadDonationRecords()
},
methods: {
2025-07-31 17:32:45 +08:00
onSearch(val) {
2025-07-31 18:01:11 +08:00
// 搜索逻辑
2025-07-31 17:32:45 +08:00
console.log('搜索内容:', val)
2025-08-01 10:50:21 +08:00
this.loadDonationRecords(val)
2025-07-31 18:01:11 +08:00
},
onFilter() {
// 筛选逻辑
uni.showToast({ title: '筛选功能开发中', icon: 'none' })
2025-07-31 17:32:45 +08:00
},
2025-08-01 10:04:14 +08:00
refreshData() {
// 刷新数据
this.loadDonationRecords()
},
2025-08-01 10:50:21 +08:00
// 处理底部按钮点击
handleBottomAction() {
if (this.isCompleted) {
uni.showToast({
title: '募捐已结束',
icon: 'none'
})
} else {
uni.showToast({
title: '跳转到捐助页面',
icon: 'none'
})
// 这里可以跳转到捐助页面
// uni.navigateTo({ url: '/pages/donation/donate' })
}
},
// 模拟获取捐款记录API
async loadDonationRecords(keyword = '') {
2025-07-31 16:16:42 +08:00
this.loading = true
try {
2025-08-01 10:50:21 +08:00
// 模拟API调用
await new Promise(resolve => setTimeout(resolve, 1000))
// 模拟数据
const mockData = [
{ id: 9, name: '张珊珊', amount: 1000, time: '2025/03/11' },
{ id: 8, name: '张珊珊', amount: 1000, time: '2025/03/09' },
{ id: 7, name: '张珊珊', amount: 1000, time: '2025/03/01' },
{ id: 6, name: '张珊珊', amount: 1000, time: '2025/02/27' },
{ id: 5, name: '张珊珊', amount: 1000, time: '2025/02/27' },
{ id: 4, name: '张珊珊', amount: 1000, time: '2025/02/24' },
{ id: 3, name: '张珊珊', amount: 1000, time: '2025/02/12' },
{ id: 2, name: '张珊珊', amount: 1000, time: '2025/02/08' },
{ id: 1, name: '张珊珊', amount: 1000, time: '2025/02/01' }
]
// 如果有搜索关键词,过滤数据
if (keyword) {
this.donationList = mockData.filter(item =>
item.name.includes(keyword) ||
item.amount.toString().includes(keyword)
)
} else {
this.donationList = mockData
}
2025-07-31 16:16:42 +08:00
} catch (error) {
console.error('获取捐款记录失败:', error)
2025-08-01 10:50:21 +08:00
uni.showToast({
title: '获取数据失败',
icon: 'none'
})
} finally {
2025-07-31 16:16:42 +08:00
this.loading = false
}
}
}
}
</script>
<style lang="scss">
page {
background: #F5F0E7;
}
.header {
width: 100%;
min-height: 100vh;
display: flex;
align-items: flex-start;
flex-direction: column;
2025-08-01 10:50:21 +08:00
padding-bottom: 120rpx; /* 为底部按钮留出空间 */
padding: 0 15rpx 0 15rpx;
2025-07-31 16:16:42 +08:00
}
2025-07-31 18:01:11 +08:00
.search-filter-row {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
2025-08-01 10:04:14 +08:00
margin: 10rpx 0 10rpx 0;
padding: 0 20rpx;
2025-07-31 18:01:11 +08:00
}
.search-filter-row search-box {
flex: 1;
}
.filter-btn {
display: flex;
align-items: center;
2025-08-01 10:04:14 +08:00
margin-left: 20rpx;
padding: 0 16rpx;
2025-07-31 18:01:11 +08:00
height: 70rpx;
border-radius: 10rpx;
cursor: pointer;
}
.filter-icon {
width: 32rpx;
height: 32rpx;
margin-right: 8rpx;
}
.filter-text {
color: #6B4A1B;
font-size: 28rpx;
}
2025-08-01 10:04:14 +08:00
2025-08-01 10:50:21 +08:00
// 项目信息
.project-info {
width: 100%;
padding: 24rpx 20rpx;
margin-bottom: 20rpx;
background: rgba(243,210,162,0);
border-radius: 20rpx 20rpx 20rpx 20rpx;
border: 2rpx solid #F3D2A2;
}
.project-title {
display: block;
font-weight: 500;
font-size: 30rpx;
color: #522510;
line-height: 42rpx;
text-align: left;
font-style: normal;
text-transform: none;
}
.project-desc {
display: block;
font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
font-weight: 400;
font-size: 24rpx;
color: #522510;
line-height: 32rpx;
text-align: left;
font-style: normal;
text-transform: none;
}
.project-desc:last-child {
margin-bottom: 0;
}
2025-08-01 10:04:14 +08:00
// 捐款统计区域
.donation-summary {
width: 100%;
padding: 40rpx 24rpx;
margin-bottom: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
}
2025-08-01 10:50:21 +08:00
.donation-summary.completed {
background: #E8D5B5;
}
2025-08-01 10:04:14 +08:00
.summary-item {
display: flex;
flex-direction: column;
align-items: center;
flex: 1;
position: relative;
}
.summary-item:first-child::after {
content: '';
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
width: 1rpx;
height: 100%;
background: #ffffff;
}
.summary-label {
font-size: 28rpx;
2025-08-01 10:50:21 +08:00
color: #C7A26D;
2025-08-01 10:04:14 +08:00
margin-bottom: 20rpx;
text-align: center;
}
.summary-value {
font-size: 48rpx;
font-weight: bold;
2025-08-01 10:50:21 +08:00
color: #C7A26D;
2025-08-01 10:04:14 +08:00
text-align: center;
}
// 刷新提示
.refresh-tip {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 20rpx;
cursor: pointer;
padding: 16rpx 0;
}
.tip-text {
font-size: 26rpx;
color: #999;
margin-right: 12rpx;
}
.refresh-text {
color: #E74C3C;
font-size: 26rpx;
margin-right: 8rpx;
}
.refresh-icon {
width: 26rpx;
height: 26rpx;
padding-bottom: 1rpx;
}
// 捐款记录列表
.donation-list {
width: 100%;
border-radius: 16rpx;
overflow: hidden;
2025-08-01 10:50:21 +08:00
padding-bottom: 106rpx;
2025-08-01 10:04:14 +08:00
}
.list-header {
display: flex;
2025-08-01 10:50:21 +08:00
padding: 28rpx 15rpx;
2025-08-01 10:04:14 +08:00
}
.header-item {
flex: 1;
font-size: 30rpx;
2025-08-01 10:50:21 +08:00
color: #643B27;
2025-08-01 10:04:14 +08:00
font-weight: bold;
text-align: center;
}
.list-item {
display: flex;
padding: 28rpx 20rpx;
}
.list-item:hover {
background: #FAFAFA;
}
.list-item:last-child {
border-bottom: none;
}
.item-id, .item-name, .item-amount, .item-time {
flex: 1;
font-size: 28rpx;
text-align: center;
line-height: 1.5;
}
.item-id {
color: #666;
font-weight: 500;
}
.item-name {
color: #333;
font-weight: 500;
}
.item-amount {
color: #E74C3C;
font-weight: bold;
}
.item-time {
color: #666;
font-size: 26rpx;
}
2025-08-01 10:50:21 +08:00
// 底部固定按钮
.bottom-button {
position: fixed;
bottom: 22rpx;
left: 34rpx;
right: 34rpx;
height: 84rpx;
background: #C7A26D;
display: flex;
align-items: center;
justify-content: center;
z-index: 999;
border-radius: 30rpx 30rpx 30rpx 30rpx;
}
.bottom-button.completed {
background: #F3D2A2;
}
.button-text {
font-size: 32rpx;
font-weight: bold;
color: #522510;
}
2025-07-31 16:16:42 +08:00
</style>