常熟
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.
 
 
 
 

153 lines
2.9 KiB

<template>
<view class="bg">
<image :src="showImg(topImg)" mode="aspectFill" class="topImg"></image>
<view class="type-box flex-around">
<view v-for="(item,index) in typeList" :key="index" :class="index == typeIndex ? 'type-active' : ''" @click="changeType(index)">
{{item.title}}
</view>
</view>
<view class="box flex-between">
<view v-for="(item,index) in list" :key="index" class="item">
<image :src="showImgs(item.headimg)" mode="aspectFill"></image>
<view class="content flex-column">
<view class="title text-overflowRows">{{item.title}}</view>
<view class="price">{{item.price / 100}}</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
topImg: 'https://static.ticket.sz-trip.com/changshu/images/rim/topImg.png',
typeList: [
{title: '景点', id: '616'},
{title: '线路', id: '617'},
{title: '特产', id: '618'},
],
typeIndex: 0,
list: [],
limit: 10
}
},
onReady() {
this.getList()
},
onReachBottom() {
setTimeout(() => {
if (!this.isLoading) this.getList();
}, 500);
},
methods: {
changeType(index) {
this.typeIndex = index
this.list = []
this.getList()
},
getList() {
this.Post({
apiType: 'jdsz',
tag_id: this.typeList[this.typeIndex].id,
offset: this.list.length,
limit: this.limit,
}, '/api/product/get_product_by_tag').then(res => {
if(res) {
if(res.data.list.length < this.limit) this.isLoading = true
this.list = this.list.concat(res.data.list)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.bg {
width: 750rpx;
min-height: 100vh;
background: #F7F7F7;
padding-bottom: 100rpx;
}
.topImg {
width: 100%;
height: 309.33rpx;
}
.type-box {
width: 750rpx;
height: 93rpx;
background: #FFFFFF;
font-weight: 500;
font-size: 35rpx;
color: #333333;
.type-active {
font-weight: bold;
font-size: 35rpx;
color: #00AEA0;
position: relative;
}
.type-active::after {
content: "";
position: absolute;
left: 0;
right: 0;
bottom: -15rpx;
margin: auto;
width: 33rpx;
height: 4rpx;
background: #00AEA0;
border-radius: 2rpx;
}
}
.box {
margin: 26rpx auto 0;
padding: 0 26.67rpx;
flex-wrap: wrap;
.item {
width: 340rpx;
height: 433rpx;
background: #FFFFFF;
border-radius: 13rpx;
overflow: hidden;
margin-bottom: 14rpx;
padding: 6.67rpx;
image {
width: 327rpx;
height: 267rpx;
border-radius: 13rpx;
}
.content {
height: 160rpx;
padding: 5rpx 10rpx 25rpx;
justify-content: space-between;
.title {
font-weight: bold;
font-size: 31rpx;
color: #333333;
}
.price {
font-weight: bold;
font-size: 34rpx;
color: #ED1C18;
}
.price::before {
content: '¥';
font-size: 24rpx;
}
}
}
}
</style>