fix: 商城购买前检查库存,购买后刷新列表

This commit is contained in:
zpc 2026-02-12 01:17:35 +08:00
parent 9318915e09
commit bbfa96489b

View File

@ -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();
}
},