修改下架loading

This commit is contained in:
weiwei committed 2025-04-15 15:35:26 +08:00
1 parent bf5135c6b9
commit 7e145ee5b0
1 file changed
+13 -6
+13 -6
View File
@@ -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 || "下架失败")
},
)
}