3
0
Fork 0

feat(specialArea): 商品列表角标展示代码迁移

This commit is contained in:
woody 2025-07-15 17:46:31 +08:00
parent 2bac6a7009
commit d35ddd52fd
1 changed files with 86 additions and 25 deletions

View File

@ -1,9 +1,3 @@
<!--
* @Descripttion:
* @version:
* @Author: kBank
* @Date: 2022-11-21 15:11:22
-->
<template> <template>
<view class="content"> <view class="content">
<backIcon :diff="diff"></backIcon> <backIcon :diff="diff"></backIcon>
@ -78,7 +72,22 @@
class="fly" class="fly"
v-show="item.preSaleStatus == 3 || item.isSale == 1" v-show="item.preSaleStatus == 3 || item.isSale == 1"
></view> ></view>
<img :src="item.cover1" class="cover" alt="" /> <view class="image-container">
<img :src="item.cover1" class="cover" alt="" />
<!-- 三角形角标 -->
<view class="triangle-badge" v-if="item.warnMessage">
<view
class="triangle-badge-text"
:class="{
'text-2': item.warnMessage.length === 2,
'text-3': item.warnMessage.length === 3,
'text-4': item.warnMessage.length === 4,
}"
>
{{ item.warnMessage }}
</view>
</view>
</view>
<view class="goodList_ir"> <view class="goodList_ir">
<view> <view>
<span class="qzbq" v-if="item.prefixLabelTarget != undefined">{{ <span class="qzbq" v-if="item.prefixLabelTarget != undefined">{{
@ -249,9 +258,17 @@ export default {
// }) // })
// } // }
// //
//
// this.getClassIfy()
this.userInfo = uni.getStorageSync('User')
const areaMap = { const areaMap = {
[REGIEST_AREA.id]: REGIEST_AREA.name, [REGIEST_AREA.id]: REGIEST_AREA.name,
[UPGRADE_AREA.id]: UPGRADE_AREA.name, [UPGRADE_AREA.id]:
this.userInfo.memberSign == MEMBER_SIGN.ZERO_LEVEL
? '会员专区'
: UPGRADE_AREA.name,
[REPURCHASE_AREA.id]: REPURCHASE_AREA.name, [REPURCHASE_AREA.id]: REPURCHASE_AREA.name,
[REISSUE_AREA.id]: REISSUE_AREA.name, [REISSUE_AREA.id]: REISSUE_AREA.name,
} }
@ -260,11 +277,6 @@ export default {
title: this.titLabel, title: this.titLabel,
success: () => {}, success: () => {},
}) })
//
// this.getClassIfy()
this.userInfo = uni.getStorageSync('User')
this.pkCountry = this.userInfo.pkCountry || 1 this.pkCountry = this.userInfo.pkCountry || 1
this.setSpecial({ this.setSpecial({
value: this.specialArea, value: this.specialArea,
@ -348,6 +360,7 @@ export default {
title: '购物车添加成功', title: '购物车添加成功',
icon: 'success', icon: 'success',
mask: true, mask: true,
duration: 500,
}) })
setTimeout(() => { setTimeout(() => {
this.$store.dispatch('getCarLength', this.specialArea).then(res => { this.$store.dispatch('getCarLength', this.specialArea).then(res => {
@ -370,10 +383,10 @@ export default {
hierarchy: 0, hierarchy: 0,
}) })
.then(res => { .then(res => {
res.data.unshift({ // res.data.unshift({
classifyName: '全部', // classifyName: '',
pkId: '', // pkId: '',
}) // })
this.oneList = res.data this.oneList = res.data
this.oneId = this.oneList[0] ? this.oneList[0].pkId : '' this.oneId = this.oneList[0] ? this.oneList[0].pkId : ''
this.getClassIfyTwo(this.oneList[0].pkId) this.getClassIfyTwo(this.oneList[0].pkId)
@ -609,12 +622,12 @@ export default {
position: relative; position: relative;
.goodList_ir { .goodList_ir {
margin-left: 20rpx; margin-left: 24rpx;
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
font-size: 24rpx; font-size: 28rpx;
font-family: Microsoft YaHei; font-family: Microsoft YaHei;
font-weight: 400; font-weight: 400;
color: #333333; color: #333333;
@ -623,14 +636,14 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
font-size: 28rpx; font-size: 32rpx;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
color: #f82c1a; color: #f82c1a;
img { img {
width: 56rpx; width: 60rpx;
height: 56rpx; height: 60rpx;
} }
} }
} }
@ -646,8 +659,8 @@ export default {
} }
.cover { .cover {
width: 152rpx; width: 200rpx;
height: 152rpx; height: 200rpx;
background: #ffffff; background: #ffffff;
border: 1px solid #eeeeee; border: 1px solid #eeeeee;
border-radius: 10rpx; border-radius: 10rpx;
@ -655,7 +668,7 @@ export default {
} }
.pv { .pv {
font-size: 22rpx; font-size: 26rpx;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
color: #999999; color: #999999;
@ -703,4 +716,52 @@ export default {
border-radius: 20px; border-radius: 20px;
font-size: 14px; font-size: 14px;
} }
.image-container {
position: relative;
}
.triangle-badge {
position: absolute;
top: 0;
left: 0;
width: 0;
height: 0;
border-top: 100rpx solid #005bac;
border-right: 100rpx solid transparent;
border-radius: 10rpx 0 0 0;
z-index: 10;
}
.triangle-badge-text {
position: absolute;
color: #ffffff;
font-weight: 600;
line-height: 1;
transform: rotate(-45deg);
transform-origin: center;
white-space: nowrap;
text-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.2);
}
/* 2个字样式 */
.triangle-badge-text.text-2 {
top: -76rpx;
left: 10rpx;
font-size: 24rpx;
}
/* 3个字样式 */
.triangle-badge-text.text-3 {
top: -70rpx;
left: -2rpx;
font-size: 24rpx;
}
/* 4个字样式 */
.triangle-badge-text.text-4 {
top: -72rpx;
left: -4rpx;
font-size: 20rpx;
}
</style> </style>