Commit 9fdcc826 by 张立顺

fix bug修复

1 parent c8f1df5c
...@@ -758,47 +758,50 @@ export default { ...@@ -758,47 +758,50 @@ export default {
// goodsSpecificationNameList 商品 // goodsSpecificationNameList 商品
res = res.data res = res.data
console.log(res, 'res') console.log(res, 'res')
goodType = res.goodsSpecificationNameList.map((item, index) => { if (res.specificationType == 2) {
item.name = item.specificationName console.log(res, 'res')
item.propertyList = item.goodsSpecificationValueList.map((el, elIndex) => { goodType = res.goodsSpecificationNameList.map((item, index) => {
el.name = el.specificationValue item.name = item.specificationName
// el.id = el.specificationValue item.propertyList = item.goodsSpecificationValueList.map((el, elIndex) => {
el.id = index.toString() + elIndex.toString() el.name = el.specificationValue
return el // el.id = el.specificationValue
el.id = index.toString() + elIndex.toString()
return el
})
return item
}) })
return item console.log(goodType, 'goodType')
}) orgdata.skus = res.upgradeGoodsSpecificationValueDTOS.map((item, index) => {
console.log(goodType, 'goodType') item.skuId = ''
orgdata.skus = res.upgradeGoodsSpecificationValueDTOS.map((item, index) => { item.skusTypes = item.specificationValues.map((el, elIndex) => {
item.skuId = '' let skuItem = goodType[elIndex].propertyList.find((skuItem, skuItemIndex) => {
item.skusTypes = item.specificationValues.map((el, elIndex) => { console.log(skuItem.name == el, skuItem.name, el)
let skuItem = goodType[elIndex].propertyList.find((skuItem, skuItemIndex) => { // 取第一个默认选中
console.log(skuItem.name == el, skuItem.name, el) if (skuItem.name == el && index == res.upgradeGoodsSpecificationValueDTOS.length - 1) {
// 取第一个默认选中 goodType[elIndex].propertyList[skuItemIndex].selected = true
if (skuItem.name == el && index == res.upgradeGoodsSpecificationValueDTOS.length - 1) { console.log(goodType, 'goodType')
goodType[elIndex].propertyList[skuItemIndex].selected = true }
console.log(goodType, 'goodType') return skuItem.name == el
})
let obj = {
propertyId: skuItem.id,
propertyName: el
} }
return skuItem.name == el item.skuId += skuItem.id
return obj
}) })
let obj = {
propertyId: skuItem.id,
propertyName: el
}
item.skuId += skuItem.id
return obj
})
return item return item
}) })
console.log(goodType, 'goodType') console.log(goodType, 'goodType')
console.log(orgdata, 'orgdata') console.log(orgdata, 'orgdata')
// return // return
// 初始化 // 初始化
this.init() this.init()
// 获取所有的规格 // 获取所有的规格
this.getShopGoodsType() this.getShopGoodsType()
this.initGoodType() this.initGoodType()
}
this.goodsInfo = res this.goodsInfo = res
this.tableInfo = res?.upgradeGoodsList?.merchantGoodsInfoList this.tableInfo = res?.upgradeGoodsList?.merchantGoodsInfoList
...@@ -867,6 +870,7 @@ export default { ...@@ -867,6 +870,7 @@ export default {
// 判断是否有值 // 判断是否有值
params.upgradeGoodsId && params.upgradeGoodsId &&
this.$apis.purchaseShopping.shoppingCarAdd(params).then(res => { this.$apis.purchaseShopping.shoppingCarAdd(params).then(res => {
console.log(res, 'res')
this.$message.success('加入购物车成功') this.$message.success('加入购物车成功')
this.$EventBus.$emit('updateCarShopping') this.$EventBus.$emit('updateCarShopping')
this.dialogShow = false this.dialogShow = false
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!