This commit is contained in:
weipengfei 2024-03-22 16:39:12 +08:00
parent 8ac54b5542
commit cc8ea0734d
4 changed files with 18 additions and 10 deletions

View File

@ -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
});

View File

@ -47,7 +47,7 @@
</view>
<view class='recommendList' :class="indexP?'on':''">
<WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" />
<WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" :sale_type="sale_type"/>
</view>
</view>
</template>
@ -93,7 +93,11 @@
isLogin: {
type: Boolean,
default: false
}
},
sale_type:{
type: [Number, String],
default: 1
}
},
data() {
return {

View File

@ -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;

View File

@ -133,7 +133,7 @@
<image :src="`${domain}/static/images/noCart.png`"></image>
<view>暂无商品去添加点什么吧</view>
</view>
<recommend v-if="recommend_switch == 1" :hostProduct='hostProduct' :isLogin="isLogin"></recommend>
<recommend v-if="recommend_switch == 1" :hostProduct='hostProduct' :isLogin="isLogin" :sale_type="tabsCurr"></recommend>
<view class='loadingicon acea-row row-center-wrapper'
v-if="hostProduct.length>5 && recommend_switch == 1">
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{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++