From c7a2ed4a0bbacf2cf61319c21c002a143ef73a35 Mon Sep 17 00:00:00 2001
From: luowenfeng <1092164058@qq.com>
Date: Thu, 22 Sep 2022 11:40:19 +0800
Subject: [PATCH] =?UTF-8?q?feature(=E7=AE=A1=E7=90=86=E5=90=8E=E5=8F=B0):?=
=?UTF-8?q?=20=E5=95=86=E5=93=81=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
yudao-ui-admin/src/router/index.js | 19 ++++++-
.../src/views/mall/product/spu/index.vue | 55 +------------------
.../src/views/mall/product/spu/save.vue | 35 +++++++-----
3 files changed, 42 insertions(+), 67 deletions(-)
diff --git a/yudao-ui-admin/src/router/index.js b/yudao-ui-admin/src/router/index.js
index 3f488e5de..846f812dc 100644
--- a/yudao-ui-admin/src/router/index.js
+++ b/yudao-ui-admin/src/router/index.js
@@ -104,7 +104,7 @@ export const constantRoutes = [
path: 'value/:propertyId(\\d+)',
component: (resolve) => require(['@/views/mall/product/property/value'], resolve),
name: 'PropertyValue',
- meta: {title: '规格数据', icon: '', activeMenu: '/mall/property'}
+ meta: {title: '规格数据', icon: '', activeMenu: '/product/property'}
}
]
}, {
@@ -129,6 +129,23 @@ export const constantRoutes = [
meta: {title: '修改生成配置', activeMenu: '/infra/codegen'}
}
]
+ }, {
+ path: '/spu',
+ component: Layout,
+ hidden: true,
+ children: [{
+ path: 'edit/:spuId(\\d+)',
+ component: (resolve) => require(['@/views/mall/product/spu/save'], resolve),
+ name: 'SpuEdit',
+ meta: {title: '修改商品', activeMenu: '/product/spu'}
+ },
+ {
+ path: 'add',
+ component: (resolve) => require(['@/views/mall/product/spu/save'], resolve),
+ name: 'SpuAdd',
+ meta: {title: '添加商品', activeMenu: '/product/spu'}
+ }
+ ]
}, {
path: '/bpm',
component: Layout,
diff --git a/yudao-ui-admin/src/views/mall/product/spu/index.vue b/yudao-ui-admin/src/views/mall/product/spu/index.vue
index b3a05979b..41d9ebf14 100644
--- a/yudao-ui-admin/src/views/mall/product/spu/index.vue
+++ b/yudao-ui-admin/src/views/mall/product/spu/index.vue
@@ -273,10 +273,6 @@
-
-
-
@@ -284,20 +280,9 @@
import {deleteSpu, getSpuPage,} from "@/api/mall/product/spu";
import {getProductCategoryList} from "@/api/mall/product/category";
import {getBrandList} from "@/api/mall/product/brand";
-import Editor from "@/components/Editor";
-import ImageUpload from "@/components/ImageUpload";
-import save from "./save";
-
-// 1. TODO @Luowenfeng:商品的添加、修改,走一个单独的页面,不走弹窗;https://v5.niuteam.cn/shop/goods/addgoods.html
-// 2. TODO
export default {
name: "Spu",
- components: {
- Editor,
- ImageUpload,
- save,
- },
data() {
return {
activeTabs: "all",
@@ -318,12 +303,6 @@ export default {
total: 0,
// 商品spu列表
list: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 弹出层参数
- dialogObj: {},
dateRangeCreateTime: [],
// 查询参数
queryParams: {
@@ -341,7 +320,6 @@ export default {
marketPriceMax: null,
tabStatus: null,
},
- tagIndex: 0,
};
},
created() {
@@ -383,12 +361,6 @@ export default {
this.loading = false;
});
},
-
- /** 取消按钮 */
- cancel() {
- this.open = false;
- this.reset();
- },
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
@@ -405,20 +377,11 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
- this.dialogObj = {};
- this.open = true;
- this.title = "添加商品spu";
+ this.$router.push({ name: 'SpuAdd'})
},
/** 修改按钮操作 */
handleUpdate(row) {
- this.dialogObj.id = row.id;
- this.open = true;
- this.title = "修改商品spu";
- },
- closeDialog() {
- this.dialogObj = {};
- this.open = false;
- this.getList()
+ this.$router.push({ name: 'SpuEdit', params: { spuId: row.id }})
},
/** 删除按钮操作 */
handleDelete(row) {
@@ -462,20 +425,6 @@ export default {
margin-left: 10px;
}
- .button-new-tag {
- margin-left: 10px;
- height: 32px;
- line-height: 30px;
- padding-top: 0;
- padding-bottom: 0;
- }
-
- .input-new-tag {
- width: 90px;
- margin-left: 10px;
- vertical-align: bottom;
- }
-
.product-info {
display: flex;
diff --git a/yudao-ui-admin/src/views/mall/product/spu/save.vue b/yudao-ui-admin/src/views/mall/product/spu/save.vue
index 522a6947d..72cd833a3 100644
--- a/yudao-ui-admin/src/views/mall/product/spu/save.vue
+++ b/yudao-ui-admin/src/views/mall/product/spu/save.vue
@@ -217,9 +217,6 @@ export default {
ImageUpload,
VideoUpload
},
- props: {
- obj: Object
- },
data() {
return {
activeSwitch: false,
@@ -281,8 +278,9 @@ export default {
this.getListBrand();
this.getListCategory();
this.getPropertyPageList();
- if (this.obj.id != null) {
- this.updateType(this.obj.id)
+ const spuId = this.$route.params && this.$route.params.spuId;
+ if (spuId != null) {
+ this.updateType(spuId)
}
},
methods: {
@@ -353,8 +351,18 @@ export default {
this.brandList = response.data;
});
},
+ // 取消按钮
cancel() {
- this.$emit("closeDialog");
+ var currentView = this.$store.state.tagsView.visitedViews[0]
+ for (currentView of this.$store.state.tagsView.visitedViews) {
+ if (currentView.path === this.$route.path) {
+ break
+ }
+ }
+ this.$store.dispatch('tagsView/delView', currentView)
+ .then(() => {
+ this.$router.push("/product/spu")
+ })
},
submit() {
this.$refs[this.activeName].validate((valid) => {
@@ -410,12 +418,16 @@ export default {
if (form.id == null) {
createSpu(form).then((response) => {
this.$modal.msgSuccess("新增成功");
- this.$emit("closeDialog");
+ })
+ .then(()=>{
+ this.cancel();
})
} else {
updateSpu(form).then((response) => {
this.$modal.msgSuccess("修改成功");
- this.$emit("closeDialog");
+ })
+ .then(()=>{
+ this.cancel();
})
}
});
@@ -484,9 +496,8 @@ export default {