Commit bce1ea18 by 张立顺

fix bug修复

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