Commit a9fd1790 by 张立顺

fix 联调bug修复

1 parent 17da5562
...@@ -713,6 +713,7 @@ export default { ...@@ -713,6 +713,7 @@ export default {
}, },
data() { data() {
return { return {
priceUnitTypeList,
equitySceneType: baseConfig.equitySceneType || [], // 权益类目 equitySceneType: baseConfig.equitySceneType || [], // 权益类目
extendedPosiType: baseConfig.extendedPosiType || [], // 延保类 extendedPosiType: baseConfig.extendedPosiType || [], // 延保类
minPrice: 0, minPrice: 0,
......
...@@ -355,6 +355,7 @@ ...@@ -355,6 +355,7 @@
:label="item.label ? item.label + ':' : ''" :label="item.label ? item.label + ':' : ''"
:id="item.name" :id="item.name"
:label-width="item.label ? '120px' : '0px'" :label-width="item.label ? '120px' : '0px'"
:required="item.name === 'accessoryType'"
class="dis-in-block" class="dis-in-block"
:style="{ 'margin-bottom': !item.type ? '0px' : '22px' }" :style="{ 'margin-bottom': !item.type ? '0px' : '22px' }"
v-if=" v-if="
...@@ -1257,7 +1258,12 @@ export default { ...@@ -1257,7 +1258,12 @@ export default {
if (valid) { if (valid) {
// 会员权益 类目 // 会员权益 类目
// if (this.equitySceneType.includes(this.formData.goodsType)) this.formData.productServiceItemList = this.productServiceItemList // if (this.equitySceneType.includes(this.formData.goodsType)) this.formData.productServiceItemList = this.productServiceItemList
this.formData.goodsPositionList = this.filterPosiotion() const goodsPositionList = this.filterPosiotion()
if (goodsPositionList === true) {
this.$message.warning("请填写扣减标准")
return
}
this.formData.goodsPositionList = goodsPositionList
const brandOptionList = const brandOptionList =
this.formList[0].formBlock[ this.formList[0].formBlock[
this.formList[0].formBlock.findIndex( this.formList[0].formBlock.findIndex(
...@@ -1280,7 +1286,7 @@ export default { ...@@ -1280,7 +1286,7 @@ export default {
)?.relatedPartyName) )?.relatedPartyName)
this.$emit("handleAddConfirm", this.formData) this.$emit("handleAddConfirm", this.formData)
} else { } else {
var needRuleList = Object.keys(options) const needRuleList = options ? Object.keys(options) : []
if ( if (
this.formData?.goodsName && this.formData?.goodsName &&
!this.formData?.goodsName?.includes("太阳膜") && !this.formData?.goodsName?.includes("太阳膜") &&
...@@ -1291,8 +1297,8 @@ export default { ...@@ -1291,8 +1297,8 @@ export default {
"产品名称必须包含“太阳膜”字样才可将产品挂在太阳膜类目下" "产品名称必须包含“太阳膜”字样才可将产品挂在太阳膜类目下"
) )
} }
this.jumpScroll(needRuleList[0]) if (needRuleList?.length) this.jumpScroll(needRuleList[0])
return true return
} }
if (callback) callback(this.formData) if (callback) callback(this.formData)
}) })
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<span style="margin-right: 10px;"> <span style="margin-right: 10px;">
<auth-button :data="getAuthButtonData(scope.scope)" :show-btn-ids="['9030703']" /> <auth-button :data="getAuthButtonData(scope.scope)" :show-btn-ids="['9030703']" />
</span> </span>
<auth-button v-if="!scope.scope.goodsInfo || scope.scope.goodsInfo.scrmFlag !== 'Y'" <auth-button v-if="(!scope.scope.goodsInfo || scope.scope.goodsInfo.scrmFlag !== 'Y') && !scope.scope.isLastSku"
:data="getAuthButtonData(scope.scope)" :data="getAuthButtonData(scope.scope)"
:show-btn-ids="['9030706']" /> :show-btn-ids="['9030706']" />
</div> </div>
...@@ -305,7 +305,7 @@ export default { ...@@ -305,7 +305,7 @@ export default {
width: "120", width: "120",
}, { }, {
label: "计价单位", label: "计价单位",
prop: "listShowPricingUnit", prop: "priceUnitName",
width: "90", width: "90",
}, { }, {
label: "采购成本/元", label: "采购成本/元",
...@@ -523,6 +523,13 @@ export default { ...@@ -523,6 +523,13 @@ export default {
const isSkuMode = this.searchForm.showSkuMode === "Y"; const isSkuMode = this.searchForm.showSkuMode === "Y";
// 新 SPU 接口不返回 upgradeGoodsList,标记为 SPU 平铺模式 // 新 SPU 接口不返回 upgradeGoodsList,标记为 SPU 平铺模式
this.spuOnlyMode = !listData.some(item => item.upgradeGoodsList && item.upgradeGoodsList.length); this.spuOnlyMode = !listData.some(item => item.upgradeGoodsList && item.upgradeGoodsList.length);
const baseGoodsIdCount = {};
if (isSkuMode) {
listData.forEach((item) => {
const bid = item.baseGoodsId || item.id;
baseGoodsIdCount[bid] = (baseGoodsIdCount[bid] || 0) + 1;
});
}
listData.forEach((val) => { listData.forEach((val) => {
if (!val.goodsInfo) if (!val.goodsInfo)
val.goodsInfo = {}; val.goodsInfo = {};
...@@ -561,6 +568,7 @@ export default { ...@@ -561,6 +568,7 @@ export default {
v.listShowApplicableArea = this._pickFirst("-", v.applicableArea, v.goodsInfo && v.goodsInfo.applicableArea, val.goodsInfo && val.goodsInfo.applicableArea); v.listShowApplicableArea = this._pickFirst("-", v.applicableArea, v.goodsInfo && v.goodsInfo.applicableArea, val.goodsInfo && val.goodsInfo.applicableArea);
const accessoryType = (v.goodsInfo && v.goodsInfo.accessoryType != null) ? v.goodsInfo.accessoryType : ((val.goodsInfo && val.goodsInfo.accessoryType != null) ? val.goodsInfo.accessoryType : v.accessoryType); const accessoryType = (v.goodsInfo && v.goodsInfo.accessoryType != null) ? v.goodsInfo.accessoryType : ((val.goodsInfo && val.goodsInfo.accessoryType != null) ? val.goodsInfo.accessoryType : v.accessoryType);
v.listShowPartsNature = this._formatAccessoryType(accessoryType); v.listShowPartsNature = this._formatAccessoryType(accessoryType);
v.isLastSku = val.upgradeGoodsList.length === 1;
}); });
// SPU 父级:规格取 spuSpecificationData,参考售价取 spuUpgradePrice // SPU 父级:规格取 spuSpecificationData,参考售价取 spuUpgradePrice
val.listShowSpecificationData = (val.spuSpecificationData != null && val.spuSpecificationData !== "") ? val.spuSpecificationData : "-"; val.listShowSpecificationData = (val.spuSpecificationData != null && val.spuSpecificationData !== "") ? val.spuSpecificationData : "-";
...@@ -571,6 +579,7 @@ export default { ...@@ -571,6 +579,7 @@ export default {
this._setParentRowFromFirstSku(val, val.upgradeGoodsList[0]); this._setParentRowFromFirstSku(val, val.upgradeGoodsList[0]);
} else if (isSkuMode) { } else if (isSkuMode) {
// Y 模式:listData 直接为 SKU 平铺,逐条处理 // Y 模式:listData 直接为 SKU 平铺,逐条处理
val.isLastSku = (baseGoodsIdCount[val.baseGoodsId || val.id] || 0) === 1;
this._processSkuItem(val, val, null); this._processSkuItem(val, val, null);
} else { } else {
this._setSpuOnlyDefaults(val); this._setSpuOnlyDefaults(val);
......
...@@ -115,6 +115,8 @@ export default { ...@@ -115,6 +115,8 @@ export default {
if (this.addOrEdit === "edit") { if (this.addOrEdit === "edit") {
this.getGoodsInfo(this.$route.query.id); this.getGoodsInfo(this.$route.query.id);
} else { } else {
// 新增时清空 Vuex 中的 SKU 数据,避免缓存上一个编辑商品的数据
this.setUpdateGoodsInfo(deepClone(this.resetData));
this.$nextTick(() => { this.$nextTick(() => {
this.show = true; this.show = true;
}); });
...@@ -545,8 +547,12 @@ export default { ...@@ -545,8 +547,12 @@ export default {
} }
return item; return item;
}); });
this.goodsInfoData.goodsSpecificationList = arr; // 仅更新当前规格类型对应的列表,避免互相覆盖导致数据错乱
this.goodsInfoData.goodsSpecificationSingleList = arr; if (this.goodsInfoData.specificationType == 1) {
this.setUpdateGoodsInfo({ goodsSpecificationSingleList: arr });
} else {
this.setUpdateGoodsInfo({ goodsSpecificationList: arr });
}
let specialList = []; let specialList = [];
if (this.goodsInfoData.goodsType == 1) { // 太阳膜 位置 质保 采购价 必填 + 新增字段(配件性质从 SPU 同步) if (this.goodsInfoData.goodsType == 1) { // 太阳膜 位置 质保 采购价 必填 + 新增字段(配件性质从 SPU 同步)
specialList = ["position", "purchasePrice", "warrantyPeriod", "type", "priceUnitType", "purchaseCost"]; specialList = ["position", "purchasePrice", "warrantyPeriod", "type", "priceUnitType", "purchaseCost"];
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!