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

@ -144,7 +144,7 @@ export default {
pageSize: 10,
pageNumber: 1,
},
templateTotal:0,
templateTotal: 0,
};
},
methods: {
@ -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) {
let params = {
category: this.category,
goodsType: this.goodsType,
};
if (this.selectedTemplate.id) {
this.$emit("change", { tempId: this.selectedTemplate.id });
params.tempId = this.selectedTemplate.id;
this.$emit("change", params);
} else {
this.$emit("change", {
category: this.category,
goodsType: this.goodsType,
});
this.$emit("change", params);
}
}
},
@ -252,7 +254,7 @@ export default {
</script>
<style lang="scss" scoped>
@import "./addGoods.scss";
/deep/ .ivu-scroll-container{
height:450px !important;
/deep/ .ivu-scroll-container {
height: 450px !important;
}
</style>

View File

@ -12,8 +12,8 @@
<div class="form-item-view">
<FormItem label="商品分类">
<span class="goods-category-name">{{
this.baseInfoForm.categoryName[0]
}}</span>
this.baseInfoForm.categoryName[0]
}}</span>
<span> &gt; {{ this.baseInfoForm.categoryName[1] }}</span>
<span> &gt; {{ this.baseInfoForm.categoryName[2] }}</span>
</FormItem>
@ -71,7 +71,7 @@
v-for="(item, index) in goodsUnitList"
:key="index"
:value="item"
>{{ item }}
>{{ item }}
</Option>
</Select>
</FormItem>
@ -124,8 +124,8 @@
@on-blur="checkWholesaleNum(index)"
>
<span slot="append">{{
baseInfoForm.goodsUnit || ""
}}</span>
baseInfoForm.goodsUnit || ""
}}</span>
</Input>
</div>
</template>
@ -153,9 +153,8 @@
style="margin-left: 5px"
type="error"
@click="handleDeleteWholesaleData(index)"
>删除
</Button
>
>删除
</Button>
</div>
</template>
</Table>
@ -197,7 +196,7 @@
class="demo-upload-list"
>
<template>
<img :src="item.url"/>
<img :src="item.url" />
<div class="demo-upload-list-cover">
<div>
<Icon
@ -318,9 +317,8 @@
</div>
<div>
<Button @click="addSpec($index, item)"
>添加规格值
</Button
>
>添加规格值
</Button>
</div>
</Card>
</div>
@ -330,18 +328,16 @@
size="small"
type="primary"
@click="addSkuItem"
>添加规格项
</Button
>
>添加规格项
</Button>
&nbsp;
<Button
class="add-sku-btn"
size="small"
type="warning"
@click="handleClearSku"
>清空规格项
</Button
>
>清空规格项
</Button>
</div>
</Panel>
<Panel name="2">
@ -389,8 +385,8 @@
@on-change="updateSkuTable(row, 'quantity')"
>
<span slot="append">{{
baseInfoForm.goodsUnit || ""
}}</span>
baseInfoForm.goodsUnit || ""
}}</span>
</Input>
</template>
<template slot="cost" slot-scope="{ row }">
@ -460,7 +456,7 @@
:src="previewPicture"
/>
</div>
<Divider/>
<Divider />
<vuedraggable
:animation="200"
:list="selectedSku.images"
@ -472,7 +468,7 @@
class="sku-upload-list"
>
<template>
<img :src="img.url"/>
<img :src="img.url" />
<div class="sku-upload-list-cover">
<Icon
type="md-search"
@ -547,9 +543,8 @@
></editor>
<div class="promise-intro-btn">
<Button type="primary" @click="promiseIntroEditor"
>将PC商品描述同步到移动端描述
</Button
>
>将PC商品描述同步到移动端描述
</Button>
</div>
</FormItem>
@ -580,7 +575,7 @@
v-for="item in logisticsTemplate"
:key="item.id"
:value="item.id"
>{{ item.name }}
>{{ item.name }}
</Option>
</Select>
</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>
@ -708,9 +698,9 @@ import * as API_Shop from "@/api/shops";
import cloneObj from "@/utils/index";
import vuedraggable from "vuedraggable";
import Editor from "@tinymce/tinymce-vue";
import {initEditor} from "@/views/lili-components/editor/config";
import {uploadFile} from "@/libs/axios";
import {regular} from "@/utils";
import { initEditor } from "@/views/lili-components/editor/config";
import { uploadFile } from "@/libs/axios";
import { regular } from "@/utils";
export default {
name: "goodsOperationSec",
@ -860,9 +850,9 @@ export default {
validateError: [],
baseInfoFormRule: {
goodsName: [regular.REQUIRED, regular.WHITE_SPACE, regular.VARCHAR60],
price: [regular.REQUIRED, {validator: checkPrice}],
price: [regular.REQUIRED, { validator: checkPrice }],
sellingPoint: [regular.REQUIRED, regular.VARCHAR60],
goodsUnit: [{required: true, message: "请选择计量单位"}],
goodsUnit: [{ required: true, message: "请选择计量单位" }],
name: [regular.REQUIRED, regular.VARCHAR5],
value: [regular.REQUIRED, regular.VARCHAR60],
templateId: [regular.REQUIRED],
@ -924,7 +914,7 @@ export default {
) {
this.baseInfoForm.goodsParamsDTOList[groupIndex].goodsParamsItemDTOList[
paramsIndex
] = {
] = {
paramName: "",
paramValue: "",
isIndex: "",
@ -935,7 +925,7 @@ export default {
}
this.baseInfoForm.goodsParamsDTOList[groupIndex].goodsParamsItemDTOList[
paramsIndex
] = {
] = {
paramName: params.paramName,
paramValue: value,
isIndex: params.isIndex,
@ -1100,7 +1090,7 @@ export default {
this.selectedSku.images !== undefined &&
this.selectedSku.images.length > 5;
if (check) {
this.$Notice.warning({title: "图片数量不能大于五张"});
this.$Notice.warning({ title: "图片数量不能大于五张" });
return false;
}
},
@ -1159,7 +1149,7 @@ export default {
response.result.recommend
? (response.result.recommend = 1)
: (response.result.recommend = 0);
this.baseInfoForm = {...this.baseInfoForm, ...response.result};
this.baseInfoForm = { ...this.baseInfoForm, ...response.result };
this.baseInfoForm.release = 1; //使
this.categoryId = response.result.categoryPath.split(",")[2];
@ -1169,7 +1159,7 @@ export default {
) {
this.baseInfoForm.goodsGalleryFiles =
response.result.goodsGalleryList.map((i) => {
return {url: i};
return { url: i };
});
}
@ -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,
@ -1311,7 +1314,7 @@ export default {
}
//
this.$set(this.skuInfo, this.skuInfo.length, {
spec_values: [{name: "", value: ""}],
spec_values: [{ name: "", value: "" }],
name: "",
});
@ -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;
@ -1877,7 +1882,7 @@ export default {
API_GOODS.saveDraftGoods(this.baseInfoForm).then((res) => {
if (res.success) {
this.$Message.info("保存成功!");
this.$router.push({name: "template-goods"});
this.$router.push({ name: "template-goods" });
}
});
},