This commit is contained in:
余同学 2024-08-18 18:04:26 +08:00
parent 51c8d837c1
commit 637303fc1a
2 changed files with 123 additions and 20 deletions

View File

@ -158,6 +158,7 @@ export default {
if (!newVal) {
this.currentPanel = "基础信息";
this.fileList = [];
(this.fileListOne = []), (this.fileListTwo = []);
}
},
},
@ -186,14 +187,23 @@ export default {
productIntroducePhoto: "",
productPhotoList: [],
productPlace: "",
productSpecificationList: [],
productSpecificationList: [
{
attributeValue: "默认",
costPrice: 20,
salePrice: 30,
stockNum: 10,
weight: 1,
volume: 0.3,
},
],
productUnit: "",
productVideo: "",
shelfLife: "",
shopId: "",
singlePrice: "",
singleStock: "",
specType: "",
specType: 0,
status: "UP",
};
this.modalData.merchantId = JSON.parse(
@ -273,7 +283,7 @@ export default {
this.modalData.productSpecificationList
);
} else {
if (this.modalData.productAttributeList.length == 0) {
if (this.modalData.specType == 0) {
this.$refs.addSpecifications.toggle().update([], []);
} else {
this.$refs.addSpecifications
@ -287,6 +297,7 @@ export default {
},
//
getSpecs(tableData, AttributeData, salePrice, stockNum) {
this.modalData.specType = 1;
let AttributeList = AttributeData.map((item) => {
return {
attributeName: item.attributeName,
@ -525,6 +536,12 @@ export default {
{
label: "规格",
prop: "productSpecificationList",
// required: true,
// rules: {
// required: true,
// message: "",
// trigger: "blur",
// },
type: "jsx",
render: () => {
return (
@ -534,6 +551,22 @@ export default {
);
},
},
{
label: "成本",
prop: "minCostPrice",
type: "jsx",
render: () => {
return (
<el-input
readonly={this.modalData.specType != 0}
placeholder="请输入价格"
v-model={this.modalData.minCostPrice}
>
<template slot="append">单位</template>
</el-input>
);
},
},
{
label: "价格",
prop: "singlePrice",
@ -541,10 +574,12 @@ export default {
render: () => {
return (
<el-input
readonly={this.modalData.productAttributeList.length > 0}
readonly={this.modalData.specType != 0}
placeholder="请输入价格"
v-model={this.modalData.singlePrice}
></el-input>
>
<template slot="append">单位</template>
</el-input>
);
},
},
@ -555,13 +590,41 @@ export default {
render: () => {
return (
<el-input
readonly={this.modalData.productAttributeList.length > 0}
readonly={this.modalData.specType != 0}
placeholder="请输入库存"
v-model={this.modalData.singleStock}
></el-input>
);
},
},
{
label: "重量",
prop: "weight",
type: "jsx",
render: () => {
return (
<el-input
readonly={this.modalData.specType != 0}
placeholder="请输入库存"
v-model={this.modalData.weight}
></el-input>
);
},
},
{
label: "体积",
prop: "volume",
type: "jsx",
render: () => {
return (
<el-input
readonly={this.modalData.specType != 0}
placeholder="请输入库存"
v-model={this.modalData.volume}
></el-input>
);
},
},
{
label: "其他属性",
prop: "productAttributeList",
@ -630,8 +693,8 @@ export default {
label: "商品介绍图",
prop: "productIntroducePhoto",
type: "Input",
required: true,
rules: { required: true, message: "商品介绍图", trigger: "blur" },
// required: true,
// rules: { required: true, message: "", trigger: "blur" },
placeholder: "商品介绍图",
type: "jsx",
render: () => {
@ -680,12 +743,12 @@ export default {
{
label: "商品视频",
prop: "productVideo",
required: true,
rules: {
required: true,
message: "请填写商品描述",
trigger: "blur",
},
// required: true,
// rules: {
// required: true,
// message: "",
// trigger: "blur",
// },
type: "jsx",
render: () => {
const handleChange = (file, fileList) => {
@ -749,6 +812,25 @@ export default {
this.currentPanel = "其他信息";
} else {
console.log("请求接口", this.modalData);
if (this.modalData.specType == 0) {
this.modalData.productAttributeList = [
{
id: "1821213026050191360",
attributeName: "重量",
attributeValue: "1斤",
},
];
this.modalData.productSpecificationList = [
{
attributeValue: "默认",
costPrice: this.modalData.minCostPrice,
salePrice: this.modalData.singlePrice,
stockNum: this.modalData.singleStock,
weight: this.modalData.weight,
volume: this.modalData.volume,
},
];
}
this.$api.mer_admin.saveProduct(this.modalData).then((res) => {
console.log(res);
this.$emit("queryList");
@ -764,6 +846,25 @@ export default {
loading: this.isLoading,
submit: true,
handle: debounce(() => {
if (this.modalData.specType == 0) {
this.modalData.productAttributeList = [
{
id: "1821213026050191360",
attributeName: "重量",
attributeValue: "1斤",
},
];
this.modalData.productSpecificationList = [
{
attributeValue: "默认",
costPrice: this.modalData.minCostPrice,
salePrice: this.modalData.singlePrice,
stockNum: this.modalData.singleStock,
weight: this.modalData.weight,
volume: this.modalData.volume,
},
];
}
this.modalData.status = "DOWN";
this.$api.mer_admin.saveProduct(this.modalData).then((res) => {
console.log(res);

View File

@ -250,6 +250,8 @@ export default {
salePrice: 0,
costPrice: 0,
stockNum: 0,
weight: 0,
volume: 0,
};
});
console.log(data);
@ -266,7 +268,7 @@ export default {
"min-width": "160px",
},
{
title: "价格",
title: "价格(元)",
field: "salePrice",
align: "center",
"min-width": "160px",
@ -285,7 +287,7 @@ export default {
},
},
{
title: "成本",
title: "成本(元)",
field: "costPrice",
align: "center",
"min-width": "160px",
@ -324,8 +326,8 @@ export default {
},
},
{
title: "重量",
field: "stockNum",
title: "重量(千克)",
field: "weight",
align: "center",
"min-width": "160px",
type: "jsx",
@ -335,7 +337,7 @@ export default {
<el-input-number
min={0}
size="small"
v-model={row.stockNum}
v-model={row.weight}
placeholder="请输入重量"
></el-input-number>
</div>
@ -343,7 +345,7 @@ export default {
},
},
{
title: "体积",
title: "体积(立方米)",
field: "volume",
align: "center",
"min-width": "160px",