fix: 商城购买前检查库存,购买后刷新列表
This commit is contained in:
parent
9318915e09
commit
bbfa96489b
|
|
@ -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.getData();
|
||||
}
|
||||
} else {
|
||||
this.$c.toast({
|
||||
title: res.msg,
|
||||
title: res.msg || '购买成功',
|
||||
duration: 500,
|
||||
success: () => {
|
||||
this.getData();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 购买失败也刷新数据
|
||||
this.getData();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user