|
@@ -10,7 +10,7 @@
|
|
|
highlight-current-row
|
|
|
:action-list="[
|
|
|
{
|
|
|
- text: '添加商品',
|
|
|
+ text: '添加产品',
|
|
|
action: () => openModal('add'),
|
|
|
},
|
|
|
]"
|
|
@@ -112,6 +112,7 @@ const loading = ref(false);
|
|
|
const submitLoading = ref(false);
|
|
|
const specDict = ref([]);
|
|
|
const enableStatus = ref([]);
|
|
|
+const productCategoryList = ref([]);
|
|
|
const contentType = ref([]);
|
|
|
const sourceList = ref({
|
|
|
data: [],
|
|
@@ -142,7 +143,13 @@ const config = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
- label: "商品名称",
|
|
|
+ label: "产品类目",
|
|
|
+ prop: "title",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "产品名称",
|
|
|
prop: "title",
|
|
|
},
|
|
|
},
|
|
@@ -157,6 +164,9 @@ const config = computed(() => {
|
|
|
label: "产品规格",
|
|
|
prop: "spec",
|
|
|
},
|
|
|
+ render(val) {
|
|
|
+ return convertDict(val);
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
@@ -238,6 +248,13 @@ const byform = ref(null);
|
|
|
const formConfig = computed(() => {
|
|
|
return [
|
|
|
{
|
|
|
+ type: "select",
|
|
|
+ prop: "categoryId",
|
|
|
+ label: "产品类目",
|
|
|
+ itemWidth: 100,
|
|
|
+ data: productCategoryList.value,
|
|
|
+ },
|
|
|
+ {
|
|
|
type: "input",
|
|
|
prop: "title",
|
|
|
label: "标题",
|
|
@@ -284,7 +301,7 @@ const formConfig = computed(() => {
|
|
|
width: "50%",
|
|
|
},
|
|
|
},
|
|
|
- {
|
|
|
+/* {
|
|
|
type: "select",
|
|
|
prop: "contentType",
|
|
|
label: "详情类型",
|
|
@@ -297,13 +314,13 @@ const formConfig = computed(() => {
|
|
|
slotName: "contentImg",
|
|
|
label: "详情图片",
|
|
|
isShow: formData.data.contentType == "1"
|
|
|
- },
|
|
|
+ },*/
|
|
|
{
|
|
|
type: "slot",
|
|
|
prop: "content",
|
|
|
slotName: "content",
|
|
|
label: "详情内容",
|
|
|
- isShow: formData.data.contentType == "2"
|
|
|
+ // isShow: formData.data.contentType == "2"
|
|
|
},
|
|
|
];
|
|
|
});
|
|
@@ -326,21 +343,22 @@ const openModal = () => {
|
|
|
};
|
|
|
const submitForm = () => {
|
|
|
byform.value.handleSubmit((valid) => {
|
|
|
+ if(!(formData.data.coverUrlList && formData.data.coverUrlList.length > 0)){
|
|
|
+ ElMessage.error("请上传封面图片");
|
|
|
+ return;
|
|
|
+ }
|
|
|
submitLoading.value = true;
|
|
|
- proxy
|
|
|
- .post("/productInfo/" + modalType.value, formData.data)
|
|
|
- .then((res) => {
|
|
|
- ElMessage({
|
|
|
- message: modalType.value == "add" ? "添加成功" : "编辑成功",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- dialogVisible.value = false;
|
|
|
- submitLoading.value = false;
|
|
|
- getList();
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- submitLoading.value = false;
|
|
|
+ proxy.post("/productInfo/" + modalType.value, formData.data).then((res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: modalType.value == "add" ? "添加成功" : "编辑成功",
|
|
|
+ type: "success",
|
|
|
});
|
|
|
+ dialogVisible.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ getList();
|
|
|
+ }).catch((err) => {
|
|
|
+ submitLoading.value = false;
|
|
|
+ });
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -397,10 +415,26 @@ const del = (row) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const convertDict = (val) => {
|
|
|
+ if(val != null && val != undefined && val != 'undefined'){
|
|
|
+ let arr = val.split(",");
|
|
|
+ let str = '';
|
|
|
+ arr.forEach((item) => {
|
|
|
+ specDict.value.forEach((item2) => {
|
|
|
+ if(item == item2.value){
|
|
|
+ str += item2.label + ",";
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ return str.substring(0, str.length - 1);
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+};
|
|
|
+
|
|
|
|
|
|
//获取字典
|
|
|
const getDictlist = async () => {
|
|
|
- const res = await getDictOneByXmhjc(["enable_status", "product_spec", "content_type"]);
|
|
|
+ const res = await getDictOneByXmhjc(["enable_status", "product_spec", "product_content_type"]);
|
|
|
enableStatus.value = res["enable_status"].map((x) => ({
|
|
|
label: x.dictValue,
|
|
|
value: x.dictKey,
|
|
@@ -409,10 +443,21 @@ const getDictlist = async () => {
|
|
|
label: x.dictValue,
|
|
|
value: x.dictKey,
|
|
|
}));
|
|
|
- contentType.value = res["content_type"].map((x) => ({
|
|
|
+ contentType.value = res["product_content_type"].map((x) => ({
|
|
|
label: x.dictValue,
|
|
|
value: x.dictKey,
|
|
|
}));
|
|
|
+ proxy.post("/productCategory/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 99999,
|
|
|
+ status: 1,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ productCategoryList.value = res.rows.map((x) => ({
|
|
|
+ label: x.name,
|
|
|
+ value: x.id,
|
|
|
+ }));
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
|