RIceWqy 2 years ago
parent b06e115977
commit f5f7d733ff

@ -361,7 +361,34 @@ export default {
getGoodsDetail() {
let that = this;
return new Promise((resolve, reject) => {
that.$http(
that.$jsonrpc('goods.detail',{id: that.$Route.query.id},'',
false).then(res=>{
console.log(res)
if (res.error.code === 200) {
that.showEmpty = false;
that.goodsInfo = res.result;
if (that.goodsInfo.activity_type) {
that.activityRules.status = that.goodsInfo.activity.status_code;
}
share.setShareInfo({
title: that.goodsInfo.title,
desc: that.goodsInfo.subtitle,
image: that.goodsInfo.image,
params: {
page: 2,
pageId: that.$Route.query.id
}
});
that.getCommentList();
resolve(res.result);
} else {
resolve(false);
// that.$u.toast(res.msg);
that.showEmpty = true;
that.showEmptyText = res.result.title;
}
});
/* that.$http(
'goods.detail',
{
id: that.$Route.query.id
@ -392,7 +419,7 @@ export default {
that.showEmpty = true;
that.showEmptyText = res.msg;
}
});
}); */
});
},
//

@ -109,12 +109,13 @@ export default {
methods: {
//
async splitData() {
if (!this.tempList.length) return;
let item = this.tempList[0];
if (!item) return;
//
if (this.leftHeight < this.rightHeight) {
/* if (this.leftHeight < this.rightHeight) {
this.leftHeight += item.activity_discounts_tags.length ? 350 : 330;
this.leftList.push(item);
} else if (this.leftHeight > this.rightHeight) {
@ -123,7 +124,10 @@ export default {
} else {
this.leftHeight += item.activity_discounts_tags.length ? 350 : 330;
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);
@ -176,12 +180,32 @@ export default {
getGoodsList() {
let that = this;
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 => {
if (this.searchVal && !historyTag.includes(this.searchVal)) {
let searchHistoryArr = JSON.stringify(this.getArr(historyTag, this.searchVal));
uni.setStorageSync('searchHistoryArr', searchHistoryArr);
}
if (res.code === 1) {
console.log(res)
that.goodsList = [...that.goodsList, ...res.data.data];
that.isEmpty = !that.goodsList.length;
that.lastPage = res.data.last_page;
@ -189,7 +213,7 @@ export default {
that.tempList = res.data.data;
that.splitData();
}
});
}); */
}
}
};

@ -162,6 +162,18 @@ export default {
method: "GET",
// desc: '商品列表',
},
list: {
url: "goods/list",
auth: false,
method: "GET",
// desc: '商品列表',
},
list2: {
url: "goods/list2",
auth: false,
method: "GET",
// desc: '商品列表',
},
seckillList: {
url: "goods/seckillList",
auth: false,

@ -148,7 +148,7 @@ async requestJson(options = {}) {
options.data = createJsonRpc
options.method="POST"
console.log(createJsonRpc)
/* let mergeUrl = Request.isUrl(options.url) ? options.url : (options.baseUrl + options.url)
if (JSON.stringify(options.params) !== '{}') {
let query = Request.addQueryString(options.params);

Loading…
Cancel
Save