Commit de772340 by 张立顺

fix bug修复

1 parent 5fd3b061
......@@ -25,10 +25,6 @@
<div class="content fix-header fix-bottom" v-if="goodsInfo.specificationType == 2">
<div class="mask">
<div class="mask-content">
<!-- <div class="mask-title">
<div class="mask-close iconfont-shop icon-close"></div>
选择规格参数
</div> -->
<div class="spec-items">
<div class="spec-menu-item js-spec-menu skuCon" v-for="(item, index) in goodsTypeList" :key="item.id">
<div class="spec-note label">{{ item.name }}:</div>
......@@ -36,14 +32,6 @@
<span v-for="(el, i) in item.propertyList" :key="el.id" class="spec-nor skuItem one-line-ellipsis pointer" :class="{ active: el.selected, disabled: el.disabled }" @click="handleClickSpecs1(item.id, el.id, el, index, i)">{{ el.name }}</span>
</div>
</div>
<!-- <div class="spec-menu-item">
<div class="spec-note">数量</div>
<div class="spec-num">
<span class="minus">-</span>
<input type="number" v-model="buyNumber" maxlength="3" />
<span class="add">+</span>
</div>
</div> -->
</div>
</div>
</div>
......@@ -701,8 +689,23 @@ export default {
}
})
}
console.log('selectItemList', selectItemList)
this.$set(this.$data, 'selectItemList', selectItemList)
if (selectItemList.length == this.goodsTypeList.length) {
let selectId = selectItemList
.map(item => item.id)
.sort()
.join('')
console.log(selectId)
let skusItem = orgdata.skus.find(item => {
console.log(item)
return item.skuId == selectId
})
console.log(skusItem, 'skusItem')
this.handleItemInfo.purchasePrice = skusItem.purchasePrice
} else {
this.handleItemInfo.purchasePrice = ''
}
// 取出组ID
let x_selected_grounpIds = []
selectItemList.forEach(item => {
......@@ -758,8 +761,11 @@ export default {
// goodsSpecificationNameList 商品
res = res.data
console.log(res, 'res')
if (res.specificationType == 2) {
console.log(res, 'res')
this.handleItemInfo.purchasePrice = res.upgradeGoodsSpecificationValueDTOS[0].purchasePrice
// console.log(this.handleItemInfo)
// console.log(res, 'res')
goodType = res.goodsSpecificationNameList.map((item, index) => {
item.name = item.specificationName
item.propertyList = item.goodsSpecificationValueList.map((el, elIndex) => {
......@@ -770,20 +776,29 @@ export default {
})
return item
})
console.log(goodType, 'goodType')
// console.log(goodType, 'goodType')
this.selectItemList = []
orgdata.skus = res.upgradeGoodsSpecificationValueDTOS.map((item, index) => {
item.skuId = ''
item.skusTypes = item.specificationValues.map((el, elIndex) => {
let skuItem = goodType[elIndex].propertyList.find((skuItem, skuItemIndex) => {
console.log(skuItem.name == el, skuItem.name, el)
// console.log(skuItem.name == el, skuItem.name, el)
// 取第一个默认选中
if (skuItem.name == el && index == 0) {
// if (skuItem.name == el && index == res.upgradeGoodsSpecificationValueDTOS.length - 1) {
goodType[elIndex].propertyList[skuItemIndex].selected = true
console.log(goodType, 'goodType')
// 记录选中的值
this.selectItemList.push({
grounpId: goodType[elIndex].id,
id: skuItem.id,
index: elIndex,
i: skuItemIndex
})
// console.log(goodType, 'goodType')
}
return skuItem.name == el
})
let obj = {
propertyId: skuItem.id,
propertyName: el
......@@ -794,22 +809,24 @@ export default {
return item
})
console.log(goodType, 'goodType')
console.log(orgdata, 'orgdata')
// console.log(this.selectItemList, ' this.selectItemList')
// console.log(goodType, 'goodType')
// console.log(orgdata, 'orgdata')
// return
// 初始化
this.init()
// 获取所有的规格
this.getShopGoodsType()
this.initGoodType()
} else {
// 默认选中第一个
let item = this.goodsInfo.upgradeGoodsList[0]
this.setHandleItemInfo(item)
}
this.goodsInfo = res
this.tableInfo = res?.upgradeGoodsList?.merchantGoodsInfoList
// 默认选中第一个
let item = this.goodsInfo.upgradeGoodsList[0]
this.setHandleItemInfo(item)
})
},
setHandleItemInfo(item = {}) {
......
......@@ -285,7 +285,7 @@ export default {
total.push({
upgradeGoodsName: cur.upgradeGoods.upgradeGoodsName,
specificationType: cur.upgradeGoods.specificationType,
formatSpecificationData: cur.upgradeGoods.formatSpecificationData ? cur.upgradeGoods.formatSpecificationData.replace(';~;', '/') : '',
formatSpecificationData: cur.upgradeGoods.formatSpecificationData ? cur.upgradeGoods.formatSpecificationData.replaceAll(';~;', '/') : '',
upgradeGoodsId: cur.upgradeGoodsId,
selectedFlag: cur.selectedFlag == 'Y',
goodsNumber: cur.goodsNumber,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!