sku处理回退

feature/task1.0.0-0505-ch
ch 3 years ago
parent fbbc5a8a27
commit 5b4e495bc5

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

Loading…
Cancel
Save