From 637303fc1a3f96f578854cb53026fa332eaade2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BD=99=E5=90=8C=E5=AD=A6?= <2495967527@qq.com>
Date: Sun, 18 Aug 2024 18:04:26 +0800
Subject: [PATCH] add
---
.../modules/product/popup/add-or-update.vue | 129 ++++++++++++++++--
.../product/popup/add-specifications.vue | 14 +-
2 files changed, 123 insertions(+), 20 deletions(-)
diff --git a/src/views/modules/product/popup/add-or-update.vue b/src/views/modules/product/popup/add-or-update.vue
index a79fb6b..f8fa261 100644
--- a/src/views/modules/product/popup/add-or-update.vue
+++ b/src/views/modules/product/popup/add-or-update.vue
@@ -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 (
+
+ 单位(元)
+
+ );
+ },
+ },
{
label: "价格",
prop: "singlePrice",
@@ -541,10 +574,12 @@ export default {
render: () => {
return (
0}
+ readonly={this.modalData.specType != 0}
placeholder="请输入价格"
v-model={this.modalData.singlePrice}
- >
+ >
+ 单位(元)
+
);
},
},
@@ -555,13 +590,41 @@ export default {
render: () => {
return (
0}
+ readonly={this.modalData.specType != 0}
placeholder="请输入库存"
v-model={this.modalData.singleStock}
>
);
},
},
+ {
+ label: "重量",
+ prop: "weight",
+ type: "jsx",
+ render: () => {
+ return (
+
+ );
+ },
+ },
+ {
+ label: "体积",
+ prop: "volume",
+ type: "jsx",
+ render: () => {
+ return (
+
+ );
+ },
+ },
{
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);
diff --git a/src/views/modules/product/popup/add-specifications.vue b/src/views/modules/product/popup/add-specifications.vue
index be0ed54..15b1c23 100644
--- a/src/views/modules/product/popup/add-specifications.vue
+++ b/src/views/modules/product/popup/add-specifications.vue
@@ -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 {
@@ -343,7 +345,7 @@ export default {
},
},
{
- title: "体积",
+ title: "体积(立方米)",
field: "volume",
align: "center",
"min-width": "160px",