Merge branch 'feature/browser-0520-zz' into feature/task1.0.0

feature/task1.0.0
张征 3 years ago
commit 5cadaab959

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 51 KiB

@ -275,10 +275,8 @@ export default {
order: "",
});
vm.detailData = res1.result;
vm.skuData = res2.result.map(i => {
i.attributeSymbolList = i.attributeSymbolList.split(',')
return i;
});
vm.skuData = res2.result;
vm.recommendedData = res3.result.records;
vm.pageLoading = false;
if (
@ -310,7 +308,7 @@ export default {
curSku() {
return (
this.skuData.find(
(i) => i.attributeSymbolList.join(',') === this.selectedSymbol.join(",")
(i) => i.attributeSymbolList === this.selectedSymbol.join(",")
) || {}
);
},
@ -319,9 +317,9 @@ export default {
return this.detailData.attributeGroupList
.map((item) => {
const activeAttr = item.attributes.find((i) => i.active);
return activeAttr?.symbol;
return activeAttr ? activeAttr.symbol : ".";
})
.filter((i) => i).sort();
.filter((i) => i)//.sort();
},
/**
* 最大可购买数量
@ -461,43 +459,26 @@ export default {
setDisabledItem(item, groupIndex) {
let vm = this;
vm.detailData.attributeGroupList.forEach((group, idx) => {
// if(groupIndex === idx) return false;
//
group.attributes.forEach( item => {
let symbolCache = Object.assign([],vm.selectedSymbol);
symbolCache.push(item.symbol);
symbolCache.sort();
const res = vm.skuData.filter(item =>
symbolCache.map(i => item.attributeSymbolList.includes(i.toString())).every(i => i)
).find(i => i.stock > 0);
if(res){
item.disabled = false;
}else{
item.disabled = true;
}
});
})
// vm.detailData.attributeGroupList.forEach((group, idx) => {
// //
// let symbolCache = Object.assign([], this.selectedSymbol);
// //
// if (groupIndex === idx) return false;
// //
// group.attributes.forEach((item) => {
// //
// symbolCache[idx] = item.symbol;
// const reg = new RegExp(symbolCache.join(","));
// // SKU
// const res = vm.skuData
// .filter((i) => reg.test(i.attributeSymbolList))
// .find((i) => i.stock > 0);
// if (res) {
// item.disabled = false;
// } else {
// item.disabled = true;
// }
// });
// });
//
let symbolCache = Object.assign([], this.selectedSymbol);
//
if (groupIndex === idx) return false;
//
group.attributes.forEach((item) => {
//
symbolCache[idx] = item.symbol;
const reg = new RegExp(symbolCache.join(","));
// SKU
const res = vm.skuData
.filter((i) => reg.test(i.attributeSymbolList))
.find((i) => i.stock > 0);
if (res) {
item.disabled = false;
} else {
item.disabled = true;
}
});
});
},
buyNow() {
if (!this.$isLoginValidate()) {

Loading…
Cancel
Save