捐款记录静态界面2.0

This commit is contained in:
minimaxagent1 2025-08-01 10:50:21 +08:00
parent 773a1371d3
commit 712460bf5a

View File

@ -17,10 +17,16 @@
</view> </view>
</view> </view>
<!-- 项目描述 -->
<view class="project-info">
<text class="project-title">始建"乾峰寺"(初建)</text>
<text class="project-desc">天王殿为"三门"内第一殿正中供奉弥勒菩萨弥勒菩萨背后供奉韦驮菩萨东西两侧为四大天王面阔五间采用歇 山式重檐建筑装饰剪瓷具有浓厚的南方特色使殿堂显得极其庄严肃穆四大天王像于1981年重塑时采用国家级"非遗"漆线雕工艺装饰此殿于19 25年重修2020年重建</text>
</view>
<!-- 捐款统计区域 --> <!-- 捐款统计区域 -->
<view class="donation-summary"> <view class="donation-summary" :class="{ 'completed': isCompleted }">
<view class="summary-item"> <view class="summary-item">
<text class="summary-label">当前筹款金额()</text> <text class="summary-label">{{ amountLabel }}</text>
<text class="summary-value">{{ totalAmount.toLocaleString() }}</text> <text class="summary-value">{{ totalAmount.toLocaleString() }}</text>
</view> </view>
<view class="summary-item"> <view class="summary-item">
@ -29,12 +35,12 @@
</view> </view>
</view> </view>
<!-- 刷新提示 --> <!-- &lt;!&ndash; 刷新提示 &ndash;&gt;-->
<view class="refresh-tip" @click="refreshData"> <!-- <view class="refresh-tip" @click="refreshData">-->
<text class="tip-text">下列信息实时更新,</text> <!-- <text class="tip-text">下列信息实时更新,</text>-->
<text class="refresh-text">点击刷新</text> <!-- <text class="refresh-text">点击刷新</text>-->
<image class="refresh-icon" :src="CommonEnum.REFRESH" mode="aspectFit" /> <!-- <image class="refresh-icon" :src="CommonEnum.REFRESH" mode="aspectFit" />-->
</view> <!-- </view>-->
<!-- 捐款记录列表 --> <!-- 捐款记录列表 -->
<view class="donation-list"> <view class="donation-list">
@ -58,6 +64,11 @@
loading-text="加载中..." loading-text="加载中..."
/> />
</view> </view>
<!-- 底部固定按钮 -->
<view class="bottom-button" :class="{ 'completed': isCompleted }" @click="handleBottomAction">
<text class="button-text">{{ bottomButtonText }}</text>
</view>
</view> </view>
</template> </template>
@ -80,22 +91,32 @@ export default {
CommonEnum, CommonEnum,
loading: false, loading: false,
searchKeyword: '', searchKeyword: '',
// 'active' 'completed'
pageStatus: 'active',
totalAmount: 28040062, totalAmount: 28040062,
participantCount: 9062, participantCount: 9062,
donationList: [ donationList: []
{ 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' }
]
} }
}, },
onLoad() { computed: {
//
isCompleted() {
return this.pageStatus === 'completed'
},
//
amountLabel() {
return this.isCompleted ? '总造价(元)' : '当前筹款金额(元)'
},
//
bottomButtonText() {
return this.isCompleted ? '募捐结束' : '我要捐助'
}
},
onLoad(options) {
//
if (options.status) {
this.pageStatus = options.status
}
// //
this.loadDonationRecords() this.loadDonationRecords()
}, },
@ -103,6 +124,7 @@ export default {
onSearch(val) { onSearch(val) {
// //
console.log('搜索内容:', val) console.log('搜索内容:', val)
this.loadDonationRecords(val)
}, },
onFilter() { onFilter() {
// //
@ -112,18 +134,59 @@ export default {
// //
this.loadDonationRecords() this.loadDonationRecords()
}, },
// //
async loadDonationRecords() { 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 = '') {
this.loading = true this.loading = true
try { try {
// TODO: API // API
// const response = await getDonationRecords() await new Promise(resolve => setTimeout(resolve, 1000))
//
setTimeout(() => { //
this.loading = false const mockData = [
}, 1000) { 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
}
} catch (error) { } catch (error) {
console.error('获取捐款记录失败:', error) console.error('获取捐款记录失败:', error)
uni.showToast({
title: '获取数据失败',
icon: 'none'
})
} finally {
this.loading = false this.loading = false
} }
} }
@ -141,8 +204,8 @@ page {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
flex-direction: column; flex-direction: column;
padding-bottom: 120rpx; /* 为底部按钮留出空间 */
padding-bottom: 40rpx; padding: 0 15rpx 0 15rpx;
} }
.search-filter-row { .search-filter-row {
width: 100%; width: 100%;
@ -174,10 +237,43 @@ page {
font-size: 28rpx; font-size: 28rpx;
} }
//
.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;
}
// //
.donation-summary { .donation-summary {
width: 100%; width: 100%;
background: #C7A26D;
padding: 40rpx 24rpx; padding: 40rpx 24rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
display: flex; display: flex;
@ -185,6 +281,9 @@ page {
align-items: center; align-items: center;
position: relative; position: relative;
} }
.donation-summary.completed {
background: #E8D5B5;
}
.summary-item { .summary-item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -204,14 +303,14 @@ page {
} }
.summary-label { .summary-label {
font-size: 28rpx; font-size: 28rpx;
color: #ffffff; color: #C7A26D;
margin-bottom: 20rpx; margin-bottom: 20rpx;
text-align: center; text-align: center;
} }
.summary-value { .summary-value {
font-size: 48rpx; font-size: 48rpx;
font-weight: bold; font-weight: bold;
color: #ffffff; color: #C7A26D;
text-align: center; text-align: center;
} }
@ -246,17 +345,16 @@ page {
width: 100%; width: 100%;
border-radius: 16rpx; border-radius: 16rpx;
overflow: hidden; overflow: hidden;
padding-bottom: 106rpx;
} }
.list-header { .list-header {
display: flex; display: flex;
padding: 28rpx 15rpx;
padding: 28rpx 20rpx;
} }
.header-item { .header-item {
flex: 1; flex: 1;
font-size: 30rpx; font-size: 30rpx;
color: #B3B7B5; color: #643B27;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
} }
@ -292,4 +390,27 @@ page {
color: #666; color: #666;
font-size: 26rpx; font-size: 26rpx;
} }
//
.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;
}
</style> </style>