diff --git a/src/api/goods/index.js b/src/api/goods/index.js index d01c6b7..e8dc8bf 100644 --- a/src/api/goods/index.js +++ b/src/api/goods/index.js @@ -17,6 +17,30 @@ const api = { pool: '/goods/pool', collector:'/goods/collector', category: '/goods/category', + oneShelf:'/goods/oneClickShelf', + oneOffTheShelf:'/goods/oneClickOffTheShelf' +} +/** + * 一键上架 + * @param {*} data + */ +export function oneShelf (data) { + return axios({ + url: api.oneShelf, + method: 'post', + data: data + }) +} +/** + * 一键下架 + * @param {*} data + */ +export function oneOffTheShelf (data) { + return axios({ + url: api.oneOffTheShelf, + method: 'post', + data: data + }) } /** * 归类 diff --git a/src/views/goods/Index.vue b/src/views/goods/Index.vue index e218afe..6d63505 100644 --- a/src/views/goods/Index.vue +++ b/src/views/goods/Index.vue @@ -114,9 +114,11 @@ 批量导入 导出 批量修改 - 归类 + 全部上架 + 全部下架 + 归类 设置大牌 - 设置新品 + 设置新品 设置店内 设置排行榜
@@ -459,6 +461,26 @@ export default { this.isLoading = false }) }, + handleSetupGoods(goodsIds, type) { + // type==1 1一键上架 2一键下架 + this.isLoading = true + let url = '' + if (type == 1) { + url = GoodsApi.oneShelf() + } + if (type == 2) { + url = GoodsApi.oneOffTheShelf() + } + url.then((result) => { + this.isLoading = false + this.$message.success(result.message, 1.5) + this.handleRefresh() + }) + .finally((result) => { + this.$message.warning(result.message, 1.5) + this.isLoading = false + }) + }, handleSetup(type) { this.setupValue = 1; this.paihang = ''; @@ -483,6 +505,7 @@ export default { } url.then((result) => { this.batchVisible = false + this.isLoading = false this.$message.success(result.message, 1.5) this.handleRefresh() }) @@ -678,9 +701,9 @@ export default {