完成本地生活模块的钱包页面

This commit is contained in:
赵毅 2025-09-29 11:45:37 +08:00
parent 1fbb9bddb8
commit c54b0dd1ad
4 changed files with 433 additions and 28 deletions

View File

@ -40,11 +40,17 @@ image {
margin-right: 16rpx; margin-right: 16rpx;
} }
.content { .content {
margin-top: 30rpx;
height: 1100rpx; height: 1100rpx;
padding: 20rpx; padding: 30rpx;
margin-top: 20rpx;
width: 100%;
box-sizing: border-box;
background-color: #fff;
}
.content2 {
height: 1100rpx;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
@ -604,3 +610,36 @@ image {
margin-top: 30rpx; margin-top: 30rpx;
padding-bottom: 20rpx; padding-bottom: 20rpx;
} }
.walletBox {
flex: 1;
background: linear-gradient(to right, #fbf1db, #f4d7b3);
border-radius: 25rpx;
padding: 30rpx;
margin-bottom: 20rpx;
}
.walletBox_top {
font-size: 32rpx;
color: #222222;
font-weight: 600;
padding-bottom: 20rpx;
position: relative;
}
.walletBox_content{
display: flex;
justify-content: space-between;
}
.walletBox_item{
margin: 20rpx 30rpx;
font-size: 35rpx;
}
.walletBox_item_text{
color: #8d5017;
text-align: center;
font-size: 28rpx;
margin-top: 10rpx;
}

View File

@ -22,7 +22,24 @@
</view> </view>
<view class="content"> <view class="content">
<view class="iconStyle"> <view class="walletBox">
<view class="walletBox_top">钱包</view>
<view class="walletBox_content">
<view class="walletBox_item" @click="goWallet(1)">
<view>999.00</view>
<view class="walletBox_item_text">保证金</view>
</view>
<view class="walletBox_item" @click="goWallet(2)">
<view>999.00</view>
<view class="walletBox_item_text">应收</view>
</view>
<view class="walletBox_item" @click="goWallet(3)">
<view>999.00</view>
<view class="walletBox_item_text">手续费</view>
</view>
</view>
</view>
<view class="iconStyle content2">
<u-grid col="6" :border="false"> <u-grid col="6" :border="false">
<u-grid-item v-for="(item, index) in baseList" :key="index" @click="click(item)"> <u-grid-item v-for="(item, index) in baseList" :key="index" @click="click(item)">
<view class="grid-item"> <view class="grid-item">
@ -117,6 +134,9 @@ export default {
methods: { methods: {
goWallet(type) {
NavgateTo('/packages/storeManagement/wallet/index?type=' + type);
},
changeTab(index) { changeTab(index) {
this.active = index; this.active = index;
}, },

View File

@ -0,0 +1,196 @@
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;
}
.balance-text {
position: absolute;
right: 50rpx;
top: 50%;
transform: translateY(-50%);
width: 150rpx;
height: 70rpx;
border-radius: 20rpx;
border: 1rpx solid #8b4e13;
display: flex;
align-items: center;
justify-content: center;
}
/* 余额变动记录样式 */
.records-container {
margin-top: 30rpx;
padding: 0 40rpx;
background-color: #ffffff;
padding: 25rpx;
}
.tabs {
display: flex;
align-items: center;
height: 100rpx;
box-sizing: border-box;
overflow-x: auto;
white-space: nowrap;
border-bottom: 1rpx solid #EEEEEE;
}
.tabItem {
font-size: 30rpx;
color: #222222;
margin-right: 60rpx;
white-space: nowrap;
}
.active2 {
font-size: 30rpx;
font-weight: 700;
position: relative;
}
.active2::after {
content: '';
background: url(https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_active.png) no-repeat;
background-size: 100% 100%;
width: 52rpx;
height: 22rpx;
position: absolute;
left: 50%;
bottom: -16rpx;
transform: translateX(-50%);
}
.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,150 @@
<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" v-if="topVal != '保证金'">
<image src="http://localhost:8080/user_wallet2.png" mode="widthFix" />
</view>
<view v-else class="balance-text">
去充值
</view>
</view>
</view>
</view>
<!-- 变动记录 -->
<view class="records-container">
<view class="tabs" v-if="topVal == '保证金'">
<view v-for="(item, index) in tabList" :key="index"
:class="['tabItem', selectedTab === item.id ? 'active2' : '']" @click="selectTab(index, item)">
{{ item.tabName }}
</view>
</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" v-if="topVal == '保证金'">
<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 class="record-amount" v-else-if="topVal == '应收'">
<view :class="['amount-sign', record.amount.startsWith('+') ? 'positive' : 'negative']">{{
record.amount.startsWith('+') ? '收款' : '退款' }}</view>
<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>
<view class="record-amount" v-else>
<view class="record-balance">手续费</view>
<view>
<text class="amount-sign">{{ record.amount.startsWith('+') ? '+' : '-' }}</text>
<text class="amount-sign">¥{{ record.amount.replace(/[+-]/, '') }}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { menuButtonInfo, NavgateTo, picUrl, request } from '../../../utils/index';
export default {
data() {
return {
top: "",
localHeight: "",
topVal: "",
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"
}
],
tabList: [
{
id: 0,
tabName: '全部'
},
{
id: 1,
tabName: '充值记录'
},
{
id: 2,
tabName: '消费记录'
}
],
selectedTab: 0
}
},
onLoad(options) {
const meun = menuButtonInfo();
this.top = meun.top;
this.localHeight = meun.height;
this.topVal = options.type == 1 ? '保证金' : (options.type == 2 ? '应收' : '手续费');
this.getWalletInfo();
},
methods: {
back() {
uni.navigateBack({
delta: 1
});
},
selectTab(index, item) {
console.log("🚀 ~ selectTab ~ item:", item)
this.selectedTab = item.id;
},
//
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>