receiveTap: function(e) {
wx.showLoading({
title: '正在抢券',
})
let _this = this,
dataset = e.currentTarget.dataset;
if (!dataset.state) {
return false;
}
App._post_form('user.coupon/receive', {
coupon_id: dataset.couponId
}, function(result) {
wx.hideLoading();
App.showSuccess(result.msg);
});
}
从代码上看有两种可能的情况下不会执行wx.hideLoading()
1 dataset.state == false
2 App._post_form请求异常没有走回掉函数
function(result) {
wx.hideLoading();
App.showSuccess(result.msg);
});
改为
(result)=> {
wx.hideLoading();
App.showSuccess(result.msg);
});
试试