Commit 2d8af330 by 张立顺

fix 适配车型

1 parent 000f5d04
......@@ -171,9 +171,13 @@ export default {
})
},
getSelectingList() {
console.log(this.upgradeGoodsInfo, 'this.upgradeGoodsInfo')
const upgradeGoodsId = this.upgradeGoodsInfo.upgradeGoodsId || this.upgradeGoodsInfo.id
if (!upgradeGoodsId) {
this.carLoading = false
return
}
this.carLoading = true
this.$apis.purchaseShopping.getCanSelectCarBrandList({ upgradeGoodsId: this.upgradeGoodsInfo.upgradeGoodsId || this.upgradeGoodsInfo.upgradeGoodsList[0].id }).then(res => {
this.$apis.purchaseShopping.getCanSelectCarBrandList({ upgradeGoodsId }).then(res => {
console.log(res, 'getSelectingList')
this.carLoading = false
this.options = res.data
......
......@@ -61,12 +61,12 @@
{{ membraneTypeList.includes(goodsInfo.goodsType) ? `卷(1卷=${goodsInfo.convertedValue || 30}米)` : '件' }}
</div>
</div>
<div class="munCom" v-if="upgradeGoodsInfo.suitCarType == 2">
<div class="munCom" v-if="selectedUpgradeGoods && selectedUpgradeGoods.suitCarType == 2">
<div class="label">适用车型:</div>
<div class="munItem car-select">
<el-select ref="choose" :clearable="false" width='300' collapse-tags multiple @focus="handleCarDialog"
value-key="carTypeId" v-model="goodsInfo.suitCarTypeList" style="margin-left: 20px;width: 300px;"
placeholder="请选择">
:disabled="!isGoodsSelected" value-key="carTypeId" v-model="goodsInfo.suitCarTypeList"
style="margin-left: 20px;width: 300px;" placeholder="请选择">
<el-option v-for="(children) in goodsInfo.suitCarTypeList" :key="children.carTypeId"
:label="children.carTypeName" :value="children">
</el-option>
......@@ -93,8 +93,8 @@
</div>
</div>
</GLDialog>
<carBandDialog v-if="relateStoreVisible" :upgradeGoodsInfo="goodsInfo" @handleRelateStoreConfirm="handleConfirm"
:relateStoreVisible.sync="relateStoreVisible" :goodsInfo="goodsInfo">
<carBandDialog v-if="relateStoreVisible" :upgradeGoodsInfo="carBandUpgradeGoodsInfo"
@handleRelateStoreConfirm="handleConfirm" :relateStoreVisible.sync="relateStoreVisible" :goodsInfo="goodsInfo">
</carBandDialog>
</div>
......@@ -633,6 +633,29 @@ export default {
set(val) {
this.$emit('update:visible', val)
}
},
isGoodsSelected() {
if (this.goodsInfo.specificationType == 2) {
return this.selectItemList.length === this.goodsTypeList.length && this.goodsTypeList.length > 0
}
return !!this.handleItemInfo.upgradeGoodsId
},
selectedUpgradeGoods() {
if (!this.isGoodsSelected) {
return null
}
if (this.goodsInfo.specificationType == 2) {
return this.upgradeGoodsInfo
}
return this.goodsInfo.upgradeGoodsList?.[this.selectIndex] || this.upgradeGoodsInfo
},
carBandUpgradeGoodsInfo() {
const selected = this.selectedUpgradeGoods || {}
return {
...selected,
upgradeGoodsId: selected.id,
suitCarTypeList: this.goodsInfo.suitCarTypeList || []
}
}
},
watch: {
......@@ -649,6 +672,7 @@ export default {
},
methods: {
singleClick(item, index) {
this.goodsInfo.suitCarTypeList = []
this.setHandleItemInfo(item)
this.selectIndex = index
this.upgradeGoodsInfo = item
......@@ -658,7 +682,10 @@ export default {
this.goodsInfo.suitCarTypeList = list
},
handleCarDialog() {
console.log('handleCarDialog')
if (!this.isGoodsSelected) {
this.$message.warning('请先选择商品规格')
return
}
this.$refs.choose.blur()
this.relateStoreVisible = true
},
......@@ -768,12 +795,13 @@ export default {
this.upgradeGoodsInfo = this.orgData.upgradeGoodsList.find(item => item.specificationData == spcName)
console.log(this.upgradeGoodsInfo, ' this.upgradeGoodsInfo')
}
// this.upgradeGoodsInfo = selectSpc.suitCarType
this.handleItemInfo.purchasePrice = skusItem.purchasePrice
//goodsInfo upgradeGoodsList suitCarType
this.handleItemInfo.upgradeGoodsId = this.upgradeGoodsInfo?.id || ''
} else {
this.handleItemInfo.purchasePrice = ''
this.handleItemInfo.upgradeGoodsId = ''
}
this.goodsInfo.suitCarTypeList = []
// 取出组ID
let x_selected_grounpIds = []
selectItemList.forEach(item => {
......@@ -893,7 +921,9 @@ export default {
this.setHandleItemInfo(item)
}
console.log(res?.upgradeGoodsList, 'res?.upgradeGoodsList')
this.upgradeGoodsInfo = res?.upgradeGoodsList[0]
if (res?.specificationType != 2) {
this.upgradeGoodsInfo = res?.upgradeGoodsList[0]
}
})
},
setHandleItemInfo(item = {}) {
......@@ -954,7 +984,7 @@ export default {
}
}
// 如果是专用商品 但没有选适配车型
if (this.upgradeGoodsInfo.suitCarType == 2 && !this.goodsInfo.suitCarTypeList?.length) {
if (this.selectedUpgradeGoods?.suitCarType == 2 && !this.goodsInfo.suitCarTypeList?.length) {
return this.$message.error('请完善商品适用车型')
}
// 判断是否有值
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!