fix: 🐛 修复热区弹框优先级问题。优化编辑商品时,可修改分类与商品类型

master
paulGao 2022-09-09 19:40:01 +08:00
parent 0933f1942e
commit 685ec5f679
3 changed files with 87 additions and 80 deletions

View File

@ -1,5 +1,5 @@
<template>
<Modal :styles="{ top: '120px' }" width="1160" @on-cancel="clickClose" @on-ok="clickOK" v-model="flag" :mask-closable="false" scrollable>
<Modal :styles="{ top: '120px' }" width="1160" z-index="10000" @on-cancel="clickClose" @on-ok="clickOK" v-model="flag" :mask-closable="false" scrollable>
<template v-if="flag">
<goodsDialog @selected="(val) => {goodsData = val;}"
v-if="goodsFlag" ref="goodsDialog" :selectedWay='goodsData'/>

View File

@ -185,8 +185,8 @@ export default {
GET_GoodsTemplate() {
API_GOODS.getDraftGoodsListData(this.searchParams).then((res) => {
if (res.success) {
this.goodsTemplates.push(...res.result.records)
this.templateTotal = res.result.total
this.goodsTemplates.push(...res.result.records);
this.templateTotal = res.result.total;
}
});
},
@ -234,13 +234,15 @@ export default {
this.$Message.error("必须选择到三级分类");
return;
} else if (this.category[2].name) {
if (this.selectedTemplate.id) {
this.$emit("change", { tempId: this.selectedTemplate.id });
} else {
this.$emit("change", {
let params = {
category: this.category,
goodsType: this.goodsType,
});
};
if (this.selectedTemplate.id) {
params.tempId = this.selectedTemplate.id;
this.$emit("change", params);
} else {
this.$emit("change", params);
}
}
},

View File

@ -154,8 +154,7 @@
type="error"
@click="handleDeleteWholesaleData(index)"
>删除
</Button
>
</Button>
</div>
</template>
</Table>
@ -319,8 +318,7 @@
<div>
<Button @click="addSpec($index, item)"
>添加规格值
</Button
>
</Button>
</div>
</Card>
</div>
@ -331,8 +329,7 @@
type="primary"
@click="addSkuItem"
>添加规格项
</Button
>
</Button>
&nbsp;
<Button
class="add-sku-btn"
@ -340,8 +337,7 @@
type="warning"
@click="handleClearSku"
>清空规格项
</Button
>
</Button>
</div>
</Panel>
<Panel name="2">
@ -548,8 +544,7 @@
<div class="promise-intro-btn">
<Button type="primary" @click="promiseIntroEditor"
>将PC商品描述同步到移动端描述
</Button
>
</Button>
</div>
</FormItem>
@ -688,12 +683,7 @@
<!-- 底部按钮 -->
<div class="footer">
<ButtonGroup>
<Button
v-if="!$route.query.id && !$route.query.draftId"
type="primary"
@click="pre"
>上一步
</Button>
<Button type="primary" @click="pre"> </Button>
<Button :loading="submitLoading" type="primary" @click="save">
{{ this.$route.query.id ? "保存" : "保存商品" }}
</Button>
@ -1192,15 +1182,28 @@ export default {
this.getGoodsBrandList();
/** 查询商品参数 */
this.GET_GoodsParams();
/** 查询店铺商品分类 */
/** 查询店铺商品分类 */
this.GET_ShopGoodsLabel();
this.GET_GoodsUnit();
if (this.firstData.category) {
const cateId = [];
this.baseInfoForm.categoryName = [];
this.firstData.category.forEach((cate) => {
this.baseInfoForm.categoryName.push(cate.name);
cateId.push(cate.id);
});
this.categoryId = cateId[2];
this.baseInfoForm.categoryPath = cateId.toString();
}
this.baseInfoForm.goodsType &&
(this.baseInfoForm.goodsType = this.firstData.goodsType);
},
// sku
renderGoodsDetailSku(skuList) {
let skus = [];
let skusInfo = [];
console.log(skuList);
skuList.map((e) => {
let sku = {
id: e.id,
@ -1386,10 +1389,10 @@ export default {
// 1n(n - 1)
//
let filterSkuInfo = this.skuInfo.filter(i => i.name !== item.name);
let filterSkuInfo = this.skuInfo.filter((i) => i.name !== item.name);
let index = 1;
let totalLength = 1;
filterSkuInfo.forEach(skuInfo => {
filterSkuInfo.forEach((skuInfo) => {
totalLength *= skuInfo.spec_values.length;
});
//
@ -1401,7 +1404,8 @@ export default {
}
} else {
//
let currentNum = this.skuInfo[this.skuInfo.length - 1].spec_values.length;
let currentNum =
this.skuInfo[this.skuInfo.length - 1].spec_values.length;
for (let i = this.skuInfo.length - 2; i > itemIndex; i--) {
//
currentNum *= this.skuInfo[i].spec_values.length;
@ -1409,20 +1413,21 @@ export default {
//
let beginIndex = currentNum + 1;
let filterSkuInfo = this.skuInfo.filter(i => i.name !== item.name);
let filterSkuInfo = this.skuInfo.filter((i) => i.name !== item.name);
let totalLength = 1;
filterSkuInfo.forEach(skuInfo => {
filterSkuInfo.forEach((skuInfo) => {
totalLength *= skuInfo.spec_values.length;
});
for (let i = 0; i < totalLength; i++) {
// * - 1
this.skuTableData.splice(beginIndex, currentNum * (item.spec_values.length - 1));
this.skuTableData.splice(
beginIndex,
currentNum * (item.spec_values.length - 1)
);
beginIndex += currentNum;
}
}
this.skuInfo.splice($index, 1)
this.skuInfo.splice($index, 1);
this.skuTableData = this.skuTableData.map((e) => {
delete e[item.name];
@ -1463,9 +1468,9 @@ export default {
});
if (item.spec_values.length > 1) {
let index = beforeLength;
let filterSkuInfo = this.skuInfo.filter(i => i.name !== item.name);
let filterSkuInfo = this.skuInfo.filter((i) => i.name !== item.name);
let totalLength = 1;
filterSkuInfo.forEach(skuInfo => {
filterSkuInfo.forEach((skuInfo) => {
totalLength *= skuInfo.spec_values.length;
});
for (let i = 0; i < totalLength; i++) {
@ -1481,7 +1486,6 @@ export default {
this.skuTableData.splice(index, 0, find);
index += beforeLength + 1;
}
}
this.baseInfoForm.regeneratorSkuFlag = true;
}
@ -1535,7 +1539,7 @@ export default {
title: "价格",
slot: "price",
}
)
);
}
if (this.baseInfoForm.salesModel === "WHOLESALE" && this.wholesaleData) {
@ -1548,8 +1552,10 @@ export default {
}
//
if (this.baseInfoForm.goodsType !== "VIRTUAL_GOODS" &&
this.baseInfoForm.salesModel !== "WHOLESALE") {
if (
this.baseInfoForm.goodsType !== "VIRTUAL_GOODS" &&
this.baseInfoForm.salesModel !== "WHOLESALE"
) {
pushData.push({
title: "重量",
slot: "weight",
@ -1578,11 +1584,14 @@ export default {
let result = [];
this.skuIndex = 0;
this.skuTableData = this.specIterator(result, this.skuInfo, this.skuTableData);
this.skuTableData = this.specIterator(
result,
this.skuInfo,
this.skuTableData
);
}
},
/**
* 迭代属性形成表格
* result 渲染的数据
@ -1591,12 +1600,10 @@ export default {
specIterator(result, spec, skus) {
let table = result;
if (spec.length > 0) {
//
let cloneTemp = cloneObj(spec);
cloneTemp.shift();
spec[0].spec_values.forEach(specItem => {
spec[0].spec_values.forEach((specItem) => {
let index = this.skuIndex;
if (table[index]) {
table[index][spec[0].name] = specItem.value;
@ -1627,7 +1634,7 @@ export default {
}
table = this.specIterator(table, cloneTemp, skus, index);
})
});
} else {
this.skuIndex++;
}
@ -1849,11 +1856,9 @@ export default {
onOk: () => {
delete this.baseInfoForm.id;
this.SAVE_DRAFT_GOODS();
},
onCancel: () => {
this.SAVE_DRAFT_GOODS();
},
});
return;