限制提现金额只能保留一位小数

This commit is contained in:
wangxiaowei 2024-09-25 17:47:26 +08:00
parent c17417d795
commit ae09f4f969
3 changed files with 20 additions and 4 deletions

@ -78,7 +78,7 @@
<view class="flex withdraw-money p-b-20">
<view class="flex flex-1">
<text class="font-size-46 m-r-10 normal">¥</text>
<u-input v-model="form.money" placeholder="0.00" :custom-style="{
<u-input v-model="form.money" placeholder="0.0" :custom-style="{
'font-size': '66rpx'
}" />
</view>
@ -183,12 +183,18 @@
const data = {
...this.form
}
if (!data.money) {
if (!data.money || data.money == 0) {
this.$toast({
title: '请输入提现金额'
});
return;
}
const regex = /^[1-9]\d*(,\d{3})*(\.\d{1})?$|^0\.\d{1}$/;
if (!regex.test(data.money)) return this.$toast({
title: '提现金额只保留一位小数'
})
this.payMoney = data.money
this.payInfo = '提现 ¥' + data.money + ' 到账户'
this.showPay = true

@ -183,13 +183,18 @@
},
startPay() {
const data = {...this.form}
if (!data.money) {
if (!data.money || data.money == 0) {
this.$toast({
title: '请输入提现金额'
});
return;
}
const regex = /^[1-9]\d*(,\d{3})*(\.\d{1})?$|^0\.\d{1}$/;
if (!regex.test(data.money)) return this.$toast({
title: '提现金额只保留一位小数'
})
this.payMoney = data.money
this.payInfo = '分销佣金提现 ¥' + data.money + ' 到账户'
this.showPay = true

@ -17,7 +17,7 @@
<view class="flex withdraw-money p-b-20">
<view class="flex flex-1">
<text class="font-size-46 m-r-10 normal">¥</text>
<u-input @input="setMoney" v-model="form.withdrawl_money" placeholder="0.00" :custom-style="{'font-size': '66rpx'}" />
<u-input @input="setMoney" v-model="form.withdrawl_money" placeholder="0.0" :custom-style="{'font-size': '66rpx'}" />
</view>
<view class="flex">
<view class="flex-col flex-1 text-right">
@ -200,6 +200,11 @@
return;
}
const regex = /^[1-9]\d*(,\d{3})*(\.\d{1})?$|^0\.\d{1}$/;
if (!regex.test(data.withdrawl_money)) return this.$toast({
title: '提现金额只保留一位小数'
})
this.payMoney = data.withdrawl_money
this.payInfo = '消费返补提现 ¥' + data.withdrawl_money;
this.showPay = true