修复bug
This commit is contained in:
parent
cb27ebeb6e
commit
b269a9dd88
@ -141,7 +141,6 @@ export function getBrandlist(data) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export function getProductHot(page, limit, sale_type, enLoad=false) {
|
export function getProductHot(page, limit, sale_type, enLoad=false) {
|
||||||
console.log(enLoad);
|
|
||||||
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,
|
||||||
|
@ -88,12 +88,12 @@
|
|||||||
<!-- 首页推荐 -->
|
<!-- 首页推荐 -->
|
||||||
<view v-if="recommend_switch == 1" class="index-product-wrapper">
|
<view v-if="recommend_switch == 1" class="index-product-wrapper">
|
||||||
<!-- 首发新品 -->
|
<!-- 首发新品 -->
|
||||||
<recommend ref="recommendRef" :hostProduct="hostProduct"
|
<recommend ref="recommendRef" :hostProduct="hostProduct[hostIndex]"
|
||||||
@changeRecommedTab="changeRecommedTab" showTab :indexP="true" :isLogin="isLogin">
|
@changeRecommedTab="changeRecommedTab" showTab :indexP="true" :isLogin="isLogin">
|
||||||
</recommend>
|
</recommend>
|
||||||
<view class="loadingicon acea-row row-center-wrapper"
|
<view class="loadingicon acea-row row-center-wrapper"
|
||||||
v-if="hostProduct.length > 0 || hotLoading">
|
v-if="hostProduct[hostIndex].length > 0 || hotLoading[hostIndex]">
|
||||||
<text class="loading iconfont icon-jiazai" :hidden="hotLoading == false"></text>
|
<text class="loading iconfont icon-jiazai" :hidden="hotLoading[hostIndex] == false"></text>
|
||||||
{{ hotTitle }}
|
{{ hotTitle }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -169,7 +169,7 @@
|
|||||||
<image :src="`${domain}/static/images/noCart.png`"></image>
|
<image :src="`${domain}/static/images/noCart.png`"></image>
|
||||||
<view>暂无商品,去看点什么吧</view>
|
<view>暂无商品,去看点什么吧</view>
|
||||||
</view>
|
</view>
|
||||||
<recommend :hostProduct="hostProduct"></recommend>
|
<recommend :hostProduct="hostProduct[hostIndex]"></recommend>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
@ -461,11 +461,12 @@
|
|||||||
limit: 6
|
limit: 6
|
||||||
},
|
},
|
||||||
is_switch: true,
|
is_switch: true,
|
||||||
hostProduct: [],
|
hostProduct: [[],[],[],[]],
|
||||||
|
hostIndex: 0,
|
||||||
hotPage: 1,
|
hotPage: 1,
|
||||||
hotLimit: 30,
|
hotLimit: 30,
|
||||||
hotScroll: true,
|
hotScroll: true,
|
||||||
hotLoading: false,
|
hotLoading: [false, false, false, false],
|
||||||
hotTitle: '加载更多',
|
hotTitle: '加载更多',
|
||||||
// #ifdef MP || APP-PLUS
|
// #ifdef MP || APP-PLUS
|
||||||
isFixed: false,
|
isFixed: false,
|
||||||
@ -1012,65 +1013,74 @@
|
|||||||
changeRecommedTab(e) {
|
changeRecommedTab(e) {
|
||||||
this.hotPage = 1;
|
this.hotPage = 1;
|
||||||
this.hotScroll = true;
|
this.hotScroll = true;
|
||||||
this.$set(this, 'hostProduct', []);
|
this.hostIndex = e-1;
|
||||||
|
let hostList = this.hostProduct;
|
||||||
|
hostList[e-1] = [];
|
||||||
|
this.$set(this, 'hostProduct', hostList);
|
||||||
this.loadGoods(e);
|
this.loadGoods(e);
|
||||||
},
|
},
|
||||||
loadGoods(e = 1) {
|
loadGoods(e = 1) {
|
||||||
if (e == 1) return this.get_host_product(true);
|
if (e == 1) return this.get_host_product(0);
|
||||||
if (e == 2) return this.get_host_home({
|
if (e == 2) return this.get_host_home({
|
||||||
mer_type: 1
|
mer_type: 1
|
||||||
}, true);
|
}, 1);
|
||||||
if (e == 3) return this.get_host_home({
|
if (e == 3) return this.get_host_home({
|
||||||
mer_type: 2
|
mer_type: 2
|
||||||
}, true);
|
}, 2);
|
||||||
if (e == 4) return this.get_host_home({
|
if (e == 4) return this.get_host_home({
|
||||||
mer_type: 3
|
mer_type: 3
|
||||||
}, true);
|
}, 3);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 获取我的推荐
|
* 获取我的推荐
|
||||||
*/
|
*/
|
||||||
get_host_product: function(reload=false) {
|
get_host_product: function(e=0) {
|
||||||
let that = this;
|
let that = this;
|
||||||
let num = that.hotLimit;
|
let num = that.hotLimit;
|
||||||
if (!that.hotScroll) return;
|
if (!that.hotScroll) return;
|
||||||
if (that.hotLoading) return;
|
if (that.hotLoading[e]) return;
|
||||||
that.hotLoading = true;
|
that.hotLoading[e] = true;
|
||||||
that.hotTitle = '加载中';
|
that.hotTitle = '加载中';
|
||||||
getProductHot(that.hotPage, that.hotLimit, 1, true).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.hostProduct;
|
||||||
|
if(!productList[e]) productList[e] = [];
|
||||||
|
productList[e] = [...productList[e], ...res.data.list];
|
||||||
let hotScroll = list.length <= num && list.length != 0;
|
let hotScroll = list.length <= num && list.length != 0;
|
||||||
that.hotScroll = hotScroll;
|
that.hotScroll = hotScroll;
|
||||||
that.hotLoading = false;
|
that.hotLoading[e] = false;
|
||||||
that.hotTitle = !hotScroll ? '已全部加载' : '加载更多';
|
that.hotTitle = !hotScroll ? '已全部加载' : '加载更多';
|
||||||
that.$set(that, 'hostProduct', productList);
|
that.$set(that, 'hostProduct', productList);
|
||||||
|
if(this.hostIndex==e) this.$forceUpdate();
|
||||||
that.$set(that, 'hotPage', that.hotPage + 1);
|
that.$set(that, 'hotPage', that.hotPage + 1);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 获取里海云仓, 云市场, 名优特产
|
* 获取里海云仓, 云市场, 名优特产
|
||||||
*/
|
*/
|
||||||
get_host_home: function(query = {}, reload) {
|
get_host_home: function(query = {}, e=1) {
|
||||||
let that = this;
|
let that = this;
|
||||||
let num = that.hotLimit;
|
let num = that.hotLimit;
|
||||||
if (!that.hotScroll) return;
|
if (!that.hotScroll) return;
|
||||||
if (that.hotLoading) return;
|
if (that.hotLoading[e]) return;
|
||||||
that.hotLoading = true;
|
that.hotLoading[e] = true;
|
||||||
that.hotTitle = '加载中';
|
that.hotTitle = '加载中';
|
||||||
query.page = that.hotPage;
|
query.page = that.hotPage;
|
||||||
query.limit = that.hotLimit;
|
query.limit = that.hotLimit;
|
||||||
query.sale_type = 1;
|
query.sale_type = 1;
|
||||||
getProductslist({
|
getProductslist({
|
||||||
...query
|
...query
|
||||||
}, true).then(res => {
|
}).then(res => {
|
||||||
let list = res.data.list;
|
let list = res.data.list;
|
||||||
let productList = that.$util.SplitArray(list, that.hostProduct);
|
let productList = that.hostProduct;
|
||||||
|
if(!productList[e]) productList[e] = [];
|
||||||
|
productList[e] = [...productList[e], ...list];
|
||||||
let hotScroll = list.length <= num && list.length != 0;
|
let hotScroll = list.length <= num && list.length != 0;
|
||||||
that.hotScroll = hotScroll;
|
that.hotScroll = hotScroll;
|
||||||
that.hotLoading = false;
|
that.hotLoading[e] = false;
|
||||||
that.hotTitle = !hotScroll ? '已全部加载' : '加载更多';
|
that.hotTitle = !hotScroll ? '已全部加载' : '加载更多';
|
||||||
that.$set(that, 'hostProduct', productList);
|
that.$set(that, 'hostProduct', productList);
|
||||||
|
if(this.hostIndex==e) this.$forceUpdate();
|
||||||
that.$set(that, 'hotPage', that.hotPage + 1);
|
that.$set(that, 'hotPage', that.hotPage + 1);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -81,7 +81,6 @@ function baseRequest(url, method, data, {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let URL = Url + '/api/' + url
|
let URL = Url + '/api/' + url
|
||||||
console.log(enLoad, HTTP_list);
|
|
||||||
if(enLoad) {
|
if(enLoad) {
|
||||||
let http = HTTP_list.get(URL);
|
let http = HTTP_list.get(URL);
|
||||||
if(http){
|
if(http){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user