时味苏州
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.

141 lines
2.7 KiB

4 months ago
<template>
4 months ago
<view class="bg">
<view class="topImg relative">
<image v-if="headImg" :src="showImg(headImg)" class="topImg" mode="widthFix"></image>
</view>
4 months ago
<view class="item" v-for="(item,index) in list" :key="index" @click="gotoDetailByType(item)">
<image :src="showImg(item.headimg)" mode="aspectFill "></image>
<view class="content flex-column">
<view>
4 months ago
<view class="title text-overflowRows">{{item.title}}</view>
4 months ago
<view class="tags" v-if="item.display_tags">
<view class="tag" v-for="(tagItem,tagIndex) in item.display_tags.split(',').slice(0,2)" :key="tagIndex">
{{tagItem}}
</view>
</view>
</view>
<view class="item-bottom flex-between">
<view class="price">{{item.price / 100}}</view>
<view class="btn">预订</view>
</view>
</view>
</view>
4 months ago
</view>
4 months ago
</template>
<script>
export default {
data() {
return {
headImg:null,
4 months ago
list: [],
finished: false
}
},
onReady() {
this.getList()
this.getHeadImg(2377).then(res => {this.headImg = res})
4 months ago
},
onReachBottom() {
setTimeout(() => {
if (!this.finished) this.getList()
},1000)
},
methods: {
getList() {
this.Post({
offset: this.list.length,
limit: 10,
tag_id: 17,
sort: 'weight'
},'/api/product/get_product_by_tag').then(res => {
this.list = [...this.list, ...res.data.list]
if (res.data.list.length < 10) {
this.finished = true
}
})
}
}
}
</script>
<style lang="scss" scoped>
.bg {
min-height: 100vh;
background-color: rgba(249, 252, 243, 1);
padding-bottom: 100rpx;
}
.topImg{
width: 100%;
}
4 months ago
.item {
margin: 30rpx 26rpx;
display: flex;
image {
width: 241rpx;
4 months ago
height: 241rpx;
4 months ago
border-radius: 20rpx;
margin-right: 20rpx;
flex-shrink: 0;
}
.content {
4 months ago
height: 241rpx;
4 months ago
padding-top: 12rpx;
justify-content: space-between;
flex: 1;
.title {
font-weight: bold;
font-size: 31rpx;
color: #333333;
}
.tags {
display: flex;
margin-top: 23rpx;
.tag {
font-size: 24rpx;
color: #6A8A27;
margin-right: 11rpx;
}
.tag:not(:last-child)::after{
content: '|';
display: inline-block;
margin-left: 11rpx;
}
}
.item-bottom {
.price {
font-size: 34.67rpx;
color: rgba(220, 37, 37, 1);
}
.price::before {
font-size: 22.67rpx;
content: '¥';
}
.price::after {
font-size: 22.67rpx;
content: '起';
color: rgba(153, 153, 153, 1);
}
.btn {
width: 133rpx;
line-height: 53rpx;
background: #6A8A27;
border-radius: 12rpx;
text-align: center;
font-weight: 500;
font-size: 31rpx;
color: #FFFFFF;
}
}
}
}
</style>