66 lines
1.3 KiB
Vue
66 lines
1.3 KiB
Vue
<template>
|
|
<view class="item" @click="addCart">
|
|
<image :src="info.goods_image" class="img"></image>
|
|
<view class="info">
|
|
<text class="title u-line-1">{{ info.goods_name }}</text>
|
|
<text class="jianjie u-line-2">{{ info.goods_advword }}</text>
|
|
<text class="price">{{ info.goods_price }}</text>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
name:"item",
|
|
props: {
|
|
info: Object
|
|
},
|
|
methods: {
|
|
addCart() {
|
|
console.log(1);
|
|
|
|
this.$u.api.addCart({
|
|
goods_id: this.info.goods_id,
|
|
quantity: 1
|
|
}).then((res)=>{
|
|
if (res.errCode == 0) {
|
|
}
|
|
})
|
|
}
|
|
},
|
|
}
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.item{
|
|
|
|
width: 330rpx;
|
|
height: 469rpx;
|
|
margin-bottom: 27rpx;
|
|
background-color: #f8f8f8;
|
|
border-radius: 10rpx;
|
|
overflow: hidden;
|
|
.img{
|
|
width: 100%;
|
|
height: 272rpx;
|
|
|
|
}
|
|
.info{
|
|
width: 320rpx;
|
|
padding: 0 12rpx;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-around;
|
|
.title{
|
|
font-size: 30rpx;
|
|
color: #333;
|
|
}
|
|
.jianjie{
|
|
font-size: 26rpx;
|
|
color: #666;
|
|
}
|
|
.price{
|
|
color: #FF3131;
|
|
font-size: 26rpx;
|
|
}
|
|
}
|
|
}
|
|
</style> |