处理按钮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 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>
<u-toast ref="uToast"></u-toast>
</view>
@ -49,6 +49,7 @@
coinType:['BNB','ETH','BTC'],
balabces:{},
userInfo:{},
loading:false,
}
},
async onLoad(options) {
@ -136,11 +137,13 @@
return obj
},
async buy() {
this.loading = true
if(!Number(this.userInfo.miner_G) >= 1){
uni.showToast({
title: '購買1G以上算力才可交易',
icon:"none"
})
this.loading = false
return
}
let cobj = this.checkTypeAndValue(this.detail.investCoin,this.value)
@ -149,6 +152,7 @@
title: cobj.message,
icon:"none"
})
this.loading = false
return
}
uni.showLoading({ mask: true })
@ -181,6 +185,7 @@
}).finally(e=>{
uni.$emit('updateView',{})
uni.hideLoading()
this.loading = false
uni.navigateBack()
})
@ -196,6 +201,7 @@
complete:()=>{
uni.$emit('updateView',{})
uni.hideLoading()
this.loading = false
uni.navigateBack()
}
});