调整店铺云商品列表查询

This commit is contained in:
luofei 2023-05-31 15:23:40 +08:00
parent a9400f5482
commit c0e56f82ea

View File

@ -525,7 +525,7 @@
order: '', order: '',
keyword: '', keyword: '',
page: 1, page: 1,
limit: 30 limit: 10
}, },
// //
select: { select: {
@ -768,11 +768,34 @@
}).exec(); }).exec();
}, },
methods: { methods: {
async getProductSpu() { getProductSpu() {
console.log('获取云仓商品', this.id); let that = this;
const { data } = await getProductSpuAPI(this.id) if (that.loadend) return;
this.goods = data.list if (that.loading) return;
console.log('data', data); if (that.goodsLoading) return;
that.goodsLoading = true;
that.loadTitle = '';
getProductSpuAPI(that.id, that.where).then(res => {
that.goodsLoading = false;
let list = res.data.list;
let goodsList = that.$util.SplitArray(list, that.goods);
let loadend = list.length < that.where.limit;
that.loadend = loadend;
that.loading = false;
that.loadTitle = loadend ? '已全部加载' : '加载更多';
that.$set(that, 'goods', goodsList);
that.$set(that.where, 'page', that.where.page + 1);
}).catch(err => {
that.loading = false;
that.goodsLoading = false;
uni.showToast({
title: err,
icon: 'none'
})
setTimeout(function() {
uni.navigateBack()
}, 1000);
});
}, },
//#ifndef H5 //#ifndef H5
call: function() { call: function() {
@ -788,7 +811,11 @@
const query = uni.createSelectorQuery().in(this); const query = uni.createSelectorQuery().in(this);
query.select('#goods').boundingClientRect(data => { query.select('#goods').boundingClientRect(data => {
if (data.bottom < 1500 && data.top < 0) { if (data.bottom < 1500 && data.top < 0) {
this.getGoods(); if (this.tabActive == 7) {
this.getProductSpu()
} else {
this.getGoods();
}
} }
}).exec(); }).exec();
// //