Commit 2d8af330 by 张立顺

fix 适配车型

1 parent 000f5d04
...@@ -171,9 +171,13 @@ export default { ...@@ -171,9 +171,13 @@ export default {
}) })
}, },
getSelectingList() { 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.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') console.log(res, 'getSelectingList')
this.carLoading = false this.carLoading = false
this.options = res.data this.options = res.data
......
...@@ -61,12 +61,12 @@ ...@@ -61,12 +61,12 @@
{{ membraneTypeList.includes(goodsInfo.goodsType) ? `卷(1卷=${goodsInfo.convertedValue || 30}米)` : '件' }} {{ membraneTypeList.includes(goodsInfo.goodsType) ? `卷(1卷=${goodsInfo.convertedValue || 30}米)` : '件' }}
</div> </div>
</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="label">适用车型:</div>
<div class="munItem car-select"> <div class="munItem car-select">
<el-select ref="choose" :clearable="false" width='300' collapse-tags multiple @focus="handleCarDialog" <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;" :disabled="!isGoodsSelected" value-key="carTypeId" v-model="goodsInfo.suitCarTypeList"
placeholder="请选择"> style="margin-left: 20px;width: 300px;" placeholder="请选择">
<el-option v-for="(children) in goodsInfo.suitCarTypeList" :key="children.carTypeId" <el-option v-for="(children) in goodsInfo.suitCarTypeList" :key="children.carTypeId"
:label="children.carTypeName" :value="children"> :label="children.carTypeName" :value="children">
</el-option> </el-option>
...@@ -93,8 +93,8 @@ ...@@ -93,8 +93,8 @@
</div> </div>
</div> </div>
</GLDialog> </GLDialog>
<carBandDialog v-if="relateStoreVisible" :upgradeGoodsInfo="goodsInfo" @handleRelateStoreConfirm="handleConfirm" <carBandDialog v-if="relateStoreVisible" :upgradeGoodsInfo="carBandUpgradeGoodsInfo"
:relateStoreVisible.sync="relateStoreVisible" :goodsInfo="goodsInfo"> @handleRelateStoreConfirm="handleConfirm" :relateStoreVisible.sync="relateStoreVisible" :goodsInfo="goodsInfo">
</carBandDialog> </carBandDialog>
</div> </div>
...@@ -633,6 +633,29 @@ export default { ...@@ -633,6 +633,29 @@ export default {
set(val) { set(val) {
this.$emit('update:visible', 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: { watch: {
...@@ -649,6 +672,7 @@ export default { ...@@ -649,6 +672,7 @@ export default {
}, },
methods: { methods: {
singleClick(item, index) { singleClick(item, index) {
this.goodsInfo.suitCarTypeList = []
this.setHandleItemInfo(item) this.setHandleItemInfo(item)
this.selectIndex = index this.selectIndex = index
this.upgradeGoodsInfo = item this.upgradeGoodsInfo = item
...@@ -658,7 +682,10 @@ export default { ...@@ -658,7 +682,10 @@ export default {
this.goodsInfo.suitCarTypeList = list this.goodsInfo.suitCarTypeList = list
}, },
handleCarDialog() { handleCarDialog() {
console.log('handleCarDialog') if (!this.isGoodsSelected) {
this.$message.warning('请先选择商品规格')
return
}
this.$refs.choose.blur() this.$refs.choose.blur()
this.relateStoreVisible = true this.relateStoreVisible = true
}, },
...@@ -768,12 +795,13 @@ export default { ...@@ -768,12 +795,13 @@ export default {
this.upgradeGoodsInfo = this.orgData.upgradeGoodsList.find(item => item.specificationData == spcName) this.upgradeGoodsInfo = this.orgData.upgradeGoodsList.find(item => item.specificationData == spcName)
console.log(this.upgradeGoodsInfo, ' this.upgradeGoodsInfo') console.log(this.upgradeGoodsInfo, ' this.upgradeGoodsInfo')
} }
// this.upgradeGoodsInfo = selectSpc.suitCarType
this.handleItemInfo.purchasePrice = skusItem.purchasePrice this.handleItemInfo.purchasePrice = skusItem.purchasePrice
//goodsInfo upgradeGoodsList suitCarType this.handleItemInfo.upgradeGoodsId = this.upgradeGoodsInfo?.id || ''
} else { } else {
this.handleItemInfo.purchasePrice = '' this.handleItemInfo.purchasePrice = ''
this.handleItemInfo.upgradeGoodsId = ''
} }
this.goodsInfo.suitCarTypeList = []
// 取出组ID // 取出组ID
let x_selected_grounpIds = [] let x_selected_grounpIds = []
selectItemList.forEach(item => { selectItemList.forEach(item => {
...@@ -893,7 +921,9 @@ export default { ...@@ -893,7 +921,9 @@ export default {
this.setHandleItemInfo(item) this.setHandleItemInfo(item)
} }
console.log(res?.upgradeGoodsList, 'res?.upgradeGoodsList') console.log(res?.upgradeGoodsList, 'res?.upgradeGoodsList')
this.upgradeGoodsInfo = res?.upgradeGoodsList[0] if (res?.specificationType != 2) {
this.upgradeGoodsInfo = res?.upgradeGoodsList[0]
}
}) })
}, },
setHandleItemInfo(item = {}) { setHandleItemInfo(item = {}) {
...@@ -954,7 +984,7 @@ export default { ...@@ -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('请完善商品适用车型') 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!