2025-09-29 10:17:17 +08:00

106 lines
4.0 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>
<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>