From d8cc0a5245c59336437b7794f7fe20e3664c2260 Mon Sep 17 00:00:00 2001 From: fanfan Date: Mon, 8 Jul 2024 13:58:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E9=83=A8=E4=B8=8A=E4=B8=8B=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/goods/index.js | 24 ++++++++++++++++++++++++ src/views/goods/Index.vue | 33 ++++++++++++++++++++++++++++----- 2 files changed, 52 insertions(+), 5 deletions(-) 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 {