230 行
6.3 KiB
Vue
230 行
6.3 KiB
Vue
<!-- 账户信息 Bento 资产卡片 -->
|
||
<template>
|
||
<view class="account-card">
|
||
<!-- 头部:标题与查看明细 -->
|
||
<view class="card-header ss-flex ss-row-between ss-col-center">
|
||
<view class="header-left ss-flex ss-col-center">
|
||
<text class="header-title">账户资产</text>
|
||
<button
|
||
class="ss-reset-button eye-btn ss-flex ss-col-center ss-row-center ss-m-l-12"
|
||
@tap="state.showMoney = !state.showMoney"
|
||
>
|
||
<uni-icons
|
||
:type="state.showMoney ? 'eye-filled' : 'eye-slash-filled'"
|
||
color="#A57A55"
|
||
size="18"
|
||
></uni-icons>
|
||
</button>
|
||
</view>
|
||
<view class="header-right ss-flex ss-col-center" @tap="sheep.$router.go('/pages/commission/rewards')">
|
||
<text class="detail-link-text">查看明细</text>
|
||
<uni-icons type="right" size="12" color="#a17545"></uni-icons>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 2x2 Bento 资产指标大盘 -->
|
||
<view class="bento-grid">
|
||
<!-- 第一行 -->
|
||
<view class="grid-row ss-flex">
|
||
<!-- 累计收益 -->
|
||
<view
|
||
class="bento-cell ss-flex-1 ss-flex-col ss-col-center metric-item"
|
||
@tap="sheep.$router.go('/pages/commission/rewards')"
|
||
>
|
||
<view class="item-title">累计收益(元)</view>
|
||
<view class="item-detail text-accent">
|
||
{{ state.showMoney ? agentInfo?.total_income || userInfo?.total_income || '0.00' : '***' }}
|
||
</view>
|
||
</view>
|
||
|
||
<view class="grid-v-divider"></view>
|
||
|
||
<!-- 商城余额 -->
|
||
<view
|
||
class="bento-cell ss-flex-1 ss-flex-col ss-col-center metric-item"
|
||
@tap="sheep.$router.go('/pages/user/wallet/money')"
|
||
>
|
||
<view class="item-title">商城余额(元)</view>
|
||
<view class="item-detail text-dark">
|
||
{{ state.showMoney ? userInfo?.money || '0.00' : '***' }}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="grid-h-divider"></view>
|
||
|
||
<!-- 第二行 -->
|
||
<view class="grid-row ss-flex">
|
||
<!-- dmepa数量 -->
|
||
<view
|
||
class="bento-cell ss-flex-1 ss-flex-col ss-col-center metric-item"
|
||
@tap="sheep.$router.go('/pages/commission/madow')"
|
||
>
|
||
<view class="item-title">dmepa数量</view>
|
||
<view class="item-detail text-primary">
|
||
{{
|
||
state.showMoney
|
||
? formatMadow(agentInfo?.madow || userInfo?.madow)
|
||
: '***'
|
||
}}
|
||
</view>
|
||
</view>
|
||
|
||
<view class="grid-v-divider"></view>
|
||
|
||
<!-- 可用兑换券 -->
|
||
<view
|
||
class="bento-cell ss-flex-1 ss-flex-col ss-col-center metric-item"
|
||
@tap="sheep.$router.go('/pages/commission/voucher')"
|
||
>
|
||
<view class="item-title">可用兑换券(个)</view>
|
||
<view class="item-detail text-amber">
|
||
{{
|
||
state.showMoney
|
||
? formatVoucher(agentInfo?.voucher_available || userInfo?.voucher_available)
|
||
: '***'
|
||
}}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import sheep from '@/sheep';
|
||
import { computed, reactive } from 'vue';
|
||
|
||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||
const agentInfo = computed(() => sheep.$store('user').agentInfo);
|
||
|
||
const state = reactive({
|
||
showMoney: false,
|
||
});
|
||
|
||
function formatMadow(val) {
|
||
if (val === '' || val === null || val === undefined || val === '--') return '0';
|
||
const num = Number(val);
|
||
if (isNaN(num)) return '0';
|
||
return num % 1 === 0 ? String(Math.round(num)) : String(Number(num.toFixed(2)));
|
||
}
|
||
|
||
function formatVoucher(val) {
|
||
if (val === '' || val === null || val === undefined || val === '--') return '0';
|
||
const num = Number(val);
|
||
if (isNaN(num)) return '0';
|
||
return num % 1 === 0 ? String(Math.round(num)) : String(Number(num.toFixed(2)));
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.account-card {
|
||
width: 694rpx;
|
||
margin: 0 auto;
|
||
box-sizing: border-box;
|
||
background: #ffffff;
|
||
border-radius: 20rpx;
|
||
border: 1rpx solid rgba(224, 185, 130, 0.3);
|
||
box-shadow: 0 6rpx 20rpx rgba(105, 46, 4, 0.05);
|
||
z-index: 3;
|
||
position: relative;
|
||
overflow: hidden;
|
||
|
||
.card-header {
|
||
padding: 22rpx 28rpx 18rpx 28rpx;
|
||
background: linear-gradient(180deg, #fffcf6 0%, #ffffff 100%);
|
||
border-bottom: 1rpx solid #f6f0e4;
|
||
|
||
.header-title {
|
||
font-size: 26rpx;
|
||
font-weight: 700;
|
||
color: #522703;
|
||
line-height: 32rpx;
|
||
}
|
||
|
||
.eye-btn {
|
||
width: 44rpx;
|
||
height: 44rpx;
|
||
border-radius: 50%;
|
||
background: rgba(165, 122, 85, 0.08);
|
||
transition: opacity 0.2s;
|
||
|
||
&:active {
|
||
opacity: 0.7;
|
||
}
|
||
}
|
||
|
||
.detail-link-text {
|
||
font-size: 22rpx;
|
||
color: #a17545;
|
||
font-weight: 500;
|
||
margin-right: 4rpx;
|
||
}
|
||
}
|
||
|
||
.bento-grid {
|
||
padding: 10rpx 0;
|
||
|
||
.grid-row {
|
||
width: 100%;
|
||
}
|
||
|
||
.bento-cell {
|
||
padding: 22rpx 20rpx;
|
||
box-sizing: border-box;
|
||
transition: background-color 0.2s;
|
||
|
||
&:active {
|
||
background-color: #faf7f2;
|
||
}
|
||
|
||
.item-title {
|
||
font-size: 22rpx;
|
||
color: #9c7b60;
|
||
line-height: 28rpx;
|
||
margin-bottom: 10rpx;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.item-detail {
|
||
font-size: 38rpx;
|
||
font-family: OPPOSANS, sans-serif;
|
||
font-weight: 700;
|
||
line-height: 44rpx;
|
||
letter-spacing: 0.5rpx;
|
||
|
||
&.text-accent {
|
||
color: #ff6000;
|
||
}
|
||
|
||
&.text-dark {
|
||
color: #222222;
|
||
}
|
||
|
||
&.text-primary {
|
||
color: #692e04;
|
||
}
|
||
|
||
&.text-amber {
|
||
color: #d97706;
|
||
}
|
||
}
|
||
}
|
||
|
||
.grid-v-divider {
|
||
width: 1rpx;
|
||
height: 64rpx;
|
||
background: #f4ecdf;
|
||
align-self: center;
|
||
}
|
||
|
||
.grid-h-divider {
|
||
height: 1rpx;
|
||
width: 638rpx;
|
||
margin: 0 auto;
|
||
background: #f4ecdf;
|
||
}
|
||
}
|
||
}
|
||
</style>
|