添加按钮点击限制

This commit is contained in:
wangxiaowei 2024-09-07 11:07:57 +08:00
parent 4f1d7507ed
commit d4682d9bae

@ -21,7 +21,7 @@
</price-format> </price-format>
</view> </view>
</view> </view>
<button class="btn br60 white" size="md" hover-class="none" @tap="handlePrepay"> <button class="btn br60 white" size="md" hover-class="none" @tap="$u.throttle(handlePrepay, 1000)">
支付 支付
</button> </button>
</view> </view>
@ -78,6 +78,8 @@
<button class="br60 btn" type="primary" size="md" @tap="onShowFailPopup">好的</button> <button class="br60 btn" type="primary" size="md" @tap="onShowFailPopup">好的</button>
</view> </view>
</u-popup> </u-popup>
<pay-keyboard :showPay="showPay" :money="payMoney" :info="payInfo" @paySuccess="onBalancePay" @closeKeyboard="closeKeyboard"></pay-keyboard>
</view> </view>
</template> </template>
@ -108,7 +110,10 @@
lstore_id: 0, lstore_id: 0,
info: [], info: [],
goods_id: 0, goods_id: 0,
goods: [] goods: [],
showPay: false,
payInfo: '',
payMoney: ''
}; };
}, },
@ -225,22 +230,18 @@
// 余额支付 // 余额支付
if (this.payway == 3) { if (this.payway == 3) {
localBalance({ this.showPay = true
money: this.money, this.payInfo = '向商家支付 ¥' + this.money
lid: this.lstore_id, this.payMoney = this.money
user_id: this.user_id
}).then((result) => {
let status = 'fail'
if (result.code == 1) {
status = 'success'
}
this.handPayResult(status)
})
} }
// 微信支付 // 微信支付
if (this.payway == 1) { if (this.payway == 1) {
uni.showLoading({
title: '支付中',
mask: true
})
localShopPayWeixin({ localShopPayWeixin({
money: this.money, money: this.money,
lid: this.lstore_id, lid: this.lstore_id,
@ -257,8 +258,9 @@
this.handleWechatPay(pay); this.handleWechatPay(pay);
} }
}) })
uni.hideLoading()
} }
}, },
// 微信支付 // 微信支付
@ -284,6 +286,8 @@
this.cancelPopup = true this.cancelPopup = true
} }
this.showPay = false
}, },
onShowSuccessPopup() { onShowSuccessPopup() {
@ -297,7 +301,28 @@
onShowFailPopup() { onShowFailPopup() {
this.cancelPopup = !this.cancelPopup this.cancelPopup = !this.cancelPopup
} },
onBalancePay() {
uni.showLoading({
title: '支付中',
mask: true
})
localBalance({
money: this.money,
lid: this.lstore_id,
user_id: this.user_id
}).then((result) => {
let status = 'fail'
if (result.code == 1) {
status = 'success'
}
this.handPayResult(status)
})
uni.hideLoading()
},
closeKeyboard() {
this.showPay = false
},
} }
} }
</script> </script>