Files
dtx_store/pages/store/vip-list/vip-list.vue

127 lines
3.6 KiB
Vue

<template>
<view class="groupBook">
<view class="top">
<view class="title">VIP换购</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">
<vipGoodsItem :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="暂无VIP商品~"
/>
</view>
</scroll-view>
</view>
</template>
<script>
import vipGoodsItem from '@/components/vip-goods-item/index.vue'
import {
lists
} from '@/apis/interfaces/store.js'
export default {
components: {
vipGoodsItem
},
data() {
return {
lists: [],
page: 1,
has_more: true,
};
},
onLoad() {
this.getList()
},
methods: {
getList() {
lists({
is_user:'1',
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, #d81e06, 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>