fix: 🐛 修复热区弹框优先级问题。优化编辑商品时,可修改分类与商品类型
parent
0933f1942e
commit
685ec5f679
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<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">
|
<template v-if="flag">
|
||||||
<goodsDialog @selected="(val) => {goodsData = val;}"
|
<goodsDialog @selected="(val) => {goodsData = val;}"
|
||||||
v-if="goodsFlag" ref="goodsDialog" :selectedWay='goodsData'/>
|
v-if="goodsFlag" ref="goodsDialog" :selectedWay='goodsData'/>
|
||||||
|
|
|
@ -185,8 +185,8 @@ export default {
|
||||||
GET_GoodsTemplate() {
|
GET_GoodsTemplate() {
|
||||||
API_GOODS.getDraftGoodsListData(this.searchParams).then((res) => {
|
API_GOODS.getDraftGoodsListData(this.searchParams).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.goodsTemplates.push(...res.result.records)
|
this.goodsTemplates.push(...res.result.records);
|
||||||
this.templateTotal = res.result.total
|
this.templateTotal = res.result.total;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -234,13 +234,15 @@ export default {
|
||||||
this.$Message.error("必须选择到三级分类");
|
this.$Message.error("必须选择到三级分类");
|
||||||
return;
|
return;
|
||||||
} else if (this.category[2].name) {
|
} else if (this.category[2].name) {
|
||||||
if (this.selectedTemplate.id) {
|
let params = {
|
||||||
this.$emit("change", { tempId: this.selectedTemplate.id });
|
|
||||||
} else {
|
|
||||||
this.$emit("change", {
|
|
||||||
category: this.category,
|
category: this.category,
|
||||||
goodsType: this.goodsType,
|
goodsType: this.goodsType,
|
||||||
});
|
};
|
||||||
|
if (this.selectedTemplate.id) {
|
||||||
|
params.tempId = this.selectedTemplate.id;
|
||||||
|
this.$emit("change", params);
|
||||||
|
} else {
|
||||||
|
this.$emit("change", params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -154,8 +154,7 @@
|
||||||
type="error"
|
type="error"
|
||||||
@click="handleDeleteWholesaleData(index)"
|
@click="handleDeleteWholesaleData(index)"
|
||||||
>删除
|
>删除
|
||||||
</Button
|
</Button>
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
|
@ -319,8 +318,7 @@
|
||||||
<div>
|
<div>
|
||||||
<Button @click="addSpec($index, item)"
|
<Button @click="addSpec($index, item)"
|
||||||
>添加规格值
|
>添加规格值
|
||||||
</Button
|
</Button>
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
@ -331,8 +329,7 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="addSkuItem"
|
@click="addSkuItem"
|
||||||
>添加规格项
|
>添加规格项
|
||||||
</Button
|
</Button>
|
||||||
>
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
class="add-sku-btn"
|
class="add-sku-btn"
|
||||||
|
@ -340,8 +337,7 @@
|
||||||
type="warning"
|
type="warning"
|
||||||
@click="handleClearSku"
|
@click="handleClearSku"
|
||||||
>清空规格项
|
>清空规格项
|
||||||
</Button
|
</Button>
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</Panel>
|
</Panel>
|
||||||
<Panel name="2">
|
<Panel name="2">
|
||||||
|
@ -548,8 +544,7 @@
|
||||||
<div class="promise-intro-btn">
|
<div class="promise-intro-btn">
|
||||||
<Button type="primary" @click="promiseIntroEditor"
|
<Button type="primary" @click="promiseIntroEditor"
|
||||||
>将PC商品描述同步到移动端描述
|
>将PC商品描述同步到移动端描述
|
||||||
</Button
|
</Button>
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
|
@ -688,12 +683,7 @@
|
||||||
<!-- 底部按钮 -->
|
<!-- 底部按钮 -->
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<Button
|
<Button type="primary" @click="pre">上一步 </Button>
|
||||||
v-if="!$route.query.id && !$route.query.draftId"
|
|
||||||
type="primary"
|
|
||||||
@click="pre"
|
|
||||||
>上一步
|
|
||||||
</Button>
|
|
||||||
<Button :loading="submitLoading" type="primary" @click="save">
|
<Button :loading="submitLoading" type="primary" @click="save">
|
||||||
{{ this.$route.query.id ? "保存" : "保存商品" }}
|
{{ this.$route.query.id ? "保存" : "保存商品" }}
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -1192,15 +1182,28 @@ export default {
|
||||||
this.getGoodsBrandList();
|
this.getGoodsBrandList();
|
||||||
/** 查询商品参数 */
|
/** 查询商品参数 */
|
||||||
this.GET_GoodsParams();
|
this.GET_GoodsParams();
|
||||||
/** 查询店铺商品分类 */
|
/** 查询店铺商品分类 */
|
||||||
this.GET_ShopGoodsLabel();
|
this.GET_ShopGoodsLabel();
|
||||||
this.GET_GoodsUnit();
|
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数据
|
// 渲染sku数据
|
||||||
renderGoodsDetailSku(skuList) {
|
renderGoodsDetailSku(skuList) {
|
||||||
let skus = [];
|
let skus = [];
|
||||||
let skusInfo = [];
|
let skusInfo = [];
|
||||||
console.log(skuList);
|
|
||||||
skuList.map((e) => {
|
skuList.map((e) => {
|
||||||
let sku = {
|
let sku = {
|
||||||
id: e.id,
|
id: e.id,
|
||||||
|
@ -1386,10 +1389,10 @@ export default {
|
||||||
// 最后一个规格项生成规格数据规则: 如为最后一个规格项,则在规格列表每隔1个中删除n(n为最后一个规格项的规格值列表数量 - 1)个规格数据,生成一个规格数据
|
// 最后一个规格项生成规格数据规则: 如为最后一个规格项,则在规格列表每隔1个中删除n(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 index = 1;
|
||||||
let totalLength = 1;
|
let totalLength = 1;
|
||||||
filterSkuInfo.forEach(skuInfo => {
|
filterSkuInfo.forEach((skuInfo) => {
|
||||||
totalLength *= skuInfo.spec_values.length;
|
totalLength *= skuInfo.spec_values.length;
|
||||||
});
|
});
|
||||||
// 去除第一个,因为第一个不需要生成新的规格数据
|
// 去除第一个,因为第一个不需要生成新的规格数据
|
||||||
|
@ -1401,7 +1404,8 @@ export default {
|
||||||
}
|
}
|
||||||
} else {
|
} 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--) {
|
for (let i = this.skuInfo.length - 2; i > itemIndex; i--) {
|
||||||
// 计算每次删除规格数据后移动的位置(计算规则为,以最后的规格项的规格值数量为基础,乘以其他规格项的规格值总数)
|
// 计算每次删除规格数据后移动的位置(计算规则为,以最后的规格项的规格值数量为基础,乘以其他规格项的规格值总数)
|
||||||
currentNum *= this.skuInfo[i].spec_values.length;
|
currentNum *= this.skuInfo[i].spec_values.length;
|
||||||
|
@ -1409,20 +1413,21 @@ export default {
|
||||||
// 移除对应规格数据的起始索引,起始位置为每次生成条数的下一位
|
// 移除对应规格数据的起始索引,起始位置为每次生成条数的下一位
|
||||||
let beginIndex = currentNum + 1;
|
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;
|
let totalLength = 1;
|
||||||
filterSkuInfo.forEach(skuInfo => {
|
filterSkuInfo.forEach((skuInfo) => {
|
||||||
totalLength *= skuInfo.spec_values.length;
|
totalLength *= skuInfo.spec_values.length;
|
||||||
});
|
});
|
||||||
for (let i = 0; i < totalLength; i++) {
|
for (let i = 0; i < totalLength; i++) {
|
||||||
// 移除对应的规格数据,删除数量为 每次生成条数 * (当前规格项的规格值总数 - 1)
|
// 移除对应的规格数据,删除数量为 每次生成条数 * (当前规格项的规格值总数 - 1)
|
||||||
this.skuTableData.splice(beginIndex, currentNum * (item.spec_values.length - 1));
|
this.skuTableData.splice(
|
||||||
|
beginIndex,
|
||||||
|
currentNum * (item.spec_values.length - 1)
|
||||||
|
);
|
||||||
beginIndex += currentNum;
|
beginIndex += currentNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
this.skuInfo.splice($index, 1)
|
this.skuInfo.splice($index, 1);
|
||||||
|
|
||||||
|
|
||||||
this.skuTableData = this.skuTableData.map((e) => {
|
this.skuTableData = this.skuTableData.map((e) => {
|
||||||
delete e[item.name];
|
delete e[item.name];
|
||||||
|
@ -1463,9 +1468,9 @@ export default {
|
||||||
});
|
});
|
||||||
if (item.spec_values.length > 1) {
|
if (item.spec_values.length > 1) {
|
||||||
let index = beforeLength;
|
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;
|
let totalLength = 1;
|
||||||
filterSkuInfo.forEach(skuInfo => {
|
filterSkuInfo.forEach((skuInfo) => {
|
||||||
totalLength *= skuInfo.spec_values.length;
|
totalLength *= skuInfo.spec_values.length;
|
||||||
});
|
});
|
||||||
for (let i = 0; i < totalLength; i++) {
|
for (let i = 0; i < totalLength; i++) {
|
||||||
|
@ -1481,7 +1486,6 @@ export default {
|
||||||
this.skuTableData.splice(index, 0, find);
|
this.skuTableData.splice(index, 0, find);
|
||||||
index += beforeLength + 1;
|
index += beforeLength + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
this.baseInfoForm.regeneratorSkuFlag = true;
|
this.baseInfoForm.regeneratorSkuFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -1535,7 +1539,7 @@ export default {
|
||||||
title: "价格",
|
title: "价格",
|
||||||
slot: "price",
|
slot: "price",
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.baseInfoForm.salesModel === "WHOLESALE" && this.wholesaleData) {
|
if (this.baseInfoForm.salesModel === "WHOLESALE" && this.wholesaleData) {
|
||||||
|
@ -1548,8 +1552,10 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 有重量的情况
|
// 有重量的情况
|
||||||
if (this.baseInfoForm.goodsType !== "VIRTUAL_GOODS" &&
|
if (
|
||||||
this.baseInfoForm.salesModel !== "WHOLESALE") {
|
this.baseInfoForm.goodsType !== "VIRTUAL_GOODS" &&
|
||||||
|
this.baseInfoForm.salesModel !== "WHOLESALE"
|
||||||
|
) {
|
||||||
pushData.push({
|
pushData.push({
|
||||||
title: "重量",
|
title: "重量",
|
||||||
slot: "weight",
|
slot: "weight",
|
||||||
|
@ -1578,11 +1584,14 @@ export default {
|
||||||
let result = [];
|
let result = [];
|
||||||
this.skuIndex = 0;
|
this.skuIndex = 0;
|
||||||
|
|
||||||
this.skuTableData = this.specIterator(result, this.skuInfo, this.skuTableData);
|
this.skuTableData = this.specIterator(
|
||||||
|
result,
|
||||||
|
this.skuInfo,
|
||||||
|
this.skuTableData
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 迭代属性,形成表格
|
* 迭代属性,形成表格
|
||||||
* result 渲染的数据
|
* result 渲染的数据
|
||||||
|
@ -1591,12 +1600,10 @@ export default {
|
||||||
specIterator(result, spec, skus) {
|
specIterator(result, spec, skus) {
|
||||||
let table = result;
|
let table = result;
|
||||||
if (spec.length > 0) {
|
if (spec.length > 0) {
|
||||||
|
|
||||||
//清除当前循环的分组
|
//清除当前循环的分组
|
||||||
let cloneTemp = cloneObj(spec);
|
let cloneTemp = cloneObj(spec);
|
||||||
cloneTemp.shift();
|
cloneTemp.shift();
|
||||||
spec[0].spec_values.forEach(specItem => {
|
spec[0].spec_values.forEach((specItem) => {
|
||||||
|
|
||||||
let index = this.skuIndex;
|
let index = this.skuIndex;
|
||||||
if (table[index]) {
|
if (table[index]) {
|
||||||
table[index][spec[0].name] = specItem.value;
|
table[index][spec[0].name] = specItem.value;
|
||||||
|
@ -1627,7 +1634,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
table = this.specIterator(table, cloneTemp, skus, index);
|
table = this.specIterator(table, cloneTemp, skus, index);
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.skuIndex++;
|
this.skuIndex++;
|
||||||
}
|
}
|
||||||
|
@ -1849,11 +1856,9 @@ export default {
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
delete this.baseInfoForm.id;
|
delete this.baseInfoForm.id;
|
||||||
this.SAVE_DRAFT_GOODS();
|
this.SAVE_DRAFT_GOODS();
|
||||||
|
|
||||||
},
|
},
|
||||||
onCancel: () => {
|
onCancel: () => {
|
||||||
this.SAVE_DRAFT_GOODS();
|
this.SAVE_DRAFT_GOODS();
|
||||||
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue