Commit 63990eda by 侯体倬

指定商品逻辑优化

parent 8d46dd9c
......@@ -367,25 +367,36 @@ const componentOptions = {
}
},
async briefProduct(query) {
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;
});
const storageIds = this.getStorageSync('ids');
storageIds[this.data.goodsListIndex] = query.terminalProductIds;
this.setStorageSync('ids', storageIds);
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)
const storageDatasList = this.getStorageSync('storageDatasList');
storageDatasList[this.data.goodsListIndex] = this.data.datas.componentData;
this.setStorageSync('storageDatasList', storageDatasList);
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) {
......@@ -419,6 +430,8 @@ const componentOptions = {
goodsList = res.data.data;
let pageGoodsList = this.data.pageGoodsList[this.data.goodsListIndex] || [];
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