|
|
|
@ -109,12 +109,13 @@ export default {
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
// 瀑布流相关
|
|
|
|
// 瀑布流相关
|
|
|
|
async splitData() {
|
|
|
|
async splitData() {
|
|
|
|
|
|
|
|
|
|
|
|
if (!this.tempList.length) return;
|
|
|
|
if (!this.tempList.length) return;
|
|
|
|
let item = this.tempList[0];
|
|
|
|
let item = this.tempList[0];
|
|
|
|
if (!item) return;
|
|
|
|
if (!item) return;
|
|
|
|
|
|
|
|
|
|
|
|
// 分左右
|
|
|
|
// 分左右
|
|
|
|
if (this.leftHeight < this.rightHeight) {
|
|
|
|
/* if (this.leftHeight < this.rightHeight) {
|
|
|
|
this.leftHeight += item.activity_discounts_tags.length ? 350 : 330;
|
|
|
|
this.leftHeight += item.activity_discounts_tags.length ? 350 : 330;
|
|
|
|
this.leftList.push(item);
|
|
|
|
this.leftList.push(item);
|
|
|
|
} else if (this.leftHeight > this.rightHeight) {
|
|
|
|
} else if (this.leftHeight > this.rightHeight) {
|
|
|
|
@ -123,8 +124,11 @@ export default {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.leftHeight += item.activity_discounts_tags.length ? 350 : 330;
|
|
|
|
this.leftHeight += item.activity_discounts_tags.length ? 350 : 330;
|
|
|
|
this.leftList.push(item);
|
|
|
|
this.leftList.push(item);
|
|
|
|
}
|
|
|
|
} */
|
|
|
|
|
|
|
|
let count = Math.floor(Math.random() * (10 - 1 + 1)) + 1;
|
|
|
|
|
|
|
|
count % 2 === 0 ? this.leftHeight +=350 : this.rightHeight +=330;
|
|
|
|
|
|
|
|
count % 2 === 0 ? this.leftList.push(item): this.rightList.push(item) ;
|
|
|
|
|
|
|
|
|
|
|
|
// 移除临时列表的第一项,如果临时数组还有数据,继续循环
|
|
|
|
// 移除临时列表的第一项,如果临时数组还有数据,继续循环
|
|
|
|
this.tempList.splice(0, 1);
|
|
|
|
this.tempList.splice(0, 1);
|
|
|
|
if (this.tempList.length) {
|
|
|
|
if (this.tempList.length) {
|
|
|
|
@ -176,20 +180,40 @@ export default {
|
|
|
|
getGoodsList() {
|
|
|
|
getGoodsList() {
|
|
|
|
let that = this;
|
|
|
|
let that = this;
|
|
|
|
that.loadStatus = 'loading';
|
|
|
|
that.loadStatus = 'loading';
|
|
|
|
|
|
|
|
console.log("good list ")
|
|
|
|
|
|
|
|
this.$jsonrpc('goods.list2',this.listParams,'加载中...').then(res=>{
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
|
|
if (this.searchVal && !historyTag.includes(this.searchVal)) {
|
|
|
|
|
|
|
|
let searchHistoryArr = JSON.stringify(this.getArr(historyTag, this.searchVal));
|
|
|
|
|
|
|
|
uni.setStorageSync('searchHistoryArr', searchHistoryArr);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (res.error.code === 200) {
|
|
|
|
|
|
|
|
that.goodsList = [...that.goodsList, ...res.result.resultGoods];
|
|
|
|
|
|
|
|
that.isEmpty = !that.goodsList.length;
|
|
|
|
|
|
|
|
that.lastPage = res.result.last_page ;
|
|
|
|
|
|
|
|
that.loadStatus = that.listParams.page < res.result.last_page ? 'loadmore' : 'nomore';
|
|
|
|
|
|
|
|
that.tempList = res.result.resultGoods;
|
|
|
|
|
|
|
|
that.splitData();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
that.$http('goods.lists', that.listParams, '加载中...').then(res => {
|
|
|
|
that.$http('goods.lists', that.listParams, '加载中...').then(res => {
|
|
|
|
if (this.searchVal && !historyTag.includes(this.searchVal)) {
|
|
|
|
if (this.searchVal && !historyTag.includes(this.searchVal)) {
|
|
|
|
let searchHistoryArr = JSON.stringify(this.getArr(historyTag, this.searchVal));
|
|
|
|
let searchHistoryArr = JSON.stringify(this.getArr(historyTag, this.searchVal));
|
|
|
|
uni.setStorageSync('searchHistoryArr', searchHistoryArr);
|
|
|
|
uni.setStorageSync('searchHistoryArr', searchHistoryArr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (res.code === 1) {
|
|
|
|
if (res.code === 1) {
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
that.goodsList = [...that.goodsList, ...res.data.data];
|
|
|
|
that.goodsList = [...that.goodsList, ...res.data.data];
|
|
|
|
that.isEmpty = !that.goodsList.length;
|
|
|
|
that.isEmpty = !that.goodsList.length;
|
|
|
|
that.lastPage = res.data.last_page;
|
|
|
|
that.lastPage = res.data.last_page;
|
|
|
|
that.loadStatus = that.listParams.page < res.data.last_page ? 'loadmore' : 'nomore';
|
|
|
|
that.loadStatus = that.listParams.page < res.data.last_page ? 'loadmore' : 'nomore';
|
|
|
|
that.tempList = res.data.data;
|
|
|
|
that.tempList = res.data.data;
|
|
|
|
that.splitData();
|
|
|
|
that.splitData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}); */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|