Commit 6f5eda3c by Jaxon

Merge branch 'feature/d-plus-list-product' into 'SAAS+V5.7.1'

fix(商品上架): 修复商品选择弹窗中禁用逻辑使用错误ID的问题

See merge request !590
2 parents dace67a5 07c40161
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
@setTableFinishFun="setTableFinishFun"> @setTableFinishFun="setTableFinishFun">
<template #select_btn="scope"> <template #select_btn="scope">
<el-radio v-model="selectedRowId" <el-radio v-model="selectedRowId"
:disabled="packageSelectIds && packageSelectIds.includes(scope.scope.id)" :disabled="packageSelectIds && packageSelectIds.includes(scope.scope.commodityCode)"
:label="scope.scope.id"> :label="scope.scope.id">
{{ '' }} {{ '' }}
</el-radio> </el-radio>
......
...@@ -172,6 +172,7 @@ ...@@ -172,6 +172,7 @@
<Product :ref="`productForm${goodsForm.id}`" <Product :ref="`productForm${goodsForm.id}`"
:product="goodsForm" :product="goodsForm"
:mode="VIEW_MODE.EDIT" :mode="VIEW_MODE.EDIT"
:disabled-ids="packageSelectedGoodsCommodityCode"
:scene-type="packageForm.sceneType" :scene-type="packageForm.sceneType"
:show-gift-cost="false" :show-gift-cost="false"
:show-business-line="false" :show-business-line="false"
...@@ -243,9 +244,12 @@ export default { ...@@ -243,9 +244,12 @@ export default {
goodsList: [], goodsList: [],
}; };
}, },
computed: {
computed: {}, // 返回已选的商品id
packageSelectedGoodsCommodityCode() {
return this.goodsList?.map(item => item.upgradeCommodityCode) || [];
},
},
watch: { watch: {
packages: { packages: {
handler(val) { handler(val) {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</div> </div>
<div v-if="formData.upgradeGoodsId" class="info-div"> <div v-if="formData.upgradeGoodsId" class="info-div">
<Descriptions class="sub-desc-wrapper" <Descriptions class="sub-desc-wrapper"
:data="formData" :data="formDetail"
:schema="productShelvingProductDetailSubFormItems" /> :schema="productShelvingProductDetailSubFormItems" />
</div> </div>
</el-form-item> </el-form-item>
...@@ -207,6 +207,7 @@ ...@@ -207,6 +207,7 @@
<SelectGoodsDialog v-if="dialog.selectGoods.show" <SelectGoodsDialog v-if="dialog.selectGoods.show"
append-to-body append-to-body
:scene-type="sceneType" :scene-type="sceneType"
:package-select-ids="disabledIds"
:filter-params="dialog.selectGoods.filterParams" :filter-params="dialog.selectGoods.filterParams"
:select-goods-visible="dialog.selectGoods.show" :select-goods-visible="dialog.selectGoods.show"
:upgrade-goods-id="formData.upgradeGoodsId" :upgrade-goods-id="formData.upgradeGoodsId"
...@@ -273,6 +274,11 @@ export default { ...@@ -273,6 +274,11 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
// 在选择商品的弹窗里 禁用的id
disabledIds: {
type: Array,
default: () => [],
},
}, },
data() { data() {
return { return {
...@@ -288,6 +294,7 @@ export default { ...@@ -288,6 +294,7 @@ export default {
}, },
}, },
formRules: productFromRules, formRules: productFromRules,
formDetail: {},
formData: { formData: {
upgradeGoodsId: "", upgradeGoodsId: "",
goodsAlias: "", goodsAlias: "",
...@@ -325,10 +332,12 @@ export default { ...@@ -325,10 +332,12 @@ export default {
console.log("this.val", val); console.log("this.val", val);
if (!isEmpty(val)) { if (!isEmpty(val)) {
this.$set(this, "formData", handleCoverProductForm(cloneDeep(val))); this.$set(this, "formData", handleCoverProductForm(cloneDeep(val)));
this.$set(this, "formDetail", cloneDeep(val));
} }
}, },
immediate: true, immediate: true,
}, },
}, },
async mounted() { async mounted() {
...@@ -361,8 +370,7 @@ export default { ...@@ -361,8 +370,7 @@ export default {
handleSelectGoodsConfirm(selectedData) { handleSelectGoodsConfirm(selectedData) {
console.log("selectedData", selectedData); console.log("selectedData", selectedData);
console.log("selectedData.goodsInfo.goodsName", selectedData.goodsInfo.goodsName); console.log("selectedData.goodsInfo.goodsName", selectedData.goodsInfo.goodsName);
const selectedForm = {
this.$set(this.formData, "upgradeGoods", {
...selectedData, ...selectedData,
goodsName: selectedData.goodsInfo.goodsName, goodsName: selectedData.goodsInfo.goodsName,
tempGoodsTypeName: getGoodsTypes(selectedData?.goodsInfo), tempGoodsTypeName: getGoodsTypes(selectedData?.goodsInfo),
...@@ -371,9 +379,13 @@ export default { ...@@ -371,9 +379,13 @@ export default {
djCost: selectedData?.djCost || 0, djCost: selectedData?.djCost || 0,
carTypeConfigName: selectedData?.carTypeConfigList?.map(item => item.seriesName).join("/"), carTypeConfigName: selectedData?.carTypeConfigList?.map(item => item.seriesName).join("/"),
commodityCode: selectedData?.commodityCode, commodityCode: selectedData?.commodityCode,
}); };
this.$set(this.formDetail, "upgradeGoods", cloneDeep(selectedData));
this.$set(this.formData, "upgradeGoods", selectedForm);
this.formData.upgradeGoodsId = selectedData.id; this.formData.upgradeGoodsId = selectedData.id;
this.formData.goodsType = selectedData?.goodsInfo?.goodsType; this.formData.goodsType = selectedData?.goodsInfo?.goodsType;
this.formData.position = undefined;
// 太阳膜 // 太阳膜
if (selectedData?.goodsInfo?.goodsType === 1) { if (selectedData?.goodsInfo?.goodsType === 1) {
this.$set(this.formData.upgradeGoods, "positionList", selectedData.position?.split(",")?.map(item => Number(item.trim())) || []); this.$set(this.formData.upgradeGoods, "positionList", selectedData.position?.split(",")?.map(item => Number(item.trim())) || []);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!