Files
BMS/bms-front/src/views/price/set/components/detail/SetSectionCard.vue
T
2026-09-14 11:53:11 +08:00

105 lines
1.9 KiB
Vue

<template>
<el-card shadow="never" class="sec-card">
<template #header>
<div class="sec-head">
<div class="sec-title">
<i class="sec-bar" :class="'is-' + tone" />
<span class="sec-text">{{ title }}</span>
<el-tag v-if="count !== null" size="small" type="info" effect="plain" round class="sec-count">
{{ count }}
</el-tag>
<span v-if="sub" class="sec-sub">{{ sub }}</span>
</div>
<div class="sec-extra">
<slot name="action" />
</div>
</div>
</template>
<slot />
</el-card>
</template>
<script setup name="SetSectionCard">
/**
* 套餐详情 · 通用分区卡片
* 统一标题样式(色条 + 标题 + 数量徽标)与右上角操作区。
*/
defineProps({
/** 分区标题 */
title: {
type: String,
required: true
},
/** 数量徽标,传 null 不显示 */
count: {
type: Number,
default: null
},
/** 标题右侧补充说明 */
sub: {
type: String,
default: ''
},
/** 色条色调 */
tone: {
type: String,
default: 'blue',
validator: v => ['blue', 'green', 'orange'].includes(v)
}
})
</script>
<style scoped>
.sec-card {
margin-bottom: 16px;
border-radius: 8px;
}
.sec-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.sec-title {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
}
.sec-bar {
width: 3px;
height: 14px;
border-radius: 2px;
background: #1890ff;
flex: none;
}
.sec-bar.is-green {
background: #52c41a;
}
.sec-bar.is-orange {
background: #fa8c16;
}
.sec-text {
font-size: 15px;
font-weight: 600;
color: #303133;
}
.sec-count {
flex: none;
}
.sec-sub {
font-size: 12px;
font-weight: normal;
color: #909399;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.sec-extra {
flex: none;
display: flex;
align-items: center;
gap: 8px;
}
</style>