Commit 543468bd by Lin

feat: 添加活动相关图片资源并优化 Entrance 组件

- 新增售前和售后活动类型的图片资源
- 更新 Entrance 组件以支持横向滚动展示活动入口
- 优化样式以提升用户体验和视觉效果
1 parent 4bfa45bc
...@@ -2,7 +2,26 @@ ...@@ -2,7 +2,26 @@
<view class="entrance-box"> <view class="entrance-box">
<template v-if="entranceList.length"> <template v-if="entranceList.length">
<view class="entrance-container"> <view class="entrance-container">
<view :class="['entrance-list', `entrance-list-${type}`]"> <scroll-view
v-if="scrollable"
class="entrance-scroll"
scroll-x
enable-flex
show-scrollbar="false"
>
<view class="entrance-list entrance-list-scroll">
<view
class="entrance-item"
v-for="(item, index) in entranceList"
:key="index"
@click="handleClick(item)"
>
<view :class="['sprite-icon', `icon-${item.icon}`]"></view>
<view class="entrance-name">{{ item.label }}</view>
</view>
</view>
</scroll-view>
<view v-else :class="['entrance-list', `entrance-list-${type}`]">
<view class="entrance-item" v-for="(item, index) in entranceList" :key="index" @click="handleClick(item)"> <view class="entrance-item" v-for="(item, index) in entranceList" :key="index" @click="handleClick(item)">
<view :class="['sprite-icon', `icon-${item.icon}`]"></view> <view :class="['sprite-icon', `icon-${item.icon}`]"></view>
<view class="entrance-name">{{ item.label }}</view> <view class="entrance-name">{{ item.label }}</view>
...@@ -27,6 +46,11 @@ export default { ...@@ -27,6 +46,11 @@ export default {
type: { type: {
type: Number, type: Number,
default: 0 default: 0
},
// 横向滚动展示
scrollable: {
type: Boolean,
default: false
} }
}, },
data() { data() {
...@@ -217,6 +241,11 @@ export default { ...@@ -217,6 +241,11 @@ export default {
// justify-content: center; // justify-content: center;
} }
.entrance-scroll {
width: 100%;
white-space: nowrap;
}
.entrance-list { .entrance-list {
width: 100%; width: 100%;
display: grid; display: grid;
...@@ -230,19 +259,29 @@ export default { ...@@ -230,19 +259,29 @@ export default {
&.entrance-list-1 { &.entrance-list-1 {
grid-template-columns: repeat(4, 1fr); grid-template-columns: repeat(4, 1fr);
} }
&.entrance-list-scroll {
display: flex;
flex-wrap: nowrap;
gap: toRpx(68);
width: auto;
}
} }
.entrance-item { .entrance-item {
min-width: toRpx(120); min-width: toRpx(120);
flex-shrink: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: toRpx(28); font-size: toRpx(28);
color: #333; color: #333;
cursor: pointer;
.entrance-name { .entrance-name {
margin-top: toRpx(8); margin-top: toRpx(8);
white-space: nowrap;
} }
} }
......
<template> <template>
<view class="container"> <view class="container-left">
限时产品活动 <!-- 活动类型标签栏 -->
<view class="type-box">
<view
v-for="(item, index) in activityTypeTabs"
:key="item.key"
:class="['type-tag-item', { active: activityTypeIndex === index }]"
@click="handleActivityTypeClick(index)"
>
<image class="type-tag-item-img" :src="require(`@/assets/images/common/activity-type-${item.key}.png`)" mode="aspectFit"></image>
<text class="type-tag-item-text">{{ item.label }}</text>
</view>
</view> </view>
<!-- 车型标签栏 -->
<scroll-view class="car-list" scroll-x enable-flex show-scrollbar="false">
<view class="car-list-inner">
<view
v-for="(item, index) in carModelTabs"
:key="item.key"
:class="['car-item', { active: carModelIndex === index }]"
@click="handleCarModelClick(index)"
>
{{ item.label }}
</view>
</view>
</scroll-view>
<!-- 活动商品展示 -->
<view class="goods-box">
<view class="goods-img-wrap">
<image
class="goods-img"
:src="require('@/assets/images/common/bg-activity-time.png')"
mode="aspectFill"
/>
<view class="tiem-tag">
<image class="tiem-tag-img" :src="require('@/assets/images/common/icon-activity-date.png')" mode="aspectFit"></image>
<text class="tiem-tag-text">活动时间:2026-11-01至2026-11-10</text>
</view>
</view>
<scroll-view class="goods-menu" scroll-x enable-flex show-scrollbar="false">
<view class="goods-menu-inner">
<view
v-for="(item, index) in goodsList"
:key="item.id || index"
class="goods-item"
@click="$emit('goodsClick', item, index)"
>
<view v-if="item.isMain" class="goods-item-badge">主推</view>
<view v-else class="goods-item-badge badge02">次推</view>
<view class="goods-item-img-wrap">
<image class="goods-item-img" :src="item.cover" mode="aspectFill" />
</view>
<view class="goods-item-content">
<text class="goods-item-name">{{ item.name }}</text>
<text class="goods-item-desc">{{ item.description }}</text>
<view class="goods-item-price-wrap">
<text class="goods-item-price">¥ {{ item.price }}</text>
<text v-if="item.originalPrice" class="goods-item-original-price">¥ {{ item.originalPrice }}</text>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<!-- 展业工具 -->
<view class="tools-box">
<Entrance scrollable @entranceClick="handleEntranceClick" />
</view>
</view>
</template> </template>
<script> <script>
import Entrance from '@/components/Entrance.vue'
const GOODS_COVER = require('@/assets/images/common/goods-activity-cover.png')
const MOCK_GOODS_LIST = [
{
id: 1,
name: '这是活动商品/套餐限时保养套餐限时保养套餐',
description: '这是选项卡描述-包含机油更换、机滤、空调滤、空气滤全套服务,活动期间享受8折优惠,先到先得。',
price: '19999.00',
originalPrice: '12980.00',
isMain: true
},
{
id: 2,
name: '618大促精品套餐',
description: '免排队·省时·省钱,包含机油更换、机滤、空调滤全套服务。',
price: '899.00',
originalPrice: '1299.00',
isMain: false
},
{
id: 3,
name: '618大促精品套餐',
description: '免排队·省时·省钱,包含机油更换、机滤、空调滤全套服务。',
price: '899.00',
originalPrice: '1299.00'
}
].map(item => ({ cover: GOODS_COVER, ...item }))
export default { export default {
name: 'ActivityTime' name: 'ActivityTime',
components: {
Entrance
},
data() {
return {
activityTypeTabs: [
{ label: '售前活动', key: 'preSale' },
{ label: '售后活动', key: 'afterSale' }
],
activityTypeIndex: 0,
carModelTabs: [
{ label: '全部车型', key: 'all' },
{ label: '问界M5', key: 'm5' },
{ label: '问界M7', key: 'm7' },
{ label: '问界M9', key: 'm9' },
{ label: '奥迪 A6L', key: 'a6l' },
{ label: '特斯拉 Model 3', key: 'model3' }
],
carModelIndex: 0,
goodsList: MOCK_GOODS_LIST
}
},
methods: {
handleActivityTypeClick(index) {
this.activityTypeIndex = index
},
handleCarModelClick(index) {
if (this.carModelIndex === index) return
this.carModelIndex = index
this.$emit('carModelChange', this.carModelTabs[index], index)
},
handleEntranceClick(item) {
this.$emit('entranceClick', item)
}
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.container { .container-left {
width: toRpx(1138);
height: 100%;
background-color: #ffffff;
.type-box {
height: 62px;
display: flex;
align-items: center;
gap: 12px;
}
.type-tag-item {
width: 108px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
background: #F2F2F2;
border-radius: 8px;
cursor: pointer;
.type-tag-item-img {
width: 16px;
height: 16px;
flex-shrink: 0;
}
.type-tag-item-text {
font-size: 14px;
line-height: 14px;
color: #292D33;
}
&.active {
background: rgba(44, 102, 247, 0.10);
.type-tag-item-text {
color: #2C66F7;
}
}
}
.car-list {
width: 100%;
white-space: nowrap;
margin-bottom: toRpx(28);
.car-list-inner {
display: flex;
flex-wrap: nowrap;
gap: 15px;
}
.car-item {
flex-shrink: 0;
box-sizing: border-box;
min-width: 81px;
height: 32px;
padding: 0 10px;
border-radius: 8px;
border: 1px solid #F5F7FA;
font-size: 14px;
line-height: 14px;
color: #292D33;
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
cursor: pointer;
&.active {
color: #2C66F7;
border: 1px solid rgba(44, 102, 247, 0.10);
}
}
}
.goods-box {
width: 100%;
.goods-img-wrap {
position: relative;
width: 100%;
height: 288px;
overflow: hidden;
}
.goods-img {
width: 100%;
height: 288px;
display: block;
border-radius: 8px;
}
.tiem-tag {
position: absolute;
top: 0;
right: 0;
z-index: 1;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
padding: toRpx(10) toRpx(16);
border-radius: 0 0 0 8px;
background: rgba(0, 0, 0, 0.60);
font-size: 14px;
text-align: center;
color: #ffffff;
}
.tiem-tag-img {
width: 16px;
height: 16px;
flex-shrink: 0;
display: block;
}
.tiem-tag-text {
font-size: 14px;
line-height: 14px;
color: #ffffff;
white-space: nowrap;
}
.goods-menu {
$goods-item-height: 120px;
width: 100%;
height: $goods-item-height;
white-space: nowrap;
margin: toRpx(28) 0;
.goods-menu-inner {
display: flex;
flex-wrap: nowrap;
gap: 12px;
height: $goods-item-height;
}
.goods-item {
position: relative;
flex-shrink: 0;
width: 252px;
height: $goods-item-height;
display: flex;
align-items: stretch;
overflow: hidden;
border: 1.5px solid rgba(44, 102, 247, 0.1);
border-radius: 8px;
box-shadow: 0 2px 8px 0 rgba(44, 102, 247, 0.1);
background: linear-gradient(90deg, rgba(44, 102, 247, 0.05) 0%, rgba(44, 102, 247, 0.05) 100%), #fff;
cursor: pointer;
}
.goods-item-badge {
position: absolute;
left: -1.5px;
top: -1.5px;
z-index: 2;
padding: 2px 10px;
border-radius: 0 0 8px 0;
background: linear-gradient(270deg, #FF6748 0%, #F24724 100%);
font-size: 12px;
line-height: normal;
color: #fff;
white-space: nowrap;
}
.badge02 {
background: linear-gradient(90deg, #5C8AFF 0%, #49B6FF 100%);
}
.goods-item-img-wrap {
flex-shrink: 0;
width: 88px;
height: $goods-item-height;
overflow: hidden;
margin-right: toRpx(24);
}
.goods-item-img {
width: 100%;
height: 156px;
display: block;
}
.goods-item-content {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 6px;
padding: 12px 16px 12px 0;
}
.goods-item-name,
.goods-item-price,
.goods-item-original-price {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.goods-item-name {
font-size: 15px;
line-height: 18px;
font-weight: 500;
color: #1A1A2E;
}
.goods-item-desc {
font-size: 13px;
line-height: 16px;
color: #999EA8;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
height: 32px;
}
.goods-item-price-wrap {
display: flex;
flex-direction: column;
justify-content: flex-end;
margin-top: auto;
}
.goods-item-price {
font-size: 16px;
line-height: 20px;
font-weight: 600;
color: #F24724;
}
.goods-item-original-price {
font-size: 12px;
line-height: normal;
color: #999EA8;
text-decoration: line-through;
}
}
}
.tools-box {
width: 100%; width: 100%;
height: 100%; margin-top: toRpx(28);
}
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
...@@ -105,16 +105,11 @@ ...@@ -105,16 +105,11 @@
</view> </view>
</view> </view>
<view v-show="homeContentTabIndex === 1" class="right-content-box flex right-content-box-scene1"> <view v-show="homeContentTabIndex === 1" class="right-content-box flex right-content-box-scene1">
<!-- <view class="home-tab-panel__placeholder">限时产品活动</view>
<ActivityTime /> -->
<view class="tab-container"> <view class="tab-container">
<!-- <ActivityTime /> --> <ActivityTime @entranceClick="entranceClick" />
<view class="container-left"> <view class="container-right">
客户档案
</view> </view>
<view class="container-right">
</view>
</view> </view>
</view> </view>
<view v-show="homeContentTabIndex === 2" class="right-content-box flex right-content-box-scene1"> <view v-show="homeContentTabIndex === 2" class="right-content-box flex right-content-box-scene1">
...@@ -1261,6 +1256,45 @@ export default { ...@@ -1261,6 +1256,45 @@ export default {
width: toRpx(1138); width: toRpx(1138);
height: 100%; height: 100%;
background-color: #ebf7a6; background-color: #ebf7a6;
.type-box {
height: 62px;
display: flex;
align-items: center;
gap: 12px;
}
.type-tag-item {
width: 108px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
background: #F2F2F2;
border-radius: 8px;
cursor: pointer;
.type-tag-item-img {
width: 16px;
height: 16px;
flex-shrink: 0;
}
.type-tag-item-text {
font-size: 14px;
line-height: 14px;
color: #292D33;
}
&.active {
background: rgba(44, 102, 247, 0.10);
.type-tag-item-text {
color: #2C66F7;
}
}
}
} }
.container-right { .container-right {
width: calc(100% - #{toRpx(1138)}); width: calc(100% - #{toRpx(1138)});
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!