diff --git a/api/store.js b/api/store.js index 80bf3e1..1c96d40 100644 --- a/api/store.js +++ b/api/store.js @@ -280,6 +280,16 @@ export function getStoreGoods(id, data) { 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 diff --git a/pages/store/home/index.vue b/pages/store/home/index.vue index 1a5361a..7865378 100644 --- a/pages/store/home/index.vue +++ b/pages/store/home/index.vue @@ -379,6 +379,7 @@ import { getStoreDetail, getStoreGoods, + getStoreCloudGoods, getStoreCategory, followStore, unfollowStore, @@ -636,7 +637,9 @@ this.getCoupon(); break; case 7: - this.getCoupon(); + this.resetParmas(); + this.goods = []; + this.getCloudGoods(); break; } }, @@ -946,6 +949,36 @@ }, 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() { if (this.category.length) {