mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2025-12-17 00:15:53 +08:00
feat(商品管理): 添加商品复制功能并优化批量操作
- 在商品操作页面添加复制商品功能,通过copyId参数区分复制操作 - 复制商品时自动清除原商品ID确保提交为新商品 - 优化批量操作按钮功能,包括上架、下架、删除和设置物流模板 - 移除未使用的批量规格更新功能 - 调整商品列表操作按钮布局,将复制功能加入操作列
This commit is contained in:
@@ -78,10 +78,10 @@
|
||||
<Row class="operation padding-row">
|
||||
<Button @click="addGoods" type="info">添加商品</Button>
|
||||
<Button @click="openImportGoods" >导入商品</Button>
|
||||
<Button @click="openImportGoods" >批量上架</Button>
|
||||
<Button @click="openImportGoods" >批量下架</Button>
|
||||
<Button @click="openImportGoods" >批量删除</Button>
|
||||
<Button @click="openImportGoods" >批量设置物流模板</Button>
|
||||
<Button @click="uppers" >批量上架</Button>
|
||||
<Button @click="lowers" >批量下架</Button>
|
||||
<Button @click="deleteAll" >批量删除</Button>
|
||||
<Button @click="batchShipTemplate" >批量设置物流模板</Button>
|
||||
</Row>
|
||||
|
||||
<Table
|
||||
@@ -143,9 +143,7 @@
|
||||
border
|
||||
></Table>
|
||||
</TabPane>
|
||||
<TabPane label="批量规格更新" name="stockAll">
|
||||
<Input type="number" v-model="stockAllUpdate" placeholder="统一规格修改" />
|
||||
</TabPane>
|
||||
|
||||
</Tabs>
|
||||
|
||||
<div slot="footer">
|
||||
@@ -226,6 +224,8 @@ export default {
|
||||
logisticsTemplate: [], // 物流列表
|
||||
updateStockModalVisible: false, // 更新库存模态框显隐
|
||||
stockAllUpdate: undefined, // 更新库存数量
|
||||
selectList: [], // 选中的商品列表
|
||||
selectCount: 0, // 选中的商品数量
|
||||
searchForm: {
|
||||
// 搜索框初始化对象
|
||||
pageNumber: 1, // 当前页数
|
||||
@@ -381,6 +381,28 @@ export default {
|
||||
},
|
||||
"上架"
|
||||
),
|
||||
h("span", {
|
||||
style: {
|
||||
margin: "0 8px",
|
||||
color: "#dcdee2"
|
||||
}
|
||||
}, "|"),
|
||||
h(
|
||||
"a",
|
||||
{
|
||||
style: {
|
||||
color: "#2d8cf0",
|
||||
cursor: "pointer",
|
||||
textDecoration: "none"
|
||||
},
|
||||
on: {
|
||||
click: () => {
|
||||
this.copyGoods(params.row);
|
||||
},
|
||||
},
|
||||
},
|
||||
"复制"
|
||||
),
|
||||
]);
|
||||
} else {
|
||||
return h("div", [
|
||||
@@ -444,6 +466,28 @@ export default {
|
||||
},
|
||||
"下架"
|
||||
),
|
||||
h("span", {
|
||||
style: {
|
||||
margin: "0 8px",
|
||||
color: "#dcdee2"
|
||||
}
|
||||
}, "|"),
|
||||
h(
|
||||
"a",
|
||||
{
|
||||
style: {
|
||||
color: "#2d8cf0",
|
||||
cursor: "pointer",
|
||||
textDecoration: "none"
|
||||
},
|
||||
on: {
|
||||
click: () => {
|
||||
this.copyGoods(params.row);
|
||||
},
|
||||
},
|
||||
},
|
||||
"复制"
|
||||
),
|
||||
]);
|
||||
}
|
||||
},
|
||||
@@ -458,132 +502,23 @@ export default {
|
||||
return h("div", {}, params.row.simpleSpecs);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "审核状态",
|
||||
key: "authFlag",
|
||||
width: 130,
|
||||
render: (h, params) => {
|
||||
if (params.row.authFlag == "TOBEAUDITED") {
|
||||
return h("Tag", { props: { color: "blue" } }, "待审核");
|
||||
} else if (params.row.authFlag == "PASS") {
|
||||
return h("Tag", { props: { color: "green" } }, "通过");
|
||||
} else if (params.row.authFlag == "REFUSE") {
|
||||
return h("Tag", { props: { color: "red" } }, "审核拒绝");
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
key: "action",
|
||||
align: "center",
|
||||
fixed: "right",
|
||||
width: 200,
|
||||
render: (h, params) => {
|
||||
if (params.row.marketEnable == "DOWN") {
|
||||
return h("div", [
|
||||
h(
|
||||
"a",
|
||||
{
|
||||
style: {
|
||||
color: "#2d8cf0",
|
||||
cursor: "pointer",
|
||||
textDecoration: "none"
|
||||
let vm = this;
|
||||
return h("InputNumber", {
|
||||
props: {
|
||||
value: params.row.quantity,
|
||||
},
|
||||
on: {
|
||||
click: () => {
|
||||
this.editGoods(params.row);
|
||||
"on-change": (event) => {
|
||||
vm.stockList[params.index].quantity = event;
|
||||
},
|
||||
},
|
||||
},
|
||||
"编辑"
|
||||
),
|
||||
h("span", {
|
||||
style: {
|
||||
margin: "0 8px",
|
||||
color: "#dcdee2"
|
||||
}
|
||||
}, "|"),
|
||||
h(
|
||||
"a",
|
||||
{
|
||||
style: {
|
||||
color: "#2d8cf0",
|
||||
cursor: "pointer",
|
||||
textDecoration: "none"
|
||||
},
|
||||
on: {
|
||||
click: () => {
|
||||
this.upper(params.row);
|
||||
},
|
||||
},
|
||||
},
|
||||
"上架"
|
||||
),
|
||||
]);
|
||||
} else {
|
||||
return h("div", [
|
||||
h(
|
||||
"a",
|
||||
{
|
||||
style: {
|
||||
color: "#2d8cf0",
|
||||
cursor: "pointer",
|
||||
textDecoration: "none"
|
||||
},
|
||||
on: {
|
||||
click: () => {
|
||||
this.editGoods(params.row);
|
||||
},
|
||||
},
|
||||
},
|
||||
"编辑"
|
||||
),
|
||||
h("span", {
|
||||
style: {
|
||||
margin: "0 8px",
|
||||
color: "#dcdee2"
|
||||
}
|
||||
}, "|"),
|
||||
h(
|
||||
"a",
|
||||
{
|
||||
style: {
|
||||
color: "#2d8cf0",
|
||||
cursor: "pointer",
|
||||
textDecoration: "none"
|
||||
},
|
||||
on: {
|
||||
click: () => {
|
||||
this.getStockDetail(params.row.id);
|
||||
},
|
||||
},
|
||||
},
|
||||
"库存"
|
||||
),
|
||||
h("span", {
|
||||
style: {
|
||||
margin: "0 8px",
|
||||
color: "#dcdee2"
|
||||
}
|
||||
}, "|"),
|
||||
h(
|
||||
"a",
|
||||
{
|
||||
style: {
|
||||
color: "#2d8cf0",
|
||||
cursor: "pointer",
|
||||
textDecoration: "none"
|
||||
},
|
||||
on: {
|
||||
click: () => {
|
||||
this.lower(params.row);
|
||||
},
|
||||
},
|
||||
},
|
||||
"下架"
|
||||
),
|
||||
]);
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -619,6 +554,10 @@ export default {
|
||||
editGoods(v) {
|
||||
this.$router.push({ name: "goods-operation-edit", query: { id: v.id } });
|
||||
},
|
||||
// 复制商品
|
||||
copyGoods(v) {
|
||||
this.$router.push({ name: "goods-operation", query: { copyId: v.id } });
|
||||
},
|
||||
|
||||
//批量操作
|
||||
handleDropdown(v) {
|
||||
@@ -852,7 +791,7 @@ export default {
|
||||
let params = {
|
||||
goodsId: ids.toString(),
|
||||
};
|
||||
// 批量上架
|
||||
// 批量下架
|
||||
lowGoods(params).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
|
||||
@@ -44,8 +44,8 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 编辑商品、模板
|
||||
if (this.$route.query.id || this.$route.query.draftId) {
|
||||
// 编辑商品、模板、复制商品
|
||||
if (this.$route.query.id || this.$route.query.draftId || this.$route.query.copyId) {
|
||||
this.activestep = 1;
|
||||
} else {
|
||||
this.activestep = 0
|
||||
|
||||
@@ -1054,6 +1054,11 @@ export default {
|
||||
this.baseInfoForm.release = 1; //即使是被放入仓库,修改的时候也会显示会立即发布
|
||||
this.categoryId = response.result.categoryPath.split(",")[2];
|
||||
|
||||
// 如果是复制商品,需要清除ID,确保提交时作为新商品
|
||||
if (this.$route.query.copyId) {
|
||||
this.baseInfoForm.id = "";
|
||||
}
|
||||
|
||||
if (
|
||||
response.result.goodsGalleryList &&
|
||||
response.result.goodsGalleryList.length > 0
|
||||
@@ -1837,7 +1842,11 @@ export default {
|
||||
}
|
||||
this.baseInfoForm.wholesaleList = this.wholesaleData;
|
||||
}
|
||||
|
||||
// 判断是否是复制商品
|
||||
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