Commit 31a49fba by Jaxon

fix(商品上架): 修正商品选择禁用逻辑和表单数据同步

1 parent 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.commodityCode)" :disabled="packageSelectIds && packageSelectIds.includes(scope.scope.id)"
:label="scope.scope.id"> :label="scope.scope.id">
{{ '' }} {{ '' }}
</el-radio> </el-radio>
......
...@@ -172,7 +172,7 @@ ...@@ -172,7 +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" :disabled-ids="packageSelectedGoodsIds"
:scene-type="packageForm.sceneType" :scene-type="packageForm.sceneType"
:show-gift-cost="false" :show-gift-cost="false"
:show-business-line="false" :show-business-line="false"
...@@ -180,6 +180,7 @@ ...@@ -180,6 +180,7 @@
:show-settlement-type="false" :show-settlement-type="false"
:show-penetration-rate="false" :show-penetration-rate="false"
use-remove-btn use-remove-btn
@update:product="handleUpdateProduct($event, index)"
@remove="handleRemoveProduct(goodsForm.id, index)" /> @remove="handleRemoveProduct(goodsForm.id, index)" />
<el-divider v-if="index !== (goodsList.length - 1)" class="divider-product" /> <el-divider v-if="index !== (goodsList.length - 1)" class="divider-product" />
</div> </div>
...@@ -246,8 +247,8 @@ export default { ...@@ -246,8 +247,8 @@ export default {
}, },
computed: { computed: {
// 返回已选的商品id // 返回已选的商品id
packageSelectedGoodsCommodityCode() { packageSelectedGoodsIds() {
return this.goodsList?.map(item => item.upgradeCommodityCode) || []; return this.goodsList?.map(item => item.upgradeGoods?.id) || [];
}, },
}, },
watch: { watch: {
...@@ -281,6 +282,9 @@ export default { ...@@ -281,6 +282,9 @@ export default {
isMemberRightsUpgrade, isMemberRightsUpgrade,
isQualityUpgrade, isQualityUpgrade,
isSolarFilm, isSolarFilm,
handleUpdateProduct(product, goodsListIndex) {
this.$set(this.goodsList, goodsListIndex, product);
},
async handleRemoveProduct(_id, index) { async handleRemoveProduct(_id, index) {
await this.$confirm("是否确认删除该商品?", "删除商品", { await this.$confirm("是否确认删除该商品?", "删除商品", {
confirmButtonText: "是", confirmButtonText: "是",
......
...@@ -363,6 +363,7 @@ export default { ...@@ -363,6 +363,7 @@ export default {
this.dialog.selectGoods.show = true; this.dialog.selectGoods.show = true;
}, },
handleSelectGoodsClose() { handleSelectGoodsClose() {
this.$emit("update:product", this.formDetail);
this.$refs.formRef.validateField("upgradeGoodsId"); this.$refs.formRef.validateField("upgradeGoodsId");
this.dialog.selectGoods.show = false; this.dialog.selectGoods.show = false;
}, },
...@@ -384,6 +385,8 @@ export default { ...@@ -384,6 +385,8 @@ export default {
this.$set(this.formData, "upgradeGoods", selectedForm); 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.formDetail.upgradeGoodsId = selectedData.id;
this.formDetail.goodsType = selectedData?.goodsInfo?.goodsType;
this.formData.position = undefined; this.formData.position = undefined;
// 太阳膜 // 太阳膜
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!