This commit is contained in:
zpc 2026-03-01 14:24:05 +08:00
parent 3fc5449883
commit 6d7d4b099c
2 changed files with 17 additions and 1 deletions

View File

@ -246,6 +246,14 @@ export default {
}, 300); }, 300);
return; return;
} }
//
const remainStock = (this.goodsInfo.stock || 0) - (this.goodsInfo.sale_stock || 0);
if (remainStock <= 0) {
this.$c.msg('库存不足,兑换失败');
return;
}
// //
if (!this.orderData) { if (!this.orderData) {
this.loadDetail().then(() => { this.loadDetail().then(() => {
@ -301,6 +309,14 @@ export default {
this.$c.msg(this.$config.getAppSetting('currency2_name') + '不足'); this.$c.msg(this.$config.getAppSetting('currency2_name') + '不足');
return; return;
} }
//
const remainStock = (this.goodsInfo.stock || 0) - (this.goodsInfo.sale_stock || 0);
if (remainStock <= 0) {
this.$c.msg('库存不足,兑换失败');
return;
}
const res = await createMallOrder({ goods_id: this.goodsId, prize_num: 1 }); const res = await createMallOrder({ goods_id: this.goodsId, prize_num: 1 });
if (res.status == 1) { if (res.status == 1) {
this.$refs.orderPop.close(); this.$refs.orderPop.close();

View File

@ -2415,7 +2415,7 @@ public class OrderService : IOrderService
if (prizeItem == null) if (prizeItem == null)
{ {
throw new InvalidOperationException("暂无奖品信息"); throw new InvalidOperationException("库存不足,兑换失败");
} }
// 12. 扣减奖品库存 // 12. 扣减奖品库存