增加支付密码组件

This commit is contained in:
wangxiaowei 2024-08-28 22:39:30 +08:00
parent 43c9ae5b33
commit 494f30e370

@ -0,0 +1,63 @@
<template>
<view>
<u-keyboard ref="uKeyboard" mode="number" :dot-enabled="false" :show-tips="false" :safe-area-inset-bottom="true" v-model="show" @change="changeVal" @backspace="backspace">
<view v-if="info">向xxx转账</view>
<view class="text-center p-20">
<price-format weight="bold" :first-size="50" :second-size="32" color="#000" :price="100"></price-format>
</view>
<view>
<u-message-input @change="change" @finish="finish" :focus="true" :maxlength="6" :dot-fill="true" v-model="value" :disabled-keyboard="true"></u-message-input>
</view>
</u-keyboard>
</view>
</template>
<script>
export default {
name: "pay-keyboard",
props: {
info: {
type: String,
default: ''
},
money: {
type: [String, Number],
default: ""
},
show: {
type: Boolean,
default: false
}
},
data() {
return {
showKeyboard: false,
value: ''
};
},
methods: {
changeVal(val) {
if (this.value.length < 6) {
this.value += val;
if (this.value.length == 6) {
if (this.value == "123456") {
this.topaySuccess();
} else {
uni.showToast({
title: '密码错误请重新输入',
icon: 'none'
});
this.value = ''
}
}
}
},
backspace() {
if (this.value.length) this.value = this.value.substr(0, this.value.length - 1);
}
}
}
</script>
<style>
</style>