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.
shop-app/pages/index/components/Pick.vue

182 lines
4.0 KiB

<!--
* @Author: ch
* @Date: 2022-03-23 10:29:07
* @LastEditors: ch
* @LastEditTime: 2022-04-22 19:15:35
* @Description: file content
-->
<template>
<view class="pick">
<view class="max" @click="$Router.push(`/goodsDetail?id=${max.id}`)">
<view class="title">{{max.title}}</view>
<view class="desc">{{max.subtitle}}</view>
<view class="tag">
<image v-for="i in max.labelList" :key="i"
:src="i === '秒杀' ? require('@/static/index/tag1.png') :
i === '爆款' ? require('@/static/index/tag2.png') :
require('@/static/index/tag3.png')">
</view>
<!-- <view class="price">¥{{max.startingPrice}}</view> -->
<UiMoney class="price" :money="max.startingPrice" prefix></UiMoney>
<view class="img-box">
<!-- <image class="img" :src="max.recommendPicture"/> -->
<image class="img" src="https://msb-edu-dev.oss-cn-beijing.aliyuncs.com/uc/account-avatar/1111111.png"/>
</view>
</view>
<view class="min" @click="$Router.push(`/goodsDetail?id=${minOne.id}`)">
<view class="title">{{minOne.title}}</view>
<view class="min--info-box">
<view class="min--info-box-right">
<view class="desc">{{minOne.subtitle}}</view>
<view class="tag">
<image v-for="i in minOne.labelList" :key="i"
:src="i === '秒杀' ? require('@/static/index/tag1.png') :
i === '爆款' ? require('@/static/index/tag2.png') :
require('@/static/index/tag3.png')">
</view>
<UiMoney class="price" :money="minOne.startingPrice" prefix></UiMoney>
</view>
<view class="img-box">
<image class="img" :src="minOne.recommendPicture"/>
</view>
</view>
</view>
<view class="min" @click="$Router.push(`/goodsDetail?id=${minTwo.id}`)">
<view class="title">{{minTwo.title}}</view>
<view class="min--info-box">
<view class="min--info-box-right">
<view class="desc">{{minTwo.subtitle}}</view>
<view class="tag">
<image v-for="i in minTwo.labelList" :key="i"
:src="i === '秒杀' ? require('@/static/index/tag1.png') :
i === '爆款' ? require('@/static/index/tag2.png') :
require('@/static/index/tag3.png')">
</view>
<UiMoney class="price" :money="minTwo.startingPrice" prefix></UiMoney>
</view>
<view class="img-box">
<image class="img" :src="minTwo.recommendPicture"/>
</view>
</view>
</view>
</view>
</template>
<script>
import UiMoney from '../../../components/UiMoney.vue'
export default {
components: { UiMoney },
data(){
return{}
},
props:{
data : {
type : Array,
default : () => ([])
}
},
computed:{
max (){
console.log(this.data);
return this.data[0] || {}
},
minOne (){
return this.data[1] || {}
},
minTwo (){
return this.data[2] || {}
}
}
}
</script>
<style lang="scss" scoped>
.pick{
margin: 0 30rpx;
height: 450rpx;
display: flex;
flex-flow: column wrap;
justify-content: space-between;
.title,.desc{
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 24rpx;
padding: 10rpx 20rpx 0;
}
.title{
padding-top: 20rpx;
line-height: 28rpx;
font-weight: bold;
}
.tag{
padding-left: 20rpx;
padding-top: 20rpx;
image{
width: 60rpx;
height: 32rpx;
margin-right: 4rpx;
}
}
.desc{
color: $color-grey4;
font-size: 22rpx;
}
.price{
margin: 20rpx 0 10rpx 20rpx;
}
}
.max{
width: 335rpx;
height: 450rpx;
background: $color-grey0;
border-radius: 8rpx;
.img-box{
overflow: hidden;
width: 100%;
}
.img{
width: 260rpx;
height: 260rpx;
margin-left: 66rpx;
float: right;
}
}
.min{
width: 335rpx;
height: 215rpx;
background: $color-grey0;
border-radius: 8rpx;
margin-left: 20rpx;
&--info-box{
display: flex;
justify-content: space-between;
}
&--info-box-right{
width: 180rpx;
}
.img{
width: 160rpx;
height: 160rpx;
}
.desc{
margin-top: 0;
}
}
/deep/ .price{
text{
color: $color-yellow4;
font-size: $font-size-lg;
line-height: $font-size-lg;
font-weight: bold;
}
.ui-money--prefix{
font-size: $font-size-sm;
line-height: $font-size-sm;
}
}
</style>