优化pc端商品详情页的优惠券展示

master
paulGao 2022-09-02 11:00:01 +08:00
parent fd847944b7
commit 8b22b73f3d
1 changed files with 133 additions and 36 deletions

View File

@ -76,7 +76,6 @@
</div> </div>
<!-- 商品原价 --> <!-- 商品原价 -->
<div class="item-price-row" v-else> <div class="item-price-row" v-else>
<!-- 批发价格 --> <!-- 批发价格 -->
<div v-if="wholesaleNum && wholesaleNum.length"> <div v-if="wholesaleNum && wholesaleNum.length">
<div class="flex"> <div class="flex">
@ -84,14 +83,23 @@
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
</div> </div>
<div v-for="(item,index) in wholesalePrice" :key="index" class="item-price item-num">{{ <div
item | unitPrice("¥") v-for="(item, index) in wholesalePrice"
}}</div> :key="index"
class="item-price item-num"
>
{{ item | unitPrice("¥") }}
</div>
</div> </div>
<div class="flex"> <div class="flex">
<div class="item-price-title"> </div> <div class="item-price-title"> </div>
<div v-for="(item,index) in wholesaleNum" :key="index" class="item-num item-price-num">{{item}}{{skuDetail.goodsUnit}}</div> <div
v-for="(item, index) in wholesaleNum"
:key="index"
class="item-num item-price-num"
>
{{ item }}{{ skuDetail.goodsUnit }}
</div>
</div> </div>
</div> </div>
@ -106,12 +114,13 @@
</div> </div>
</div> </div>
<!-- 优惠券展示 --> <!-- 优惠券展示 -->
<div class="item-price-row" v-if="promotionMap['COUPON'].length"> <div class="item-price-coupon-row" v-if="promotionMap['COUPON'].length">
<p> <p class="Ellipsis">
<span class="item-price-title"> </span> <span class="item-price-title"> </span>
<span>
<span <span
class="item-coupon" class="item-coupon"
v-for="(item, index) in promotionMap['COUPON']" v-for="(item, index) in promotionMap['COUPON'].slice(0, 6)"
:key="index" :key="index"
@click="receiveCoupon(item.id)" @click="receiveCoupon(item.id)"
> >
@ -124,6 +133,28 @@
}}</span }}</span
> >
</span> </span>
</span>
<div class="dropdown" v-if="promotionMap['COUPON'].length > 6">
<span>展开更多</span>
<div class="dropdown-content">
<span
class="item-coupon"
v-for="(item, index) in promotionMap['COUPON'].slice(6, promotionMap['COUPON'].length)"
:key="index"
@click="receiveCoupon(item.id)"
>
<span v-if="item.couponType == 'PRICE'"
>{{ item.consumeThreshold }}{{ item.price }}</span
>
<span v-if="item.couponType == 'DISCOUNT'"
>{{ item.consumeThreshold }}{{
item.couponDiscount
}}</span
>
</span>
</div>
</div>
</p> </p>
</div> </div>
<!-- 满减展示 --> <!-- 满减展示 -->
@ -285,7 +316,7 @@ export default {
detail: { detail: {
handler(val) { handler(val) {
this.skuDetail = val.data; this.skuDetail = val.data;
this.wholesaleList = val.wholesaleList this.wholesaleList = val.wholesaleList;
this.swiperGoodsImg(); this.swiperGoodsImg();
}, },
deep: true, deep: true,
@ -313,17 +344,24 @@ export default {
loading: false, // loading loading: false, // loading
loading1: false, // loading loading1: false, // loading
isCollected: false, // isCollected: false, //
}; };
}, },
components: { PicZoom, Promotion }, components: { PicZoom, Promotion },
computed: { computed: {
wholesalePrice(key) { wholesalePrice(key) {
return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.price }) :[] return this.wholesaleList.length
? this.wholesaleList.map((item) => {
return item.price;
})
: [];
}, },
wholesaleNum(key) { wholesaleNum(key) {
return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.num }) :[] return this.wholesaleList.length
} ? this.wholesaleList.map((item) => {
return item.num;
})
: [];
},
}, },
methods: { methods: {
select(index, value) { select(index, value) {
@ -526,7 +564,6 @@ export default {
padding-left: 4px; padding-left: 4px;
} }
.wrapper { .wrapper {
@include white_background_color(); @include white_background_color();
} }
@ -647,14 +684,65 @@ export default {
margin-left: 5px; margin-left: 5px;
} }
.item-price-coupon-row {
display: flex;
align-items: center;
margin: 5px 0px;
}
.Ellipsis {
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2; //
-webkit-box-orient: vertical; //webbox
}
.dropdown {
position: relative;
display: inline-block;
cursor: pointer;
z-index: 999;
}
.dropdown .item-coupon {
display: flex;
align-content: center;
align-items: center;
color: $theme_color;
margin: 5px 0;
font-size: 12px;
background-color: #ffdedf;
border: 1px dotted $theme_color;
cursor: pointer;
span {
padding: 3px;
}
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
padding: 12px 16px;
}
.dropdown:hover .dropdown-content {
display: block;
}
.item-coupon { .item-coupon {
margin-right: 5px; margin-right: 5px;
padding: 3px; padding: 0 5px;
color: $theme_color; color: $theme_color;
font-size: 12px; font-size: 12px;
background-color: #ffdedf; background-color: #ffdedf;
border: 1px dotted $theme_color; border: 1px dotted $theme_color;
cursor: pointer; cursor: pointer;
span {
padding: 3px;
}
} }
.item-promotion { .item-promotion {
margin-right: 5px; margin-right: 5px;
@ -663,8 +751,17 @@ export default {
font-size: 12px; font-size: 12px;
border: 1px solid $theme_color; border: 1px solid $theme_color;
} }
.item-price-right {
display: flex;
align-content: center;
align-items: center;
}
.item-remarks-sum { .item-remarks-sum {
padding-left: 8px; width: 70px;
text-align: center;
padding: 0 10px;
border-left: 1px solid $border_color; border-left: 1px solid $border_color;
} }