diff --git a/seller/src/views/goods/goods-seller/goods.vue b/seller/src/views/goods/goods-seller/goods.vue
index 9512d53c..434886c3 100644
--- a/seller/src/views/goods/goods-seller/goods.vue
+++ b/seller/src/views/goods/goods-seller/goods.vue
@@ -78,10 +78,10 @@
-
-
-
-
+
+
+
+
-
-
-
+
@@ -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"
- },
- 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.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);
- },
- },
- },
- "下架"
- ),
- ]);
- }
+ let vm = this;
+ return h("InputNumber", {
+ props: {
+ value: params.row.quantity,
+ },
+ on: {
+ "on-change": (event) => {
+ vm.stockList[params.index].quantity = event;
+ },
+ },
+ });
},
},
],
@@ -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) {
diff --git a/seller/src/views/goods/goods-seller/goodsOperation.vue b/seller/src/views/goods/goods-seller/goodsOperation.vue
index 77c41ece..f74aca11 100644
--- a/seller/src/views/goods/goods-seller/goodsOperation.vue
+++ b/seller/src/views/goods/goods-seller/goodsOperation.vue
@@ -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
diff --git a/seller/src/views/goods/goods-seller/goodsOperationSec.vue b/seller/src/views/goods/goods-seller/goodsOperationSec.vue
index 80dbe3ba..15207504 100644
--- a/seller/src/views/goods/goods-seller/goodsOperationSec.vue
+++ b/seller/src/views/goods/goods-seller/goodsOperationSec.vue
@@ -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) {