添加店铺云商品列表

This commit is contained in:
luofei 2024-04-01 10:58:24 +08:00
parent 311e326af3
commit 774211387e
2 changed files with 44 additions and 1 deletions

View File

@ -280,6 +280,16 @@ export function getStoreGoods(id, data) {
noAuth: true noAuth: true
}); });
} }
/**
* 获取商铺云商品列表
* @param {Object} id 商铺 id
* @param {Object} data 商铺商品列表数据
*/
export function getStoreCloudGoods(id, data) {
return request.get("product/spu/merchant/" + id + "/merCloudProduct", data, {
noAuth: true
});
}
/** /**
* 获取商铺分类列表 * 获取商铺分类列表
* @param {Object} id 商铺 id * @param {Object} id 商铺 id

View File

@ -379,6 +379,7 @@
import { import {
getStoreDetail, getStoreDetail,
getStoreGoods, getStoreGoods,
getStoreCloudGoods,
getStoreCategory, getStoreCategory,
followStore, followStore,
unfollowStore, unfollowStore,
@ -636,7 +637,9 @@
this.getCoupon(); this.getCoupon();
break; break;
case 7: case 7:
this.getCoupon(); this.resetParmas();
this.goods = [];
this.getCloudGoods();
break; break;
} }
}, },
@ -946,6 +949,36 @@
}, 1000); }, 1000);
}); });
}, },
//
getCloudGoods: function() {
let that = this;
if (that.loadend) return;
if (that.loading) return;
if (that.goodsLoading) return;
that.goodsLoading = true;
that.loadTitle = '';
getStoreCloudGoods(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);
});
},
// //
getCategory: function() { getCategory: function() {
if (this.category.length) { if (this.category.length) {