Commit 63990eda by 侯体倬

指定商品逻辑优化

parent 8d46dd9c
...@@ -367,25 +367,36 @@ const componentOptions = { ...@@ -367,25 +367,36 @@ const componentOptions = {
} }
}, },
async briefProduct(query) { async briefProduct(query) {
await goodsApi.queryBriefProductInfo(query).then(res => { const storageIds = this.getStorageSync('ids');
if (res.data.code == 200) { storageIds[this.data.goodsListIndex] = query.terminalProductIds;
let data = res.data.data.list; this.setStorageSync('ids', storageIds);
let ids = data.map(element => {
let goodsList = this.render ? res.data.list : res.data.data.list;
return element.terminalProductId;
});
let storageIds = this.getStorageSync('ids') const storageDatasList = this.getStorageSync('storageDatasList');
storageIds[this.data.goodsListIndex] = ids storageDatasList[this.data.goodsListIndex] = this.data.datas.componentData;
this.setStorageSync('ids',storageIds) this.setStorageSync('storageDatasList', storageDatasList);
let storageDatasList = this.getStorageSync('storageDatasList')
storageDatasList[this.data.goodsListIndex] = this.data.datas.componentData
this.setStorageSync('storageDatasList',storageDatasList)
this.moreProduct(true); this.moreProduct(true);
}
}); // FIXME: 原来逻辑
// await goodsApi.queryBriefProductInfo(query).then(res => {
// if (res.data.code == 200) {
// let data = res.data.data.list;
// let ids = data.map(element => {
// let goodsList = this.render ? res.data.list : res.data.data.list;
// return element.terminalProductId;
// });
// let storageIds = this.getStorageSync('ids')
// storageIds[this.data.goodsListIndex] = ids
// this.setStorageSync('ids',storageIds)
// let storageDatasList = this.getStorageSync('storageDatasList')
// storageDatasList[this.data.goodsListIndex] = this.data.datas.componentData
// this.setStorageSync('storageDatasList',storageDatasList)
// this.moreProduct(true);
// }
// });
}, },
async moreProduct(flag) { async moreProduct(flag) {
...@@ -419,6 +430,8 @@ const componentOptions = { ...@@ -419,6 +430,8 @@ const componentOptions = {
goodsList = res.data.data; goodsList = res.data.data;
let pageGoodsList = this.data.pageGoodsList[this.data.goodsListIndex] || []; let pageGoodsList = this.data.pageGoodsList[this.data.goodsListIndex] || [];
this.goodsListVal(goodsList, 1,flag); this.goodsListVal(goodsList, 1,flag);
} else {
this.setData({ scrollLoading: false });
} }
}); });
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment