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.
|
|
<template> <view> <!-- 图片轮播 --> <swiper :current="current" :indicator-dots="banners.length > 1 ? true : false" :circular="true" class="swiper-box" indicator-active-color="#1998FE"> <swiper-item v-for="(item, index) in banners" :key="index"> <image mode="aspectFill" :src="item" style="width: 100%; height: 100%;" @click="lookImg(index)"></image> </swiper-item> </swiper> <!-- 活动列表 --> <view class="content"> <view class="item" v-for="(item,index) in list" :key="index"> <view class="cover" @click="enterDetail(index)"> <image :src="item.picture" class="lf-w-100 lf-h-100" mode="aspectFill"></image> </view> <view style="width: 420rpx;"> <view class="lf-font-28 lf-color-333 lf-line-2">{{item.title}}</view> <view class="lf-font-24 lf-color-gray lf-line-2" style="min-height: 64rpx;">本套票只包含两个成人不可带小孩本套票只包含两个成人不可带小孩本套票只包含两个成人不可带小孩</view> <view class="lf-flex lf-m-t-25"> <lf-price :price="item.price"></lf-price> <text class="lf-font-24 lf-color-gray lf-line-through lf-m-l-15">¥{{item.original_price}}</text> </view> </view> </view> </view> <!-- 加载 --> <view class="loading-more"> <text v-if="list.length" :class="{'loading-more-text': loadingClass}">{{ loadingText }}</text> <lf-nocontent v-else></lf-nocontent> </view> <!-- 回到顶部 --> <u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top> </view></template>
<script> export default { data(){ return { current: 0, banners: [{id: 1, cover: 'https://picsum.photos/375/490'}], list: [], loadingClass: false, loadingText: '已加载全部数据~', page: 1, isPage: true, pageSize: 20, special_id: 0 } }, onLoad(e){ this.special_id = e.special_id this.getActivityList(); }, methods: { lookImg(index){ this.$u.throttle(() => { let goods_banner = this.banners || []; let banners = goods_banner.map(item => item); uni.previewImage({ urls: banners, current: index }) }, 200); }, getActivityList(){ this.$http(this.API.API_SPECIALLIST,{id:this.special_id}).then(res => { let isPage = res.data.next_page_url == null?false:true; this.isPage = isPage; let list = res.data.product this.banners = res.data.picture if(!isPage){ this.loadingClass = false; this.loadingText = '已加载全部数据~'; } if(this.page == 1){ this.list = list; }else{ this.list.push(...list); } }) }, // 进入商品详情页
enterDetail(index){ let goods_id = this.list[index].id; this.$url('/pages/goodsDetail/index?goods_id='+ goods_id); } }, onReachBottom(){ if(this.isPage){ this.page = this.page + 1; this.getActivityList(); } }, onPullDownRefresh(){ this.page = 1; this.isPage = true; this.loadingClass = true; this.loadingText = '正在加载中'; this.getActivityList(); uni.stopPullDownRefresh(); } }</script>
<style lang="scss" scoped="scoped"> .swiper-box{ width: 750rpx; height: 490rpx; background-color: #FFFFFF; } .content{ padding: 0 32rpx; box-sizing: border-box; width: 750rpx; height: max-content; .item{ width: 100%; height: auto; border-bottom: 1rpx solid #E5E5E5; padding: 30rpx 0; display: flex; &:last-child{ border-bottom: none; } .cover{ width: 250rpx; height: 210rpx; border-radius: 20rpx; overflow: hidden; margin-right: 15rpx; } } }</style>
|