mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-09-22 21:02:04 +08:00
feat(商品管理): 添加商品复制功能并优化批量操作
- 在商品操作页面添加复制商品功能,通过copyId参数区分复制操作 - 复制商品时自动清除原商品ID确保提交为新商品 - 优化批量操作按钮功能,包括上架、下架、删除和设置物流模板 - 移除未使用的批量规格更新功能 - 调整商品列表操作按钮布局,将复制功能加入操作列
This commit is contained in:
@@ -1053,6 +1053,11 @@ export default {
|
||||
this.baseInfoForm = { ...this.baseInfoForm, ...response.result };
|
||||
this.baseInfoForm.release = 1; //即使是被放入仓库,修改的时候也会显示会立即发布
|
||||
this.categoryId = response.result.categoryPath.split(",")[2];
|
||||
|
||||
// 如果是复制商品,需要清除ID,确保提交时作为新商品
|
||||
if (this.$route.query.copyId) {
|
||||
this.baseInfoForm.id = "";
|
||||
}
|
||||
|
||||
if (
|
||||
response.result.goodsGalleryList &&
|
||||
@@ -1837,7 +1842,11 @@ export default {
|
||||
}
|
||||
this.baseInfoForm.wholesaleList = this.wholesaleData;
|
||||
}
|
||||
this.baseInfoForm.goodsId = this.goodsId;
|
||||
|
||||
// 判断是否是复制商品
|
||||
if (!this.$route.query.copyId) {
|
||||
this.baseInfoForm.goodsId = this.goodsId;
|
||||
}
|
||||
let submit = JSON.parse(JSON.stringify(this.baseInfoForm));
|
||||
if (
|
||||
submit.goodsGalleryFiles &&
|
||||
@@ -1918,7 +1927,8 @@ export default {
|
||||
submit.recommend
|
||||
? (submit.recommend = true)
|
||||
: (submit.recommend = false);
|
||||
if (this.goodsId) {
|
||||
// 判断是否是复制商品
|
||||
if (this.goodsId && !this.$route.query.copyId) {
|
||||
API_GOODS.editGoods(this.goodsId, submit).then((res) => {
|
||||
if (res.success) {
|
||||
this.submitLoading = false;
|
||||
@@ -1926,6 +1936,9 @@ export default {
|
||||
} else {
|
||||
this.submitLoading = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
this.submitLoading = false;
|
||||
this.$Message.error("保存失败,请重试");
|
||||
});
|
||||
} else {
|
||||
API_GOODS.createGoods(submit).then((res) => {
|
||||
@@ -2018,6 +2031,9 @@ export default {
|
||||
if (this.$route.query.id || this.$route.query.draftId) {
|
||||
// 编辑商品、模板
|
||||
this.GET_GoodData(this.$route.query.id, this.$route.query.draftId);
|
||||
} else if (this.$route.query.copyId) {
|
||||
// 复制商品
|
||||
this.GET_GoodData(this.$route.query.copyId);
|
||||
} else {
|
||||
// 新增商品、模板
|
||||
if (this.firstData.tempId) {
|
||||
|
||||
Reference in New Issue
Block a user