diff --git a/honey_box/pages/mall/detail.vue b/honey_box/pages/mall/detail.vue index fc8079f8..e867e883 100644 --- a/honey_box/pages/mall/detail.vue +++ b/honey_box/pages/mall/detail.vue @@ -337,6 +337,13 @@ export default { console.log(`[商城订单] payByWechat 响应: status=${res.status} msg=${res.msg} data.status=${res.data?.status}`); if (res.status == 1) { this.$refs.orderPop.close(); + // 立即更新本地库存显示 + if (this.goodsInfo.goodslist_surplus_stock != null) { + this.goodsInfo.goodslist_surplus_stock = Math.max(0, this.goodsInfo.goodslist_surplus_stock - 1); + } + if (this.goodsInfo.sale_stock != null) { + this.goodsInfo.sale_stock = (this.goodsInfo.sale_stock || 0) + 1; + } if (res.data.status == 1) { const status = await this.$platform.pay({ data: res.data.res }, this); console.log(`[商城订单] 微信支付结果: ${status}`); @@ -373,22 +380,23 @@ export default { console.log(`[商城订单] createMallOrder 响应: status=${res.status} msg=${res.msg} data.status=${res.data?.status}`); if (res.status == 1) { this.$refs.orderPop.close(); + // 立即更新本地库存显示 + if (this.goodsInfo.goodslist_surplus_stock != null) { + this.goodsInfo.goodslist_surplus_stock = Math.max(0, this.goodsInfo.goodslist_surplus_stock - 1); + } + if (this.goodsInfo.sale_stock != null) { + this.goodsInfo.sale_stock = (this.goodsInfo.sale_stock || 0) + 1; + } if (res.data.status == 1) { const status = await this.$platform.pay({ data: res.data.res }, this); if (status == 'success') { this.$c.msg('兑换成功'); - // 静默刷新,避免出现"加载中"提示 - setTimeout(() => { - this.silentLoadDetail(); - }, 1600); + this.silentLoadDetail(); } } else { // 兑换成功(积分/货币直接扣除,无需微信支付) this.$c.msg('兑换成功'); - // 静默刷新,避免出现"加载中"提示 - setTimeout(() => { - this.silentLoadDetail(); - }, 1600); + this.silentLoadDetail(); } } } diff --git a/honey_box/pages/mall/index.vue b/honey_box/pages/mall/index.vue index d6f5c1c5..f0cad024 100644 --- a/honey_box/pages/mall/index.vue +++ b/honey_box/pages/mall/index.vue @@ -163,6 +163,8 @@ export default { selected: 2 }); } + // 每次显示时刷新列表数据(从详情页返回时更新库存) + this.getData(); this.$platform.getOrderNo(this).then(order_num => { if (order_num != null && order_num != "") { this.$c.msg("购买成功!"); @@ -199,9 +201,7 @@ export default { console.log(`[商城列表] id=${item.id} title=${item.title} stock=${item.stock} sale_stock=${item.sale_stock}`); }); if (isWXPay) { - if (this.datas.length > 0) { - this.datas = this.datas.slice(0, this.datas.length); - } + this.datas = []; for (let index = 0; index < res.data.data.length; index++) { const element = res.data.data[index]; if (element.title.indexOf('京东卡') == -1) {