2022-10-14 06:49:07 +00:00
|
|
|
<template>
|
|
|
|
<view class="pad-x120" v-if="isLoading">
|
|
|
|
<!-- 头部 -->
|
2022-10-20 13:07:14 +00:00
|
|
|
<status-nav :ifReturn="false" :navBarTitle="pageTitle" :estate="1" :ifCenter="false"></status-nav>
|
2022-12-02 10:12:31 +00:00
|
|
|
<!-- 轮播 -->
|
|
|
|
<view class="index-top">
|
|
|
|
<swiper-pu newRadius="0" :bannerList="bannerList" newHeight="320rpx" :isplay='isplay'></swiper-pu>
|
|
|
|
</view>
|
2022-12-05 02:35:44 +00:00
|
|
|
<!-- 商品分类 -->
|
|
|
|
<goods-cate @changeCateEv="changeCateEv"></goods-cate>
|
2022-10-14 06:49:07 +00:00
|
|
|
<!-- 商品列表 -->
|
|
|
|
<goods-list :goodsList="goodsList"></goods-list>
|
|
|
|
<!-- 没有更多 -->
|
2022-10-20 13:07:14 +00:00
|
|
|
<view class="no-more mar-s20 font24 color-99" v-if="goodsList.length==total">没有更多数据了</view>
|
2022-11-28 07:21:53 +00:00
|
|
|
<!-- 发布按钮 -->
|
|
|
|
<release-btn></release-btn>
|
2022-10-14 06:49:07 +00:00
|
|
|
<!-- 尾部 -->
|
|
|
|
<tabbar></tabbar>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
<script>
|
2022-12-02 10:12:31 +00:00
|
|
|
import swiperPu from '@/components/swipers/swiper-pu';
|
2022-12-05 02:35:44 +00:00
|
|
|
import goodsCate from '@/components/goods-cate/goods-cate.vue';
|
2022-10-14 08:57:38 +00:00
|
|
|
import goodsList from '@/components/goods-list/goods-list.vue';
|
2022-11-28 07:21:53 +00:00
|
|
|
import releaseBtn from '@/components/release-btn/release-btn.vue';
|
2022-10-14 06:49:07 +00:00
|
|
|
import tabbar from '@/components/tabbar/tabbar';
|
|
|
|
export default {
|
|
|
|
components:{
|
2022-12-02 10:12:31 +00:00
|
|
|
swiperPu,
|
2022-12-05 02:35:44 +00:00
|
|
|
goodsCate,
|
2022-10-14 08:57:38 +00:00
|
|
|
goodsList,
|
2022-11-28 07:21:53 +00:00
|
|
|
releaseBtn,
|
2022-10-14 06:49:07 +00:00
|
|
|
tabbar
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度
|
2022-10-20 13:07:14 +00:00
|
|
|
pageTitle:'', //页面标题
|
2022-12-02 10:12:31 +00:00
|
|
|
bannerList:[],//轮播图
|
2022-10-14 06:49:07 +00:00
|
|
|
goodsList:[], //商品列表
|
2022-10-20 13:07:14 +00:00
|
|
|
category_id:0, //分类id
|
|
|
|
keyword:'', //关键词
|
2022-10-14 06:49:07 +00:00
|
|
|
page:1, //页数
|
|
|
|
size:10, //条数
|
|
|
|
total:0, //总数
|
|
|
|
isLoading:false, //是否加载完成
|
2022-10-20 13:07:14 +00:00
|
|
|
area_id:0, //小区id
|
2022-10-14 06:49:07 +00:00
|
|
|
}
|
|
|
|
},
|
2022-10-20 13:07:14 +00:00
|
|
|
onLoad() {
|
|
|
|
if(uni.getStorageSync('area_id')&&uni.getStorageSync('area_name')){
|
|
|
|
this.area_id = uni.getStorageSync('area_id');
|
|
|
|
this.pageTitle = uni.getStorageSync('area_name')+'-闲置商品';
|
|
|
|
// 查询商品列表
|
2022-12-05 02:35:44 +00:00
|
|
|
this.getGoodsList(this.category_id);
|
2022-10-20 13:07:14 +00:00
|
|
|
}else{
|
2022-11-02 06:15:55 +00:00
|
|
|
uni.navigateTo({
|
2022-12-05 02:35:44 +00:00
|
|
|
url:'/pagesA/estate/estate?estate=1'
|
2022-11-02 06:15:55 +00:00
|
|
|
})
|
2022-10-20 13:07:14 +00:00
|
|
|
}
|
2022-12-02 10:12:31 +00:00
|
|
|
// 获取banner列表
|
|
|
|
this.getBannerList();
|
2022-10-14 06:49:07 +00:00
|
|
|
},
|
|
|
|
onShareAppMessage(res) {
|
|
|
|
let shareObj = {
|
2022-11-02 06:15:55 +00:00
|
|
|
title:'小区闲置',
|
|
|
|
path: uni.getStorageSync('page-path-options'),
|
|
|
|
imageUrl:'/static/share-logo.png',
|
2022-10-14 06:49:07 +00:00
|
|
|
}
|
|
|
|
// 返回shareObj
|
|
|
|
return shareObj;
|
|
|
|
},
|
|
|
|
onShareTimeline(res){
|
|
|
|
let shareObj = {
|
2022-11-02 06:15:55 +00:00
|
|
|
title:'小区闲置',
|
|
|
|
path: uni.getStorageSync('page-path-options'),
|
|
|
|
imageUrl:'/static/share-logo.png',
|
2022-10-14 06:49:07 +00:00
|
|
|
}
|
|
|
|
// 返回shareObj
|
|
|
|
return shareObj;
|
|
|
|
},
|
|
|
|
onReachBottom(e) {
|
|
|
|
if(this.goodsList.length<this.total){
|
|
|
|
this.page++;
|
|
|
|
// 查询商品列表
|
2022-12-05 02:35:44 +00:00
|
|
|
this.getGoodsList(this.category_id);
|
2022-10-14 06:49:07 +00:00
|
|
|
}
|
|
|
|
},
|
2022-12-02 10:12:31 +00:00
|
|
|
onHide() {
|
|
|
|
clearTimeout(this.playTimer);
|
|
|
|
this.isplay =false;
|
|
|
|
},
|
|
|
|
onPullDownRefresh() {
|
|
|
|
this.page = 1;
|
|
|
|
// 查询商品列表
|
2022-12-05 02:35:44 +00:00
|
|
|
this.getGoodsList(this.category_id);
|
2022-12-02 10:12:31 +00:00
|
|
|
// 关闭下拉刷新
|
|
|
|
uni.stopPullDownRefresh();
|
|
|
|
},
|
2022-10-14 06:49:07 +00:00
|
|
|
methods: {
|
2022-12-02 10:12:31 +00:00
|
|
|
// 获取轮播图事件
|
|
|
|
getBannerList(){
|
|
|
|
this.$requst.get('/api/v1/common/slides',{position:'home-banner'}).then(res=>{
|
|
|
|
if(res.code==0){
|
|
|
|
console.log(res,'轮播图列表')
|
|
|
|
res.data.forEach(item=>{
|
|
|
|
let isVideo = false
|
|
|
|
if(item.type!='img') isVideo = true;
|
|
|
|
let banObj = {
|
|
|
|
imgSrc:item.src,
|
|
|
|
url:item.url,
|
|
|
|
isVideo:isVideo,
|
|
|
|
poster:item.src,
|
|
|
|
}
|
|
|
|
this.bannerList.push(banObj);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
2022-10-20 13:07:14 +00:00
|
|
|
// 查询商品列表
|
2022-12-05 02:35:44 +00:00
|
|
|
getGoodsList(id){
|
2022-10-20 13:07:14 +00:00
|
|
|
uni.showLoading({
|
|
|
|
title:'加载中'
|
|
|
|
})
|
|
|
|
let params = {
|
|
|
|
page:this.page,
|
|
|
|
size:this.size,
|
2022-12-05 02:35:44 +00:00
|
|
|
area_id:this.area_id,
|
|
|
|
category_id:id
|
2022-10-20 13:07:14 +00:00
|
|
|
}
|
|
|
|
if(this.page==1) this.goodsList = [];
|
|
|
|
this.$requst.get('/api/v1/goods/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.title,
|
|
|
|
original_price:item.original_price,
|
|
|
|
price:item.price
|
|
|
|
}
|
|
|
|
goodsArr.push(obj)
|
|
|
|
})
|
|
|
|
this.goodsList = this.goodsList.concat(goodsArr);
|
|
|
|
}
|
|
|
|
uni.hideLoading();
|
|
|
|
this.isLoading = true;
|
2022-10-14 06:49:07 +00:00
|
|
|
})
|
|
|
|
},
|
2022-12-05 02:35:44 +00:00
|
|
|
// 分类选择事件
|
|
|
|
changeCateEv(category_id) {
|
|
|
|
this.category_id = category_id;
|
|
|
|
// 查询商品列表
|
|
|
|
this.getGoodsList(this.category_id);
|
|
|
|
}
|
2022-10-14 06:49:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
.no-more{
|
|
|
|
text-align: center;
|
|
|
|
line-height: 2;
|
|
|
|
}
|
2022-11-28 07:21:53 +00:00
|
|
|
/* 发布按钮 */
|
|
|
|
.release-btn{
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
width: 90rpx;
|
|
|
|
height: 90rpx;
|
|
|
|
font-size: 50rpx;
|
|
|
|
line-height: 80rpx;
|
|
|
|
animation: scale_name 1s linear alternate infinite;
|
|
|
|
position: fixed;
|
|
|
|
right: 20rpx;
|
|
|
|
bottom: 120rpx;
|
|
|
|
z-index: 99;
|
|
|
|
}
|
|
|
|
.release-btn .img{
|
|
|
|
width: 48rpx;
|
|
|
|
height: 48rpx;
|
|
|
|
}
|
|
|
|
@keyframes scale_name {
|
|
|
|
from {
|
|
|
|
transform: scale(.9);
|
|
|
|
}
|
|
|
|
to {
|
|
|
|
transform: scale(1.1);
|
|
|
|
}
|
|
|
|
}
|
2022-10-14 06:49:07 +00:00
|
|
|
</style>
|