From 75dba24bed54a85f0ce625ecf8cd1ab46219f645 Mon Sep 17 00:00:00 2001 From: fanfan Date: Thu, 13 Jun 2024 15:33:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=92=E7=B1=BB=20=E6=8E=92=E8=A1=8C=20?= =?UTF-8?q?=E6=96=B0=E5=93=81=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/goods/index.js | 14 ++++++++++- src/views/goods/Index.vue | 52 ++++++++++++++++++++++++++++++--------- 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/src/api/goods/index.js b/src/api/goods/index.js index 2e26104..d01c6b7 100644 --- a/src/api/goods/index.js +++ b/src/api/goods/index.js @@ -15,7 +15,19 @@ const api = { setStorePrice: 'store/setStorePrice', getStorePriceInfo: 'store/getStorePriceInfo', pool: '/goods/pool', - collector:'/goods/collector' + collector:'/goods/collector', + category: '/goods/category', +} +/** + * 归类 + * @param {*} data + */ +export function category (data) { + return axios({ + url: api.category, + method: 'post', + data: data + }) } /** * 大牌 diff --git a/src/views/goods/Index.vue b/src/views/goods/Index.vue index ded10d9..d1818fa 100644 --- a/src/views/goods/Index.vue +++ b/src/views/goods/Index.vue @@ -59,13 +59,18 @@ - - + + {{ item.name }} - + + + + +
@@ -83,11 +88,12 @@ 批量导入 导出 批量修改 - -
+ 设置排行榜 +
上架 下架 @@ -285,7 +291,6 @@ export default { merchant_id: '', is_jd_remove: '' }, - paihang: '', setupIndex: 0, setupValue: 1, // 正在加载 @@ -326,7 +331,9 @@ export default { ], checkList: [], merchantList: [], - batchVisible: false + batchVisible: false, + categoryVisible: false, + categoryIds: [], } }, created() { @@ -361,8 +368,31 @@ export default { handleModify() { this.$router.push('/goods/modify') }, + // 归类 + onChangeCategory(list) { + this.categoryIds = [] + list.forEach((item) => { + this.categoryIds.push(item.value) + }) + }, + handleUpdateClassify(goodsIds, categoryIds) { + if (categoryIds.length == 0) { + this.$message.warn('请至少选择1个商品分类', 1.5) + return + } + this.isLoading = true + GoodsApi.category({ goodsIds, categoryIds }) + .then((result) => { + // 显示成功 + this.categoryVisible = false + this.$message.success(result.message, 1.5) + this.handleRefresh() + }) + .finally((result) => { + this.isLoading = false + }) + }, handleSetup(type) { - this.paihang = ''; this.setupValue = 1; this.setupIndex = type this.batchVisible = true @@ -381,7 +411,7 @@ export default { url = GoodsApi.setInstore({ goodsIds, is_in_store: val }) } if (type == 4) { - url = GoodsApi.setRank({ goodsIds, paihang: val }) + url = GoodsApi.setRank({ goodsIds, is_paihang: val }) } url.then((result) => { this.batchVisible = false @@ -389,7 +419,7 @@ export default { this.handleRefresh() }) .finally((result) => { - this.$message.warning(result.message, 1.5) + this.$message.warning(result.message, 1.5) this.isLoading = false }) },