供销新增区域无商品时推荐
This commit is contained in:
parent
3dd0926ae1
commit
1b9a98da38
@ -128,11 +128,21 @@
|
||||
<image src="@/static/images/f4.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="goodslist">
|
||||
<WaterfallsFlow :wfList="productList" :type="1" />
|
||||
<WaterfallsFlow v-if="productList.length>0" :wfList="productList" :type="1" />
|
||||
<block v-else>
|
||||
<view class="no-more">- 此区域没有更多商品了 -</view>
|
||||
<view class="common-hd">
|
||||
<view class="title">为你推荐</view>
|
||||
</view>
|
||||
<WaterfallsFlow :wfList="productList2" :type="1" />
|
||||
</block>
|
||||
</view>
|
||||
<view class='loadingicon acea-row row-center-wrapper' v-if='productList.length > 0'>
|
||||
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
|
||||
</view>
|
||||
<view class='loadingicon acea-row row-center-wrapper' v-else>
|
||||
<text class='loading iconfont icon-jiazai' :hidden='loading2==false'></text>{{loadTitle2}}
|
||||
</view>
|
||||
<view class="empty_wrapper" v-if="emptyShow">
|
||||
<u-empty :show="emptyShow" mode="list" icon="http://cdn.uviewui.com/uview/empty/list.png"></u-empty>
|
||||
</view>
|
||||
@ -227,13 +237,19 @@
|
||||
page: 1,
|
||||
limit: 6
|
||||
},
|
||||
where2: {
|
||||
category_id: 0,
|
||||
page: 1,
|
||||
limit: 6
|
||||
},
|
||||
|
||||
currentItemId: 69, // 默认获取 社区的数据 0 表示推荐 || 69 社区
|
||||
keyword: '',
|
||||
location: '',
|
||||
emptyShow: false,
|
||||
town: '',
|
||||
productList: [],
|
||||
productList: [], // 当前区域列表
|
||||
productList2: [], // 当前推荐列表
|
||||
recoList: [],
|
||||
articleList: [],
|
||||
street_id: '',
|
||||
@ -244,6 +260,9 @@
|
||||
loadend: false,
|
||||
loading: false,
|
||||
loadTitle: '加载更多',
|
||||
loadend2: false,
|
||||
loading2: false,
|
||||
loadTitle2: '加载更多',
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
@ -272,12 +291,18 @@
|
||||
},
|
||||
|
||||
onReachBottom() {
|
||||
console.log('ss');
|
||||
if (this.productList.length > 0) {
|
||||
setTimeout(() => {
|
||||
this.list(false, this.street_id);
|
||||
this.productList2 = [];
|
||||
}, 500)
|
||||
}
|
||||
|
||||
}
|
||||
else if (this.productList2.length > 0) {
|
||||
setTimeout(() => {
|
||||
this.list2(false, '');
|
||||
}, 500)
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
// 销毁监听事件
|
||||
@ -316,8 +341,6 @@
|
||||
} else if (scrollTop > 100) {
|
||||
this.backColor = 1
|
||||
this.isFshow = true
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
// #endif
|
||||
@ -330,6 +353,7 @@
|
||||
},
|
||||
//获取商品列表
|
||||
list(isPage, id) {
|
||||
if(!id) return that.list2(true, ''); // 定位没有获取到时,直接推荐
|
||||
let that = this;
|
||||
if (that.loadend) return;
|
||||
if (that.loading) return;
|
||||
@ -346,6 +370,9 @@
|
||||
}).then(res => {
|
||||
// console.log(222)
|
||||
let list = res.data.list;
|
||||
if(list.length==0){
|
||||
that.list2(true, '');
|
||||
}
|
||||
let productList = that.$util.SplitArray(list, that.productList);
|
||||
let loadend = list.length < that.where.limit;
|
||||
that.loadend = loadend;
|
||||
@ -360,10 +387,39 @@
|
||||
that.loadTitle = '加载更多';
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
list2(isPage, id) {
|
||||
let that = this;
|
||||
if (that.loadend2) return;
|
||||
if (that.loading2) return;
|
||||
|
||||
if (isPage === true) that.$set(that, 'productList2', []);
|
||||
|
||||
that.loading2 = true;
|
||||
that.loadTitle2 = '';
|
||||
cloudWarehouse({
|
||||
page: that.where2.page,
|
||||
limit: that.where2.limit,
|
||||
street_code: id,
|
||||
category_id: 0
|
||||
}).then(res => {
|
||||
// console.log(222)
|
||||
let list = res.data.list;
|
||||
let productList = that.$util.SplitArray(list, that.productList2);
|
||||
let loadend = list.length < that.where2.limit;
|
||||
that.loadend2 = loadend;
|
||||
that.loading2 = false;
|
||||
that.loadTitle2 = loadend ? '已全部加载' : '加载更多';
|
||||
that.$set(that, 'productList2', productList);
|
||||
// console.log(that.productList)
|
||||
that.$set(that.where2, 'page', that.where2.page + 1);
|
||||
if (that.where.page2 == 1 && res.data.list.length <= 0) that.emptyShow2 = true
|
||||
}).catch(err => {
|
||||
that.loading2 = false;
|
||||
that.loadTitle2 = '加载更多';
|
||||
});
|
||||
|
||||
},
|
||||
scrolling() {
|
||||
// 滚动条距文档顶部的距离
|
||||
let scrollTop =
|
||||
@ -417,7 +473,9 @@
|
||||
this.street_id = e.value[1].code
|
||||
this.town = e.value[1].name
|
||||
this.loadend = false;
|
||||
this.loadend2 = false;
|
||||
this.$set(this.where, 'page', 1)
|
||||
this.$set(this.where2, 'page', 1)
|
||||
this.list(true, this.street_id)
|
||||
this.$nextTick(() => {
|
||||
this.$bus.$emit('value-updated', e.value[1].name + ',' + e.value[1].code);
|
||||
@ -1014,5 +1072,25 @@
|
||||
.goodslist {
|
||||
margin: 0 auto;
|
||||
width: 725rpx;
|
||||
.no-more{
|
||||
text-align: center;
|
||||
padding-top: 18rpx;
|
||||
}
|
||||
.common-hd {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 118rpx;
|
||||
.title {
|
||||
padding: 0 80rpx;
|
||||
font-size: 34rpx;
|
||||
color: $theme-color;
|
||||
font-weight: bold;
|
||||
background-image: url("~@/static/images/index-title.png");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% auto;
|
||||
background-position: left center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user