Commit de772340 by 张立顺

fix bug修复

1 parent 5fd3b061
...@@ -25,10 +25,6 @@ ...@@ -25,10 +25,6 @@
<div class="content fix-header fix-bottom" v-if="goodsInfo.specificationType == 2"> <div class="content fix-header fix-bottom" v-if="goodsInfo.specificationType == 2">
<div class="mask"> <div class="mask">
<div class="mask-content"> <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-items">
<div class="spec-menu-item js-spec-menu skuCon" v-for="(item, index) in goodsTypeList" :key="item.id"> <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> <div class="spec-note label">{{ item.name }}:</div>
...@@ -36,14 +32,6 @@ ...@@ -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> <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> </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> </div>
</div> </div>
...@@ -701,8 +689,23 @@ export default { ...@@ -701,8 +689,23 @@ export default {
} }
}) })
} }
console.log('selectItemList', selectItemList)
this.$set(this.$data, '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 // 取出组ID
let x_selected_grounpIds = [] let x_selected_grounpIds = []
selectItemList.forEach(item => { selectItemList.forEach(item => {
...@@ -758,8 +761,11 @@ export default { ...@@ -758,8 +761,11 @@ export default {
// goodsSpecificationNameList 商品 // goodsSpecificationNameList 商品
res = res.data res = res.data
console.log(res, 'res') console.log(res, 'res')
if (res.specificationType == 2) { 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) => { goodType = res.goodsSpecificationNameList.map((item, index) => {
item.name = item.specificationName item.name = item.specificationName
item.propertyList = item.goodsSpecificationValueList.map((el, elIndex) => { item.propertyList = item.goodsSpecificationValueList.map((el, elIndex) => {
...@@ -770,20 +776,29 @@ export default { ...@@ -770,20 +776,29 @@ export default {
}) })
return item return item
}) })
console.log(goodType, 'goodType') // console.log(goodType, 'goodType')
this.selectItemList = []
orgdata.skus = res.upgradeGoodsSpecificationValueDTOS.map((item, index) => { orgdata.skus = res.upgradeGoodsSpecificationValueDTOS.map((item, index) => {
item.skuId = '' item.skuId = ''
item.skusTypes = item.specificationValues.map((el, elIndex) => { item.skusTypes = item.specificationValues.map((el, elIndex) => {
let skuItem = goodType[elIndex].propertyList.find((skuItem, skuItemIndex) => { 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 == 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
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 return skuItem.name == el
}) })
let obj = { let obj = {
propertyId: skuItem.id, propertyId: skuItem.id,
propertyName: el propertyName: el
...@@ -794,22 +809,24 @@ export default { ...@@ -794,22 +809,24 @@ export default {
return item return item
}) })
console.log(goodType, 'goodType') // console.log(this.selectItemList, ' this.selectItemList')
console.log(orgdata, 'orgdata') // console.log(goodType, 'goodType')
// console.log(orgdata, 'orgdata')
// return // return
// 初始化 // 初始化
this.init() this.init()
// 获取所有的规格 // 获取所有的规格
this.getShopGoodsType() this.getShopGoodsType()
this.initGoodType() this.initGoodType()
} else {
// 默认选中第一个
let item = this.goodsInfo.upgradeGoodsList[0]
this.setHandleItemInfo(item)
} }
this.goodsInfo = res this.goodsInfo = res
this.tableInfo = res?.upgradeGoodsList?.merchantGoodsInfoList this.tableInfo = res?.upgradeGoodsList?.merchantGoodsInfoList
// 默认选中第一个
let item = this.goodsInfo.upgradeGoodsList[0]
this.setHandleItemInfo(item)
}) })
}, },
setHandleItemInfo(item = {}) { setHandleItemInfo(item = {}) {
......
...@@ -285,7 +285,7 @@ export default { ...@@ -285,7 +285,7 @@ export default {
total.push({ total.push({
upgradeGoodsName: cur.upgradeGoods.upgradeGoodsName, upgradeGoodsName: cur.upgradeGoods.upgradeGoodsName,
specificationType: cur.upgradeGoods.specificationType, specificationType: cur.upgradeGoods.specificationType,
formatSpecificationData: cur.upgradeGoods.formatSpecificationData ? cur.upgradeGoods.formatSpecificationData.replace(';~;', '/') : '', formatSpecificationData: cur.upgradeGoods.formatSpecificationData ? cur.upgradeGoods.formatSpecificationData.replaceAll(';~;', '/') : '',
upgradeGoodsId: cur.upgradeGoodsId, upgradeGoodsId: cur.upgradeGoodsId,
selectedFlag: cur.selectedFlag == 'Y', selectedFlag: cur.selectedFlag == 'Y',
goodsNumber: cur.goodsNumber, goodsNumber: cur.goodsNumber,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!