Files
property-manager-side/wuye-manager-uniapp/pageSubPack/statistics/components/DepositCard.vue
2026-08-07 16:36:05 +08:00

110 lines
2.5 KiB
Vue

<template>
<view class="deposit-card">
<view class="deposit-card-header">
<text class="deposit-title">押金余额统计</text>
<text class="deposit-balance">余额合计{{ depositBalance }}元</text>
</view>
<view class="deposit-chart">
<qiun-data-charts type="column" :chartData="depositColumnData" :opts="depositColumnOpts" />
<view class="deposit-empty-mask" v-if="depositItems.length === 0">
<text class="empty-text">暂无数据</text>
</view>
</view>
</view>
</template>
<script setup>
import { computed } from 'vue'
const props = defineProps({
depositBalance: { type: String, default: '0' },
depositItems: { type: Array, default: () => [] }
})
const depositColumnData = computed(() => {
const categories = props.depositItems.map(item => item.typeName)
const data = props.depositItems.map(item => (item.balance / 10000))
return {
categories,
series: [{ name: '余额', data }]
}
})
const depositColumnOpts = computed(() => ({
color: ['#4D5DFA'],
padding: [20, 10, 0, 10],
enableScroll: false,
legend: { show: false },
xAxis: {
disableGrid: true,
axisLineColor: '#EAEAEA',
dashLength: 4,
fontColor: '#666',
fontSize: 12
},
yAxis: {
showTitle: true,
data: [{
title: '金额(万)',
min: 0,
axisLineColor: '#EAEAEA',
fontColor: '#666',
fontSize: 12,
titleFontSize: 12,
titleFontColor: '#666'
}],
gridType: 'dash',
dashLength: 4,
gridColor: '#F2F2F2',
},
extra: {
column: {
type: 'group',
width: 30,
activeBgColor: '#4D5DFA',
activeBgOpacity: 0.08,
dataLabel: {
show: true,
position: 'top',
fontSize: 12,
color: '#333',
formatter: (val) => val.toFixed(2)
}
}
}
}))
</script>
<style scoped lang="scss">
.deposit-card {
margin-top: 20rpx;
background: #fff;
border-radius: 8rpx;
padding: 30rpx 24rpx;
.deposit-card-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
.deposit-title { font-size: 32rpx; font-weight: 600; color: #222; }
.deposit-balance { font-size: 28rpx; color: #333; }
}
.deposit-chart {
width: 100%;
height: 420rpx;
position: relative;
.deposit-empty-mask {
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
.empty-text { font-size: 26rpx; color: #999; }
}
}
}
</style>