Files
inkreach-uni/pages/product-detail/components/PackagingSpec.vue
T
2026-08-21 19:02:35 +08:00

147 lines
3.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<!-- 包装规格表4 × 4 每个数据单元格双单位cm + in -->
<view class="pack-wrap">
<view class="header-row">
<text class="title">包装规格</text>
<text class="unit">单位{{ data.unit }}</text>
</view>
<view class="table">
<!-- 表头bg #DFDFDF圆角 6px -->
<view class="row header">
<text
class="cell"
v-for="(col, index) in data.columns"
:key="index"
>{{ col }}</text>
</view>
<!-- 数据行偶数行 bg #F7F7F7行高 60px双行内容 -->
<view
class="row data-row"
:class="{ alt: (index + 1) % 2 === 0 }"
v-for="(row, index) in data.rows"
:key="index"
>
<!-- 尺码列单行居中 -->
<view class="cell size-cell">
<text class="size-text">{{ row.size }}</text>
</view>
<!-- 尺寸列cm + in 双行 -->
<view class="cell dual-cell">
<text class="dual-top">{{ row.dimension.cm }}</text>
<text class="dual-bottom">{{ row.dimension.in }}</text>
</view>
<!-- 体积列cm + in 双行 -->
<view class="cell dual-cell">
<text class="dual-top">{{ row.volume.cm }}</text>
<text class="dual-bottom">{{ row.volume.in }}</text>
</view>
<!-- 重量列cm + in 双行 -->
<view class="cell dual-cell">
<text class="dual-top">{{ row.weight.cm }}</text>
<text class="dual-bottom">{{ row.weight.in }}</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'PackagingSpec',
props: {
data: {
type: Object,
default: () => ({})
}
}
}
</script>
<style scoped>
.pack-wrap {
padding: 30rpx 20rpx; /* 15px 10px */
background: #ffffff;
}
/* 标题行 */
.header-row {
display: flex;
align-items: center;
margin-bottom: 20rpx; /* 10px */
}
.title {
font-size: 29rpx; /* 15px */
color: #000000;
line-height: 33rpx;
}
.unit {
margin-left: 16rpx;
font-size: 21rpx; /* 11px */
color: rgba(0, 0, 0, 0.5);
line-height: 33rpx;
}
/* 表格 */
.table {
display: flex;
flex-direction: column;
gap: 8rpx; /* 4px 行间距 */
}
/* 单行 */
.row {
display: flex;
border-radius: 12rpx; /* 6px */
align-items: center;
}
.row.header {
height: 77rpx; /* 40px */
background: #dfdfdf;
}
.row.data-row {
height: 115rpx; /* 60px 双行内容更高 */
}
.row.alt {
background: #f7f7f7;
}
/* 单元格 */
.cell {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/* 表头文字 */
.row.header .cell {
font-size: 25rpx; /* 13px */
color: #000000;
line-height: 33rpx;
}
/* 尺码列:单行 13px */
.size-text {
font-size: 25rpx; /* 13px */
color: #000000;
line-height: 33rpx;
}
/* 双单位单元格:cm 在上,in 在下 */
.dual-cell {
gap: 4rpx; /* 2px */
}
.dual-top,
.dual-bottom {
font-size: 19rpx; /* 10px */
color: rgba(0, 0, 0, 0.6);
line-height: 33rpx;
}
</style>