From cc8ea0734dab30b94380d1c6aed851fc38ea43fd Mon Sep 17 00:00:00 2001 From: weipengfei <2187978347@qq.com> Date: Fri, 22 Mar 2024 16:39:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/store.js | 5 +++-- components/recommend/index.vue | 8 ++++++-- pages/index/index.vue | 2 +- pages/order_addcart/order_addcart.vue | 13 ++++++++----- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/api/store.js b/api/store.js index 3a76c03..203c180 100644 --- a/api/store.js +++ b/api/store.js @@ -139,10 +139,11 @@ export function getBrandlist(data) { * 获取推荐产品 * */ -export function getProductHot(page, limit) { +export function getProductHot(page, limit, sale_type) { return request.get("product/spu/recommend", { page: page === undefined ? 1 : page, - limit: limit === undefined ? 10 : limit + limit: limit === undefined ? 10 : limit, + sale_type: sale_type || null }, { noAuth: true }); diff --git a/components/recommend/index.vue b/components/recommend/index.vue index ee205bd..d48a0dc 100644 --- a/components/recommend/index.vue +++ b/components/recommend/index.vue @@ -47,7 +47,7 @@ - + @@ -93,7 +93,11 @@ isLogin: { type: Boolean, default: false - } + }, + sale_type:{ + type: [Number, String], + default: 1 + } }, data() { return { diff --git a/pages/index/index.vue b/pages/index/index.vue index a50d9d8..b07c931 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1037,7 +1037,7 @@ if (that.hotLoading) return; that.hotLoading = true; that.hotTitle = '加载中'; - getProductHot(that.hotPage, that.hotLimit).then(res => { + getProductHot(that.hotPage, that.hotLimit, 1).then(res => { let list = res.data.list; let productList = that.$util.SplitArray(list, that.hostProduct); let hotScroll = list.length <= num && list.length != 0; diff --git a/pages/order_addcart/order_addcart.vue b/pages/order_addcart/order_addcart.vue index ec877a7..74e29e9 100644 --- a/pages/order_addcart/order_addcart.vue +++ b/pages/order_addcart/order_addcart.vue @@ -133,7 +133,7 @@ 暂无商品,去添加点什么吧 - + {{loadTitle}} @@ -784,11 +784,13 @@ }) this.cartList.valid = res.data.list this.cartList.invalid = res.data.fail - if (res.data.list.length == 0 && res.data.list.length == 0) { + if (res.data.list.length == 0 && res.data.fail.length == 0) { this.recommend = true; - if (!this.hostProduct.length) { - this.getHostProduct(); - } + this.hostProduct = []; + this.loadend = false; + this.hotScroll = false; + this.hotPage = 1; + this.getHostProduct(); } else { this.recommend = false } @@ -871,6 +873,7 @@ getProductHot( that.hotPage, that.hotLimit, + that.tabsCurr ).then(res => { let list = res.data.list || []; that.hotPage++