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", { return request.get("product/spu/recommend", {
page: page === undefined ? 1 : page, page: page === undefined ? 1 : page,
limit: limit === undefined ? 10 : limit limit: limit === undefined ? 10 : limit,
sale_type: sale_type || null
}, { }, {
noAuth: true noAuth: true
}); });

View File

@ -47,7 +47,7 @@
</view> </view>
<view class='recommendList' :class="indexP?'on':''"> <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>
</view> </view>
</template> </template>
@ -93,7 +93,11 @@
isLogin: { isLogin: {
type: Boolean, type: Boolean,
default: false default: false
} },
sale_type:{
type: [Number, String],
default: 1
}
}, },
data() { data() {
return { return {

View File

@ -1037,7 +1037,7 @@
if (that.hotLoading) return; if (that.hotLoading) return;
that.hotLoading = true; that.hotLoading = true;
that.hotTitle = '加载中'; that.hotTitle = '加载中';
getProductHot(that.hotPage, that.hotLimit).then(res => { getProductHot(that.hotPage, that.hotLimit, 1).then(res => {
let list = res.data.list; let list = res.data.list;
let productList = that.$util.SplitArray(list, that.hostProduct); let productList = that.$util.SplitArray(list, that.hostProduct);
let hotScroll = list.length <= num && list.length != 0; let hotScroll = list.length <= num && list.length != 0;

View File

@ -133,7 +133,7 @@
<image :src="`${domain}/static/images/noCart.png`"></image> <image :src="`${domain}/static/images/noCart.png`"></image>
<view>暂无商品去添加点什么吧</view> <view>暂无商品去添加点什么吧</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' <view class='loadingicon acea-row row-center-wrapper'
v-if="hostProduct.length>5 && recommend_switch == 1"> v-if="hostProduct.length>5 && recommend_switch == 1">
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}} <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
@ -784,11 +784,13 @@
}) })
this.cartList.valid = res.data.list this.cartList.valid = res.data.list
this.cartList.invalid = res.data.fail 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; this.recommend = true;
if (!this.hostProduct.length) { this.hostProduct = [];
this.getHostProduct(); this.loadend = false;
} this.hotScroll = false;
this.hotPage = 1;
this.getHostProduct();
} else { } else {
this.recommend = false this.recommend = false
} }
@ -871,6 +873,7 @@
getProductHot( getProductHot(
that.hotPage, that.hotPage,
that.hotLimit, that.hotLimit,
that.tabsCurr
).then(res => { ).then(res => {
let list = res.data.list || []; let list = res.data.list || [];
that.hotPage++ that.hotPage++