处理按钮bug

This commit is contained in:
zhongshilong 2025-04-24 10:47:48 +08:00
parent 5bad1dc501
commit ab3d6efbb4

View File

@ -25,7 +25,7 @@
</view> </view>
</view> </view>
<view style="margin-top: 32px;" v-if="detail.canPurchase"> <view style="margin-top: 32px;" v-if="detail.canPurchase">
<button type="primary" :disabled="!detail.canPurchase || !isTrue()" @click="buy" class="btn" :class="{'disabled' :!detail.canPurchase || !isTrue()}" > </button> <button type="primary" :disabled="!detail.canPurchase || !isTrue() || loading" @click="buy" class="btn" :class="{'disabled' :!detail.canPurchase || !isTrue() || loading}" >{{loading?'处 理 中':'確 定 交 易'}}</button>
</view> </view>
<u-toast ref="uToast"></u-toast> <u-toast ref="uToast"></u-toast>
</view> </view>
@ -49,6 +49,7 @@
coinType:['BNB','ETH','BTC'], coinType:['BNB','ETH','BTC'],
balabces:{}, balabces:{},
userInfo:{}, userInfo:{},
loading:false,
} }
}, },
async onLoad(options) { async onLoad(options) {
@ -136,11 +137,13 @@
return obj return obj
}, },
async buy() { async buy() {
this.loading = true
if(!Number(this.userInfo.miner_G) >= 1){ if(!Number(this.userInfo.miner_G) >= 1){
uni.showToast({ uni.showToast({
title: '購買1G以上算力才可交易', title: '購買1G以上算力才可交易',
icon:"none" icon:"none"
}) })
this.loading = false
return return
} }
let cobj = this.checkTypeAndValue(this.detail.investCoin,this.value) let cobj = this.checkTypeAndValue(this.detail.investCoin,this.value)
@ -149,6 +152,7 @@
title: cobj.message, title: cobj.message,
icon:"none" icon:"none"
}) })
this.loading = false
return return
} }
uni.showLoading({ mask: true }) uni.showLoading({ mask: true })
@ -181,6 +185,7 @@
}).finally(e=>{ }).finally(e=>{
uni.$emit('updateView',{}) uni.$emit('updateView',{})
uni.hideLoading() uni.hideLoading()
this.loading = false
uni.navigateBack() uni.navigateBack()
}) })
@ -196,6 +201,7 @@
complete:()=>{ complete:()=>{
uni.$emit('updateView',{}) uni.$emit('updateView',{})
uni.hideLoading() uni.hideLoading()
this.loading = false
uni.navigateBack() uni.navigateBack()
} }
}); });