You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<template>
|
|
|
|
<div class="goods-item" @click="onItem">
|
|
|
|
<img class="goods-item__img" :src="item.mainPicture" alt="商品图片" />
|
|
|
|
<div class="goods-item__title">
|
|
|
|
<span class="goods-item__title-label" v-if="isLabel(item.labelList)">
|
|
|
|
{{ getLabel(item.labelList) }}
|
|
|
|
</span>
|
|
|
|
{{ item.name }}
|
|
|
|
</div>
|
|
|
|
<div class="goods-item__price">
|
|
|
|
<UiMoney :money="item.startingPrice"></UiMoney>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import UiMoney from "@/components/UiMoney.vue";
|
|
|
|
export default {
|
|
|
|
name: "UiGoodsItem",
|
|
|
|
componetns: { UiMoney },
|
|
|
|
props: {
|
|
|
|
item: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
isLabel(arr) {
|
|
|
|
return arr.some((item) => item.code);
|
|
|
|
},
|
|
|
|
getLabel(arr) {
|
|
|
|
let str = "";
|
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
|
if (arr[i].code != "miaosha") {
|
|
|
|
str = arr[i].text;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return str;
|
|
|
|
},
|
|
|
|
onItem() {
|
|
|
|
this.$router.push({
|
|
|
|
path: "/goods/detail/" + this.item.id,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.goods-item {
|
|
|
|
width: 232px;
|
|
|
|
height: 340px;
|
|
|
|
cursor: pointer;
|
|
|
|
background: #ffffff;
|
|
|
|
|
|
|
|
&__img {
|
|
|
|
width: 232px;
|
|
|
|
height: 232px;
|
|
|
|
}
|
|
|
|
&__title {
|
|
|
|
width: 200px;
|
|
|
|
height: 45px;
|
|
|
|
line-height: 22px;
|
|
|
|
margin: 17px auto 10px;
|
|
|
|
font-size: 14px;
|
|
|
|
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
|
|
|
|
font-weight: 400;
|
|
|
|
color: #333333;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
display: -webkit-box;
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
-webkit-line-clamp: 2;
|
|
|
|
&-label {
|
|
|
|
display: inline-block;
|
|
|
|
padding: 2px 8px;
|
|
|
|
background: rgba(255, 135, 91, 0.1);
|
|
|
|
font-size: 12px;
|
|
|
|
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
|
|
|
|
font-weight: 400;
|
|
|
|
color: #ff875b;
|
|
|
|
text-align: center;
|
|
|
|
margin-right: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
&__price {
|
|
|
|
width: 200px;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|