Files
integral-shop/single_uniapp22miao/pages/sub-pages/promote-prize/index.vue
panchengyong 786bf78282 更新项目配置和添加小程序模块
- 修改 ArticleController.java
- 更新 application.yml 配置
- 更新 frontend/.env.production 环境配置
- 添加 single_uniapp22miao 小程序模块
- 添加 logs 目录
2026-03-13 13:27:13 +08:00

244 lines
4.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="prize-page">
<!-- 总收益卡片 -->
<view class="total-card">
<view class="label">累计推广收益</view>
<view class="amount">{{ totalIncome }}</view>
</view>
<!-- 收益列表 -->
<scroll-view
scroll-y
class="scroll-view"
@scrolltolower="loadMore"
>
<view class="record-list">
<view
v-for="(item, index) in recordList"
:key="index"
class="record-item"
>
<view class="item-left">
<view class="item-title">{{ item.title }}</view>
<view class="item-desc">来自{{ item.from_user }}</view>
<view class="item-time">{{ item.created_at }}</view>
</view>
<view class="item-right">
<view class="item-amount">+{{ item.amount }}</view>
<view class="item-level">{{ getLevelText(item.level) }}</view>
</view>
</view>
<!-- 加载更多 -->
<view class="load-more" v-if="recordList.length > 0">
<text v-if="loading">加载中...</text>
<text v-else-if="noMore">没有更多了</text>
</view>
<!-- 空状态 -->
<view class="empty-state" v-if="recordList.length === 0 && !loading">
<text class="icon">🎁</text>
<text class="text">暂无推广收益</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
totalIncome: '0.00',
recordList: [],
page: 1,
limit: 20,
loading: false,
noMore: false
}
},
onLoad() {
this.loadTotalIncome();
this.loadRecordList();
},
methods: {
// 加载总收益
async loadTotalIncome() {
try {
const res = await this.$http.get('/api/share/index');
if (res.code === 0) {
this.totalIncome = res.data.stats.total_income || '0.00';
}
} catch (error) {
console.error('加载总收益失败:', error);
}
},
// 加载收益记录
async loadRecordList() {
if (this.loading || this.noMore) return;
this.loading = true;
try {
const res = await this.$http.get('/api/money/list', {
page: this.page,
limit: this.limit,
cate: 3 // 推广收益
});
if (res.code === 0) {
const list = res.data.list || [];
if (list.length < this.limit) {
this.noMore = true;
}
this.recordList = this.page === 1 ? list : [...this.recordList, ...list];
}
} catch (error) {
console.error('加载记录失败:', error);
} finally {
this.loading = false;
}
},
// 加载更多
loadMore() {
if (!this.loading && !this.noMore) {
this.page++;
this.loadRecordList();
}
},
// 获取等级文本
getLevelText(level) {
const levelMap = {
1: '一级收益',
2: '二级收益',
3: '三级收益'
};
return levelMap[level] || '';
}
}
}
</script>
<style lang="scss" scoped>
.prize-page {
height: 100vh;
display: flex;
flex-direction: column;
background-color: #f5f5f5;
}
.total-card {
background: linear-gradient(135deg, #FFD700, #FFA500);
margin: 30rpx;
padding: 60rpx 40rpx;
border-radius: 30rpx;
text-align: center;
color: #fff;
box-shadow: 0 10rpx 40rpx rgba(255, 165, 0, 0.3);
.label {
font-size: 26rpx;
opacity: 0.9;
margin-bottom: 20rpx;
}
.amount {
font-size: 72rpx;
font-weight: bold;
}
}
.scroll-view {
flex: 1;
}
.record-list {
padding: 0 30rpx 30rpx;
}
.record-item {
display: flex;
align-items: flex-start;
justify-content: space-between;
padding: 30rpx;
background-color: #fff;
border-radius: 20rpx;
margin-bottom: 20rpx;
.item-left {
flex: 1;
margin-right: 20rpx;
.item-title {
font-size: 28rpx;
color: #333;
margin-bottom: 10rpx;
}
.item-desc {
font-size: 24rpx;
color: #666;
margin-bottom: 10rpx;
}
.item-time {
font-size: 22rpx;
color: #999;
}
}
.item-right {
text-align: right;
.item-amount {
font-size: 32rpx;
font-weight: bold;
color: #FF4757;
margin-bottom: 10rpx;
}
.item-level {
padding: 4rpx 12rpx;
background-color: #FFF3E0;
color: #FF6B00;
font-size: 20rpx;
border-radius: 10rpx;
display: inline-block;
}
}
}
.load-more {
padding: 30rpx;
text-align: center;
font-size: 26rpx;
color: #999;
}
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 200rpx 0;
.icon {
font-size: 120rpx;
margin-bottom: 20rpx;
}
.text {
font-size: 28rpx;
color: #999;
}
}
</style>