From 7e145ee5b07c20506afbfa1b8c9f976704a67e17 Mon Sep 17 00:00:00 2001 From: weiwei Date: Tue, 15 Apr 2025 15:35:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E6=9E=B6loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/hard/hard-door-manager/index.vue | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/views/hard/hard-door-manager/index.vue b/src/views/hard/hard-door-manager/index.vue index b2b6f20..8fceb77 100644 --- a/src/views/hard/hard-door-manager/index.vue +++ b/src/views/hard/hard-door-manager/index.vue @@ -340,13 +340,20 @@ const deleteGoods = async (v: any) => { if (!v.spuId) return useMessage().error("商品id不存在") ElMessageBox.confirm("确定下架吗?", "商品下架", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }).then( async () => { - loading.value = true - const res = await unPutaway({ id: v.id, hardSpuId: v.spuId }).finally(() => (loading.value = false)) - if (res.code == 0) { - useMessage().success("下架成功") - return getCabinet(state.curActivedTabIndex) + try { + loading.value = true + const res = await unPutaway({ id: v.id, hardSpuId: v.spuId }) + if (res.code == 0) { + useMessage().success("下架成功") + await getCabinet(state.curActivedTabIndex) + } else { + useMessage().error(res.msg || "下架失败") + } + } catch (error: any) { + useMessage().error(error.msg) + } finally { + loading.value = false } - useMessage().error(res.msg || "下架失败") }, ) }