完成个人中心的钱包页面

This commit is contained in:
赵毅 2025-09-29 10:17:17 +08:00
parent 43f35f517a
commit 1fbb9bddb8
4 changed files with 266 additions and 3 deletions

View File

@ -0,0 +1,147 @@
page {
background-color: #f6f7fb;
}
.header {
width: 750rpx;
padding-bottom: 20rpx;
background-color: #ffffff;
}
.searchBox {
display: flex;
align-items: center;
z-index: 2;
}
.searchBox_left {
box-sizing: border-box;
padding-left: 20rpx;
position: absolute;
left: 0;
}
.searchBox_mid {
font-size: 32rpx;
color: #222222;
flex: 1;
text-align: center;
}
/* 余额显示部分样式 */
.balance-container {
width: 93%;
height: 250rpx;
background-color: #ffffff;
margin-bottom: 15rpx;
padding: 25rpx;
}
.balance-content {
height: 100%;
display: flex;
position: relative;
align-items: center;
padding-left: 50rpx;
color: #894b11;
background: linear-gradient(to top right, #f6e2b7, #eab16a);
border-radius: 25rpx;
}
.balance-title {
font-size: 45rpx;
font-weight: 500;
margin-bottom: 20rpx;
}
.balance-amount {
font-size: 70rpx;
font-weight: 500;
}
.balance-icon {
position: absolute;
right: 50rpx;
top: 50%;
transform: translateY(-50%);
width: 200rpx;
height: 200rpx;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: center;
}
.balance-icon image {
width: 200rpx;
height: 200rpx;
}
/* 余额变动记录样式 */
.records-container {
margin-top: 30rpx;
padding: 0 40rpx;
background-color: #ffffff;
padding: 25rpx;
}
.records-title {
font-size: 36rpx;
font-weight: bold;
color: #222222;
margin-bottom: 30rpx;
}
.records-list {
width: 100%;
}
.record-item {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 30rpx 0;
border-bottom: 1rpx solid #EEEEEE;
}
.record-info {
flex: 1;
}
.record-name {
font-size: 32rpx;
color: #222222;
margin-bottom: 10rpx;
}
.record-time {
font-size: 26rpx;
color: #999999;
}
.record-amount {
text-align: right;
}
.amount-sign {
font-size: 28rpx;
}
.amount-value {
font-size: 36rpx;
font-weight: bold;
}
.positive {
color: #51c651;
}
.negative {
color: #FF4444;
}
.record-balance {
font-size: 26rpx;
color: #999999;
margin-top: 10rpx;
}

View File

@ -0,0 +1,106 @@
<template>
<view>
<view class="header">
<view class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }">
<view class="searchBox_left" @click="back">
<u-icon name="arrow-left" size="20px" color="#000"></u-icon>
</view>
<view class="searchBox_mid">{{ topVal }}</view>
</view>
</view>
<!-- 余额显示部分 -->
<view class="balance-container">
<view class="balance-content">
<view>
<view class="balance-title">{{ topVal }}余额</view>
<view class="balance-amount">{{ balance }}</view>
<view class="balance-icon">
<image :src="photoVal" mode="widthFix" />
</view>
</view>
</view>
</view>
<!-- 余额变动记录 -->
<view class="records-container">
<view class="records-title">{{ topVal }}变动记录</view>
<view class="records-list">
<view class="record-item" v-for="(record, index) in records" :key="index">
<view class="record-info">
<view class="record-name">{{ record.name }}</view>
<view class="record-time">{{ record.time }}</view>
</view>
<view class="record-amount">
<view>
<text :class="['amount-sign', record.amount.startsWith('+') ? 'positive' : 'negative']">{{
record.amount.startsWith('+') ? '+' : '-' }}</text>
<text :class="['amount-value', record.amount.startsWith('+') ? 'positive' : 'negative']">¥{{
record.amount.replace(/[+-]/, '') }}</text>
</view>
<view class="record-balance">:¥{{ record.remain }}</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { menuButtonInfo, NavgateTo, picUrl, request } from '../../../utils/index';
export default {
data() {
return {
top: "",
localHeight: "",
topVal: "",
photoVal: '',
balance: "160.80",
records: [
{
name: "退单-1312312317972",
time: "2025-08-12 13:00:00",
amount: "-1808.5",
remain: "286.79"
},
{
name: "退单-1312312317972",
time: "2025-08-12 13:00:00",
amount: "-1808.5",
remain: "286.79"
}
]
}
},
onLoad(options) {
const meun = menuButtonInfo();
this.top = meun.top;
this.localHeight = meun.height;
this.topVal = options.type == 1 ? '积分' : (options.type == 2 ? '物业公积金' : '红包卡券');
this.photoVal = options.type == 1 ? 'http://localhost:8080/user_wallet1.png' : (options.type == 2 ? 'http://localhost:8080/user_wallet2.png' : 'http://localhost:8080/user_wallet3.png');
this.getWalletInfo();
},
methods: {
back() {
uni.navigateBack({
delta: 1
});
},
//
getWalletInfo() {
//
// 使
console.log('获取钱包信息');
//
// request('/api/wallet/info', 'GET').then(res => {
// if (res.code === 0) {
// this.balance = res.data.balance;
// this.records = res.data.records;
// }
// })
}
}
}
</script>
<style>
@import url("./index.css");
</style>

View File

@ -435,6 +435,13 @@
{
"path": "customerService/index",
"style": {}
},
{
"path": "wallet/index",
"style": {
"navigationBarBackgroundColor": "#fff",
"navigationStyle": "custom"
}
}
]
},

View File

@ -24,7 +24,7 @@
</view>
</view>
<view class="section section1">
<view class="section_label">
<view class="section_label" @click="goWallet(1)">
<view>{{ userInfo.property_housing_fund }}</view>
<view>积分</view>
</view>
@ -32,11 +32,11 @@
<view>0.00</view>
<view>繁华币</view>
</view>
<view class="section_label">
<view class="section_label" @click="goWallet(2)">
<view>{{ userInfo.property_housing_fund }}</view>
<view>物业费公积金</view>
</view>
<view class="section_label">
<view class="section_label" @click="goWallet(3)">
<view>0</view>
<view>红包卡券</view>
</view>
@ -267,6 +267,9 @@ export default {
},
methods: {
goWallet(type) {
NavgateTo('/packages/user/wallet/index?type=' + type);
},
//
toLogin() {
NavgateTo('/packages/user/replenishInfo/index');