Commit bce1ea18 by 张立顺

fix bug修复

1 parent de772340
......@@ -653,6 +653,7 @@ export default {
items.propertyList.forEach(item => {
for (var i = 0; i < currentSkuList.length; i++) {
if (item.id == currentSkuList[i].propertyId) {
// console.log('item.id', item.id, currentSkuList[i])
item.disabled = false
break
}
......@@ -662,6 +663,7 @@ export default {
},
// 选择每个规格,判断对应的库存
handleClickSpecs1(grounpId, id, el, index, i) {
console.log('handleClickSpecs1', grounpId, id, el, index, i)
let selectItemList = this.selectItemList // 已选规格
if (el.disabled) {
......@@ -770,13 +772,14 @@ export default {
item.name = item.specificationName
item.propertyList = item.goodsSpecificationValueList.map((el, elIndex) => {
el.name = el.specificationValue
el.index = elIndex
// el.id = el.specificationValue
el.id = index.toString() + elIndex.toString()
return el
})
return item
})
// console.log(goodType, 'goodType')
console.log(goodType, 'goodType')
this.selectItemList = []
orgdata.skus = res.upgradeGoodsSpecificationValueDTOS.map((item, index) => {
item.skuId = ''
......@@ -786,22 +789,34 @@ export default {
// 取第一个默认选中
if (skuItem.name == el && index == 0) {
// if (skuItem.name == el && index == res.upgradeGoodsSpecificationValueDTOS.length - 1) {
goodType[elIndex].propertyList[skuItemIndex].selected = true
// 记录选中的值
this.selectItemList.push({
grounpId: goodType[elIndex].id,
id: skuItem.id,
index: elIndex,
i: skuItemIndex
})
// console.log(goodType, 'goodType')
// goodType[elIndex].propertyList[skuItemIndex].selected = true
// // // 记录选中的值
// this.selectItemList.push({
// grounpId: goodType[elIndex].id,
// id: skuItem.id,
// index: elIndex,
// i: skuItemIndex
// })
// setTimeout(() => {
// console.log(item.id, item)
// // this.handleClickSpecs1(el, skuItem.id, skuItem, index, skuItemIndex)
// // goodType[elIndex].propertyList[skuItemIndex].selected = true
// // // 记录选中的值
// // this.selectItemList.push({
// // grounpId: goodType[elIndex].id,
// // id: skuItem.id,
// // index: elIndex,
// // i: skuItemIndex
// // })
// }, 0)
}
return skuItem.name == el
})
let obj = {
propertyId: skuItem.id,
propertyName: el
propertyName: el,
index: skuItem.index
}
item.skuId += skuItem.id
return obj
......@@ -819,6 +834,14 @@ export default {
// 获取所有的规格
this.getShopGoodsType()
this.initGoodType()
// 默认选中 第一个选项
// console.log(orgdata.skus[0], this.goodsTypeList)
let norSelectSkus = orgdata.skus[0]
this.goodsTypeList.forEach((item, index) => {
let sku = norSelectSkus.skusTypes[index]
this.handleClickSpecs1(item.id, sku.propertyId, sku, index, sku.index)
})
} else {
// 默认选中第一个
let item = this.goodsInfo.upgradeGoodsList[0]
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!