Browse Source

商城PC端多组规格切换库存显示异常处理

master
dy-hu 7 months ago
parent
commit
be617c0e34
  1. 26
      src/views/product/productDetail.vue

26
src/views/product/productDetail.vue

@ -807,6 +807,8 @@ export default {
},
// sku
selectSku (o, list) {
console.log('o-->', o)
console.log('list-->', list)
const temp = this.productDetailData.names
this.productNumber = 1
if (list.values.length > 1) {
@ -826,9 +828,10 @@ export default {
}
})
})
let select = selectOption.toString()
for (let key in this.skuMap) {
if (key === select) {
if (this.isEqual(key, select)) {
this.currentProductData = this.skuMap[key]
this.productOption = this.skuMap[key]
this.ifEnable = this.skuMap[key].ifEnable
@ -845,6 +848,27 @@ export default {
}
}
},
//
isEqual(a, b) {
let c = a.split(','), d = b.split(',')
if (c.length != d.length) {
return false
}
for (let i = 0; i < c.length; i++) {
let isMatch = false
for (let j = 0; j < d.length; j++) {
if (c[i] == d[j]) {
isMatch = true
break
}
}
if (!isMatch) {
return false
}
}
return true
},
// skuId
// getSkuId () {
// const temp = this.productOption

Loading…
Cancel
Save