mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2025-12-17 08:25:52 +08:00
fix(商品操作): 优化模板和方法中的代码格式,提升可读性
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
<FormItem label="商品分类">
|
<FormItem label="商品分类">
|
||||||
<span class="goods-category-name">{{
|
<span class="goods-category-name">{{
|
||||||
this.baseInfoForm.categoryName[0]
|
this.baseInfoForm.categoryName[0]
|
||||||
}}</span>
|
}}</span>
|
||||||
<span> > {{ this.baseInfoForm.categoryName[1] }}</span>
|
<span> > {{ this.baseInfoForm.categoryName[1] }}</span>
|
||||||
<span> > {{ this.baseInfoForm.categoryName[2] }}</span>
|
<span> > {{ this.baseInfoForm.categoryName[2] }}</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
@on-blur="checkWholesaleNum(index)">
|
@on-blur="checkWholesaleNum(index)">
|
||||||
<span slot="append">{{
|
<span slot="append">{{
|
||||||
baseInfoForm.goodsUnit || ""
|
baseInfoForm.goodsUnit || ""
|
||||||
}}</span>
|
}}</span>
|
||||||
</Input>
|
</Input>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -233,8 +233,8 @@
|
|||||||
:on-exceeded-size="handleMaxSize" :on-format-error="handleFormatError"
|
:on-exceeded-size="handleMaxSize" :on-format-error="handleFormatError"
|
||||||
:on-progress="() => { $Spin.show(); }" :on-success="(res, file) => {
|
:on-progress="() => { $Spin.show(); }" :on-success="(res, file) => {
|
||||||
handleSuccess(res, file, val.images)
|
handleSuccess(res, file, val.images)
|
||||||
}" :show-upload-list="false"
|
}" :show-upload-list="false" style="width: 180px;height: 140px;margin-right: 10px"
|
||||||
style="width: 180px;height: 140px;margin-right: 10px" type="drag">
|
type="drag">
|
||||||
<div>
|
<div>
|
||||||
<Icon size="136" type="ios-camera"></Icon>
|
<Icon size="136" type="ios-camera"></Icon>
|
||||||
</div>
|
</div>
|
||||||
@@ -291,7 +291,7 @@
|
|||||||
@on-change="updateSkuTable(row, 'quantity')">
|
@on-change="updateSkuTable(row, 'quantity')">
|
||||||
<span slot="append">{{
|
<span slot="append">{{
|
||||||
baseInfoForm.goodsUnit || ""
|
baseInfoForm.goodsUnit || ""
|
||||||
}}</span>
|
}}</span>
|
||||||
</Input>
|
</Input>
|
||||||
</template>
|
</template>
|
||||||
<template slot="cost" slot-scope="{ row }">
|
<template slot="cost" slot-scope="{ row }">
|
||||||
@@ -408,16 +408,17 @@
|
|||||||
<p slot="content">
|
<p slot="content">
|
||||||
<FormItem v-for="(paramsItem, paramsIndex) in paramsGroup.params" :key="paramsIndex"
|
<FormItem v-for="(paramsItem, paramsIndex) in paramsGroup.params" :key="paramsIndex"
|
||||||
:label="`${paramsItem.paramName}:`"
|
:label="`${paramsItem.paramName}:`"
|
||||||
:rules="{ required: paramsItem.required, message: '参数不能为空', trigger: 'blur'}">
|
:rules="{ required: paramsItem.required, message: '参数不能为空', trigger: 'blur' }">
|
||||||
<Select v-model="paramsItem.paramValue" clearable placeholder="请选择" style="width: 200px" @on-change="
|
<Select v-model="paramsItem.paramValue" clearable placeholder="请选择" style="width: 200px"
|
||||||
selectParams(
|
@on-change="
|
||||||
paramsGroup,
|
selectParams(
|
||||||
groupIndex,
|
paramsGroup,
|
||||||
paramsItem,
|
groupIndex,
|
||||||
paramsIndex,
|
paramsItem,
|
||||||
paramsItem.paramValue
|
paramsIndex,
|
||||||
)
|
paramsItem.paramValue
|
||||||
">
|
)
|
||||||
|
">
|
||||||
<Option v-for="option in paramsItem.options.split(',')" :key="option" :label="option"
|
<Option v-for="option in paramsItem.options.split(',')" :key="option" :label="option"
|
||||||
:value="option">
|
:value="option">
|
||||||
</Option>
|
</Option>
|
||||||
@@ -1053,7 +1054,7 @@ export default {
|
|||||||
this.baseInfoForm = { ...this.baseInfoForm, ...response.result };
|
this.baseInfoForm = { ...this.baseInfoForm, ...response.result };
|
||||||
this.baseInfoForm.release = 1; //即使是被放入仓库,修改的时候也会显示会立即发布
|
this.baseInfoForm.release = 1; //即使是被放入仓库,修改的时候也会显示会立即发布
|
||||||
this.categoryId = response.result.categoryPath.split(",")[2];
|
this.categoryId = response.result.categoryPath.split(",")[2];
|
||||||
|
|
||||||
// 如果是复制商品,需要清除ID,确保提交时作为新商品
|
// 如果是复制商品,需要清除ID,确保提交时作为新商品
|
||||||
if (this.$route.query.copyId) {
|
if (this.$route.query.copyId) {
|
||||||
this.baseInfoForm.id = "";
|
this.baseInfoForm.id = "";
|
||||||
@@ -1315,6 +1316,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 编辑规格值
|
// 编辑规格值
|
||||||
skuValueChange(val, index, item) {
|
skuValueChange(val, index, item) {
|
||||||
|
|
||||||
if (this.skuTableData.find((i) => i[val.name] === val.value)) {
|
if (this.skuTableData.find((i) => i[val.name] === val.value)) {
|
||||||
this.$Message.error("已存在相同规格值!");
|
this.$Message.error("已存在相同规格值!");
|
||||||
|
|
||||||
@@ -1324,9 +1326,6 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.containsSameSkuValue = false;
|
this.containsSameSkuValue = false;
|
||||||
if (val.value === '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.zz(0, val.value) > 20) {
|
if (this.zz(0, val.value) > 20) {
|
||||||
this.$Message.error("规格值最多十个字符长度!");
|
this.$Message.error("规格值最多十个字符长度!");
|
||||||
// val.value = val.value.toString().slice(0, 4);
|
// val.value = val.value.toString().slice(0, 4);
|
||||||
@@ -1363,7 +1362,6 @@ export default {
|
|||||||
},
|
},
|
||||||
checkSkuVal(val, groupIndex, spec) {
|
checkSkuVal(val, groupIndex, spec) {
|
||||||
if (val.value === "") {
|
if (val.value === "") {
|
||||||
this.$Message.error("规格值不能为空!");
|
|
||||||
// 移除当前规格组中的空值
|
// 移除当前规格组中的空值
|
||||||
if (this.skuInfo[groupIndex]) {
|
if (this.skuInfo[groupIndex]) {
|
||||||
this.skuInfo[groupIndex].spec_values = this.skuInfo[groupIndex].spec_values.filter((i) => i.value !== "");
|
this.skuInfo[groupIndex].spec_values = this.skuInfo[groupIndex].spec_values.filter((i) => i.value !== "");
|
||||||
@@ -1821,17 +1819,17 @@ export default {
|
|||||||
let checkFlag = false;
|
let checkFlag = false;
|
||||||
this.goodsParams.forEach(group => {
|
this.goodsParams.forEach(group => {
|
||||||
group.params.forEach(param => {
|
group.params.forEach(param => {
|
||||||
if(param.required){
|
if (param.required) {
|
||||||
const check = this.baseInfoForm.goodsParamsDTOList.some(paramsGroup =>
|
const check = this.baseInfoForm.goodsParamsDTOList.some(paramsGroup =>
|
||||||
paramsGroup.goodsParamsItemDTOList.some(paramsItem => paramsItem.paramId === param.id)
|
paramsGroup.goodsParamsItemDTOList.some(paramsItem => paramsItem.paramId === param.id)
|
||||||
);
|
);
|
||||||
if(!check){
|
if (!check) {
|
||||||
checkFlag = !check;
|
checkFlag = !check;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
if(checkFlag){
|
if (checkFlag) {
|
||||||
this.$Message.error("存在未填写的参数项");
|
this.$Message.error("存在未填写的参数项");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1846,7 +1844,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.baseInfoForm.wholesaleList = this.wholesaleData;
|
this.baseInfoForm.wholesaleList = this.wholesaleData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断是否是复制商品
|
// 判断是否是复制商品
|
||||||
if (!this.$route.query.copyId) {
|
if (!this.$route.query.copyId) {
|
||||||
this.baseInfoForm.goodsId = this.goodsId;
|
this.baseInfoForm.goodsId = this.goodsId;
|
||||||
|
|||||||
Reference in New Issue
Block a user