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/components/UiGoodsGroup.vue

189 lines
4.6 KiB

3 years ago
<!--
* @Author: ch
3 years ago
* @Date: 2022-04-07 17:22:44
3 years ago
* @LastEditors: ch
3 years ago
* @LastEditTime: 2022-04-30 15:51:52
3 years ago
* @Description: file content
-->
3 years ago
3 years ago
<template>
3 years ago
<view class="goods">
<view class="goods--column">
<view class="goods-item" v-for="item in goodsLeftData" :key="item.id"
@click="$Router.push(`/goodsDetail?id=${item.id}`)">
<image class="goods-item--img" :src="item.mainPicture" mode="widthFix"></image>
3 years ago
<view class="goods-item--title" :class="item.tagList && item.tagList.length && 'goods-item--title__indent'">
3 years ago
<image class="goods-item--tag" v-for="i in item.tagList" :key="i.code" src="@/static/goods/tag2.png"/>
<text>{{item.name}}</text>
</view>
3 years ago
<view class="goods-item--pirce-box">
<UiMoney :money="item.startingPrice" prefix class="goods-item--pirce"/>
3 years ago
<image class="goods-item--seckill" v-if="item.seckill" src="@/static/goods/tag4.png"/>
<!-- <view>
3 years ago
<text class="goods-item--pirce">{{item.startingPrice}}</text>
<text class="goods-item--original-pirce">50</text>
</view> -->
3 years ago
<!-- <view>
3 years ago
<image class="goods-item--icon" src='@/static/index/bz.png'></image>
3 years ago
</view> -->
3 years ago
</view>
3 years ago
<!-- <view class="goods-item--activity">
3 years ago
<text class="goods-item--activity-title">秒杀</text>
<text class="goods-item--activity-desc">正在抢购中</text>
3 years ago
</view> -->
3 years ago
</view>
</view>
3 years ago
<view class="goods--column">
<view class="goods-item" v-for="item in goodsRightData" :key="item.id"
@click="$Router.push(`/goodsDetail?id=${item.id}`)">
<image class="goods-item--img" :src="item.mainPicture" mode="widthFix"></image>
3 years ago
<view class="goods-item--title" :class="item.tagList.length && 'goods-item--title__indent'">
<image class="goods-item--tag" v-for="i in item.tagList" :key="i.code" src="@/static/goods/tag2.png"/>
<text>{{item.name}}</text>
</view>
3 years ago
<view class="goods-item--pirce-box">
<UiMoney :money="item.startingPrice" prefix class="goods-item--pirce"/>
3 years ago
<image class="goods-item--seckill" v-if="item.seckill" src="@/static/goods/tag4.png"/>
<!-- <view>
3 years ago
<text class="goods-item--pirce">{{item.startingPrice}}</text>
<text class="goods-item--original-pirce">50</text>
</view> -->
3 years ago
<!-- <view>
3 years ago
<image class="goods-item--icon" src='@/static/index/bz.png'></image>
3 years ago
</view> -->
3 years ago
</view>
3 years ago
<!-- <view class="goods-item--activity">
3 years ago
<text class="goods-item--activity-title">秒杀</text>
<text class="goods-item--activity-desc">正在抢购中</text>
3 years ago
</view> -->
3 years ago
</view>
</view>
</view>
</template>
3 years ago
<script>
import UiMoney from './UiMoney.vue';
3 years ago
export default {
components: { UiMoney },
3 years ago
data(){
return {
}
},
3 years ago
props: {
listData : {
type : Array,
defalut : []
}
3 years ago
},
computed:{
goodsLeftData (){
return this.listData.filter((item, index) => index % 2 === 0);
},
goodsRightData(){
return this.listData.filter((item, index) => index % 2 !== 0);
}
},
3 years ago
mounted(){
},
methods : {
3 years ago
}
}
</script>
3 years ago
<style lang="scss" scoped>
.goods{
padding: 0 30rpx;
display: flex;
justify-content: space-between;
flex-flow:wrap;
&--column{
width: 335rpx;
}
&-item{
width: 335rpx;
border-radius: 8rpx;
background: $color-grey0;
3 years ago
margin-bottom: 30rpx;
overflow: hidden;
padding-bottom: 20rpx;
&--img{
width: 100%;
}
&--title{
font-size: $font-size-base;
padding: 20rpx 20rpx 24rpx;
line-height: 36rpx;
font-weight: bold;
3 years ago
&__indent{
text-indent: 76rpx;
position: relative;
}
}
&--tag{
width: 60rpx;
height: 32rpx;
margin-right: 16rpx;
position: absolute;
left: 24rpx;
3 years ago
}
&--pirce-box{
padding:0 20rpx;
display: flex;
3 years ago
}
&--seckill{
width: 60rpx;
height: 32rpx;
margin-left: 13rpx;
3 years ago
}
&--original-pirce{
color: $color-grey3;
3 years ago
font-size: 20rpx;
text-decoration: line-through;
margin-left: 15rpx;
}
&--icon{
width: 22rpx;
height: 24rpx;
}
&--activity{
height: 40rpx;
line-height: 40rpx;
margin:20rpx 20rpx 0;
background: $color-yellow0;
3 years ago
border-radius: 20rpx;
font-size: 22rpx;
color: $color-yellow4;
3 years ago
display: flex;
&-title{
height: 40rpx;
display: block;
border-radius: 20rpx;
padding: 0 14rpx;
background: $color-yellow4;
color: $color-grey0;
3 years ago
}
&-desc{
flex: 1 1 auto;
text-align: center;
}
}
}
}
/deep/ {
.goods-item--pirce{
text{
font-size: $font-size-lg;
line-height: 32rpx;
color: $color-yellow4;
font-weight: bold;
}
.ui-money--prefix{
font-size: $font-size-sm;
}
}
}
3 years ago
</style>