126 lines
3.5 KiB
Vue
126 lines
3.5 KiB
Vue
<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>
|