feat(components): 新增 GiftCard礼品卡组件

- 新增 GiftCard 组件,支持多种类型礼品卡的展示和交互
- 组件包含商品信息、价格、折扣、使用指南等丰富功能- 优化图像展示,支持单
This commit is contained in:
2025-08-17 00:06:03 +08:00
parent 1b24a611a8
commit ecb5d9059a
22 changed files with 2788 additions and 191 deletions

View File

@@ -108,10 +108,14 @@
.title-text {
display: block;
font-size: 18px;
font-weight: 600;
line-height: 1.3;
margin-bottom: 2px;
// 商品名称可能较长,需要处理溢出
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 200px;
}
.type-text {
@@ -138,29 +142,151 @@
align-items: flex-start;
margin-bottom: 16px;
.gift-image {
.gift-image-container {
margin-right: 16px;
flex-shrink: 0;
position: relative;
.gift-image {
position: relative;
.gift-image-single {
width: 180px;
height: 180px;
border-radius: 12px;
object-fit: cover;
background-color: #f5f5f5;
// 添加加载状态和错误处理
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #f5f5f5;
border-radius: 12px;
z-index: -1;
}
}
}
.gift-image-swiper {
position: relative;
width: 80px;
height: 80px;
border-radius: 12px;
overflow: hidden;
.swiper-container {
width: 100%;
height: 100%;
.swiper-image {
width: 100%;
height: 100%;
object-fit: cover;
}
}
}
.discount-badge {
position: absolute;
top: -4px;
right: -4px;
background: #ff4757;
border-radius: 8px;
padding: 2px 6px;
z-index: 2;
.discount-text {
font-size: 10px;
color: #fff;
font-weight: 600;
}
}
}
.gift-info {
flex: 1;
.gift-value {
display: flex;
align-items: baseline;
margin-bottom: 8px;
.goods-basic-info {
margin-bottom: 12px;
.value-label {
font-size: 14px;
color: #666;
margin-right: 8px;
.brand-category {
display: flex;
align-items: center;
margin-bottom: 8px;
.brand-text {
font-weight: 600;
color: #333;
}
.category-text {
font-size: 12px;
color: #999;
margin-left: 4px;
}
}
.value-amount {
font-size: 24px;
font-weight: bold;
color: #333;
.price-info {
display: flex;
align-items: baseline;
margin-bottom: 8px;
.current-price {
display: flex;
align-items: baseline;
margin-right: 12px;
.price-symbol {
font-size: 16px;
color: #ff4757;
font-weight: 600;
}
.price-amount {
font-size: 24px;
font-weight: bold;
color: #ff4757;
}
}
.original-price {
font-size: 14px;
color: #999;
text-decoration: line-through;
}
}
.rating-info {
display: flex;
align-items: center;
.rating-text {
font-size: 12px;
color: #333;
margin-left: 4px;
margin-right: 8px;
}
.review-count {
font-size: 12px;
color: #999;
}
}
}
.goods-tags {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 12px;
.nut-tag {
font-size: 11px;
padding: 2px 6px;
}
}
@@ -171,6 +297,72 @@
margin-bottom: 12px;
}
.goods-specs {
margin-bottom: 12px;
.spec-item {
display: flex;
align-items: center;
margin-bottom: 4px;
.spec-label {
font-size: 12px;
color: #999;
min-width: 40px;
}
.spec-value {
font-size: 12px;
color: #333;
&.in-stock {
color: #52c41a;
}
&.out-stock {
color: #ff4757;
}
}
}
}
.promotion-info {
background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
border-radius: 8px;
padding: 12px;
margin-bottom: 12px;
border-left: 3px solid #ff4757;
.promotion-header {
display: flex;
align-items: center;
margin-bottom: 6px;
.promotion-icon {
color: #ff4757;
margin-right: 6px;
}
.promotion-title {
font-size: 13px;
font-weight: 600;
color: #ff4757;
}
}
.promotion-desc {
font-size: 12px;
color: #333;
line-height: 1.4;
margin-bottom: 4px;
}
.promotion-valid {
font-size: 11px;
color: #999;
}
}
.gift-code {
background: #f8f9fa;
border-radius: 8px;
@@ -179,13 +371,11 @@
.code-label {
display: block;
font-size: 12px;
color: #999;
margin-bottom: 4px;
}
.code-value {
font-size: 16px;
font-weight: 600;
color: #333;
font-family: 'Courier New', monospace;
@@ -195,6 +385,69 @@
}
}
.goods-instructions {
margin-bottom: 16px;
.instruction-section {
margin-bottom: 12px;
&:last-child {
margin-bottom: 0;
}
.section-header {
display: flex;
align-items: center;
margin-bottom: 8px;
.section-icon {
color: #4a90e2;
margin-right: 6px;
&.warning {
color: #ff9500;
}
}
.section-title {
font-size: 13px;
font-weight: 600;
color: #333;
}
}
.instruction-list {
.instruction-item {
display: block;
font-size: 12px;
color: #666;
line-height: 1.5;
margin-bottom: 4px;
padding-left: 8px;
&.notice {
color: #ff9500;
}
&:last-child {
margin-bottom: 0;
}
}
}
.store-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
.store-tag {
font-size: 11px;
padding: 2px 6px;
}
}
}
}
.gift-time-info {
.time-item {
display: flex;
@@ -290,10 +543,42 @@
padding: 16px;
.gift-card-content {
.gift-image-container {
margin-right: 12px;
.gift-image .gift-image-single,
.gift-image-swiper {
width: 70px;
height: 70px;
}
}
.gift-info {
.gift-value {
.value-amount {
font-size: 20px;
.goods-basic-info {
.price-info {
.current-price {
.price-amount {
font-size: 20px;
}
}
}
}
.goods-tags {
gap: 4px;
}
.promotion-info {
padding: 10px;
}
}
}
.goods-instructions {
.instruction-section {
.instruction-list {
.instruction-item {
font-size: 11px;
}
}
}
@@ -302,6 +587,35 @@
.gift-card-footer {
padding: 0 16px 16px;
.footer-actions {
gap: 6px;
}
}
}
}
// 小屏幕优化
@media (max-width: 480px) {
.gift-card {
.gift-card-content {
flex-direction: column;
.gift-image-container {
margin-right: 0;
margin-bottom: 12px;
align-self: center;
}
}
.goods-instructions {
.instruction-section {
.store-list {
.store-tag {
font-size: 10px;
}
}
}
}
}
}