leave-unused/pages/idle/idle.vue

122 lines
3.9 KiB
Vue

<template>
<view class="pad-x120" v-if="isLoading">
<!-- 头部 -->
<status-nav :ifReturn="false" navBarTitle="奥园三期-闲置商品" :ifCenter="false"></status-nav>
<!-- 商品列表 -->
<goods-list :goodsList="goodsList"></goods-list>
<!-- 没有更多 -->
<view class="no-more mar-s20 font24 color-99">没有更多数据了</view>
<!-- 尾部 -->
<tabbar></tabbar>
</view>
</template>
<script>
import goodList from '@/components/goods-list/goods-list.vue';
import tabbar from '@/components/tabbar/tabbar';
export default {
components:{
goodList,
tabbar
},
data() {
return {
statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度
goodsList:[], //商品列表
page:1, //页数
size:10, //条数
total:0, //总数
isLoading:false, //是否加载完成
}
},
onShow() {
// 查询商品列表
this.getGoodsList();
},
onShareAppMessage(res) {
let shareObj = {
title:'老农极鲜',
path: uni.getStorageSync('page-path-options')+'?invite_code='+uni.getStorageSync('invite_code'),
imageUrl:'/static/img/shear-index.jpg',
}
// 返回shareObj
return shareObj;
},
onShareTimeline(res){
let shareObj = {
title:'老农极鲜',
query: '?invite_code='+uni.getStorageSync('invite_code'),
path: uni.getStorageSync('page-path-options')+'?invite_code='+uni.getStorageSync('invite_code'),
imageUrl:'/static/img/shear-index.jpg',
}
// 返回shareObj
return shareObj;
},
onReachBottom(e) {
if(this.goodsList.length<this.total){
this.page++;
//
this.getGoodsList();
}
},
methods: {
//
getGoodsList(){
this.goodsList = [
{id:0,name:'',cover:'/static/index-01.png',price:'30.00',original_price:'120.00',state:1},
{id:0,name:'',cover:'/static/index-02.png',price:'480.00',original_price:'160.00',state:1},
{id:0,name:'尿',cover:'/static/index-03.png',price:'120.00',original_price:'480.00',state:1},
{id:0,name:'',cover:'/static/index-01.png',price:'30.00',original_price:'120.00',state:1},
{id:0,name:'',cover:'/static/index-02.png',price:'480.00',original_price:'160.00',state:1},
{id:0,name:'尿',cover:'/static/index-03.png',price:'120.00',original_price:'480.00',state:1},
{id:0,name:'',cover:'/static/index-01.png',price:'30.00',original_price:'120.00',state:1},
{id:0,name:'',cover:'/static/index-02.png',price:'480.00',original_price:'160.00',state:1},
{id:0,name:'尿',cover:'/static/index-03.png',price:'120.00',original_price:'480.00',state:1},
{id:0,name:'',cover:'/static/index-01.png',price:'30.00',original_price:'120.00',state:1},
{id:0,name:'',cover:'/static/index-02.png',price:'480.00',original_price:'160.00',state:1},
{id:0,name:'尿',cover:'/static/index-03.png',price:'120.00',original_price:'480.00',state:1}
]
this.isLoading = true;
// uni.showLoading({
// title:''
// })
// let params = {
// page:this.page,
// size:this.size,
// addr_id:id
// }
// this.$requst.get('/api/spu/list',params).then(res=>{
// if(res.code == 0){
// console.log(res,'商品列表')
// this.total = res.data.total;
// let goodsArr = [];
// res.data.list.forEach(item=>{
// let obj = {
// id:item.id,
// cover:item.cover,
// name:item.name,
// price:item.price
// }
// goodsArr.push(obj)
// })
// this.goodsList = this.goodsList.concat(goodsArr);
// }
// uni.hideLoading();
// this.isLoading = true;
// })
},
//
goDetail(id){
uni.navigateTo({
url:`/pages/index/detail?id=${id}`
})
},
}
}
</script>
<style scoped>
.no-more{
text-align: center;
line-height: 2;
}
</style>