From bbfa96489b4697566daed1f4d15958ecaf3e9413 Mon Sep 17 00:00:00 2001 From: zpc Date: Thu, 12 Feb 2026 01:17:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=95=86=E5=9F=8E=E8=B4=AD=E4=B9=B0?= =?UTF-8?q?=E5=89=8D=E6=A3=80=E6=9F=A5=E5=BA=93=E5=AD=98=EF=BC=8C=E8=B4=AD?= =?UTF-8?q?=E4=B9=B0=E5=90=8E=E5=88=B7=E6=96=B0=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- honey_box/pages/mall/index.vue | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/honey_box/pages/mall/index.vue b/honey_box/pages/mall/index.vue index 358b9e98..2eaa697b 100644 --- a/honey_box/pages/mall/index.vue +++ b/honey_box/pages/mall/index.vue @@ -213,6 +213,14 @@ export default { async order_money(data) { console.log(234); + // 检查库存 + if (data.sale_stock <= 0) { + uni.showToast({ + title: '库存不足', + icon: 'none', + }); + return; + } this.goodsId = data.id; // API: mall_ordermoney const res = await calcMallOrderMoney({ @@ -338,23 +346,17 @@ export default { if (type == 1) { this.close('pop'); - if (res.data.status == 1) { - const status = await this.$platform.pay({ - data: res.data.res - }, this); - if (status == 'success') { + this.$c.toast({ + title: res.msg || '购买成功', + duration: 500, + success: () => { this.getData(); } - } else { - this.$c.toast({ - title: res.msg, - duration: 500, - success: () => { - this.getData(); - } - }); - } + }); } + } else { + // 购买失败也刷新数据 + this.getData(); } },