文件
xionggeshop/xgsc.gynhc.com_wx/pages/index/components/sh-wallet.vue
2026-09-14 17:24:53 +08:00

130 行
2.5 KiB
Vue

<template>
<view class="sh-wallet-card brand-card">
<view class="card-head u-flex u-row-between u-col-center">
<view class="head-left u-flex u-col-center">
<view class="section-dot"></view>
<text class="card-title">我的资产</text>
</view>
<view class="head-link u-flex u-col-center" @tap="jump('/pages/user/wallet/index')">
<text>进入钱包</text>
<text class="u-iconfont uicon-arrow-right"></text>
</view>
</view>
<view class="wallet-grid u-flex">
<view
class="wallet-item u-flex-col u-col-center"
v-for="item in walletItems"
:key="item.key"
@tap="jump(item.path)"
>
<text class="wallet-value u-ellipsis-1">{{ item.displayValue }}</text>
<text class="wallet-label">{{ item.label }}</text>
</view>
</view>
</view>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
computed: {
...mapGetters(['userInfo', 'userOtherData']),
walletItems() {
return [{
key: 'money',
label: '余额(元)',
displayValue: this.userInfo.money || '0',
path: '/pages/user/wallet/index'
}, {
key: 'score',
label: '积分',
displayValue: this.userInfo.score || '0',
path: '/pages/user/wallet/score-balance'
}, {
key: 'coupon',
label: '优惠券',
displayValue: this.userOtherData.coupons_num || '0',
path: '/pages/app/coupon/list'
}, {
key: 'wallet',
label: '钱包',
displayValue: '查看',
path: '/pages/user/wallet/index'
}];
}
},
methods: {
jump(path) {
this.$Router.push({ path });
}
}
};
</script>
<style lang="scss">
.sh-wallet-card {
padding: 24rpx 24rpx 28rpx;
}
.card-head {
margin-bottom: 20rpx;
}
.head-left {
min-width: 0;
}
.section-dot {
width: 8rpx;
height: 28rpx;
border-radius: 4rpx;
background: $brand-gold-gradient;
margin-right: 12rpx;
}
.card-title {
font-size: 28rpx;
font-weight: 600;
color: $brand-text;
}
.head-link {
font-size: 24rpx;
color: $brand-text-muted;
.uicon-arrow-right {
font-size: 22rpx;
margin-left: 4rpx;
color: rgba(22, 119, 255, 0.85);
}
}
.wallet-grid {
width: 100%;
background: linear-gradient(180deg, rgba(245, 239, 228, 0.45) 0%, rgba(255, 255, 255, 0) 100%);
border-radius: 16rpx;
padding: 20rpx 8rpx 8rpx;
}
.wallet-item {
flex: 1;
min-width: 0;
}
.wallet-value {
font-size: 32rpx;
font-weight: 700;
color: $brand-gold;
line-height: 1.2;
max-width: 100%;
}
.wallet-label {
margin-top: 10rpx;
font-size: 22rpx;
color: $brand-text-muted;
line-height: 1.3;
}
</style>