拼团列表接口
This commit is contained in:
125
pages/group-book/index.vue
Normal file
125
pages/group-book/index.vue
Normal file
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<view class="groupBook">
|
||||
<view class="top">
|
||||
<view class="title">爆款推荐</view>
|
||||
<view>省钱省心限时拼</view>
|
||||
</view>
|
||||
<!-- 有数据 -->
|
||||
<scroll-view scroll-y="true" class="scroll" @scrolltolower='scrolltolower' v-if="lists.length>0">
|
||||
<block v-for="(item,index) in lists" :key="index">
|
||||
<pinGoodsItem :item="item" @goPin="goPin" />
|
||||
</block>
|
||||
</scroll-view>
|
||||
<!-- 没数据 -->
|
||||
<scroll-view scroll-y="true" class="scroll" v-else>
|
||||
<view class="vertical pages-empty" style="padding-top: 200rpx;">
|
||||
<u-empty
|
||||
icon="http://cdn.uviewui.com/uview/empty/list.png"
|
||||
textColor="#999"
|
||||
text="暂无任何拼单商品~"
|
||||
/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pinGoodsItem from '@/components/pin-goods-item/index.vue'
|
||||
import {
|
||||
pinList
|
||||
} from '@/apis/interfaces/pin.js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
pinGoodsItem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
lists: [],
|
||||
page: 1,
|
||||
has_more: true,
|
||||
};
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
pinList({
|
||||
page: this.page
|
||||
}).then(res => {
|
||||
this.lists = this.lists.concat(res.data)
|
||||
this.has_more = res.page.has_more
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: "none",
|
||||
mask: true
|
||||
})
|
||||
})
|
||||
},
|
||||
// 触底获取更多~
|
||||
scrolltolower() {
|
||||
if (this.has_more) {
|
||||
this.page = this.page + 1
|
||||
this.getList()
|
||||
}else{
|
||||
uni.showToast({
|
||||
title:'没有更多~',
|
||||
icon:'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
// 马上拼团
|
||||
goPin(id) {
|
||||
console.log('fule gopin....')
|
||||
uni.navigateTo({
|
||||
url:'/pages/store/goods?id='+id
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.groupBook {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
position: relative;
|
||||
background: $window-color;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
|
||||
.top {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
font-size: $title-size - 2;
|
||||
color: #fff;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: $padding;
|
||||
box-sizing: border-box;
|
||||
background: linear-gradient(to bottom, #22aa98, rgba(255, 255, 255, 0));
|
||||
padding-bottom: 40vh;
|
||||
z-index: 1;
|
||||
|
||||
.title {
|
||||
font-size: 40rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.scroll {
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
padding: $padding * 4 $padding $padding $padding;
|
||||
box-sizing: border-box;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -4,7 +4,7 @@
|
||||
<view class="swiper">
|
||||
<view class="swiper-box">
|
||||
<swiper autoplay @change="swiperCount = $event.detail.current">
|
||||
<swiper-item v-for="(item, index) in banners" :key="index">
|
||||
<swiper-item v-for="(item, index) in banners" :key="index" @click="goBook(item)">
|
||||
<image :src="item.cover" mode="aspectFill"></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
@@ -107,7 +107,16 @@
|
||||
this.shops = res.shops
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
}
|
||||
},
|
||||
goBook(item){
|
||||
if(item.url){
|
||||
if(item.url.openType === 'navigateTo'){
|
||||
uni.navigateTo({
|
||||
url:item.url.path
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.getMall()
|
||||
|
||||
Reference in New Issue
Block a user