Merge branch 'feature/task1.0.0-0505-ch' into msb_prod

* feature/task1.0.0-0505-ch:
  sku处理回退
merge-requests/98/merge
ch 3 years ago
commit 112f3ac1fc

@ -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