94 lines
2.0 KiB
Vue
94 lines
2.0 KiB
Vue
<template>
|
|
<view>
|
|
<u-keyboard ref="uKeyboard" mode="number" :dot-enabled="false" :show-tips="false" :safe-area-inset-bottom="true" :cancel-btn="false" :confirm-btn="false" v-model="isShow" @change="changeVal" @backspace="backspace" @input="close">
|
|
<view v-if="info" class="text-center p-t-20">{{info}}</view>
|
|
<view class="text-center p-20">
|
|
<price-format weight="bold" :first-size="50" :second-size="32" color="#000" :price="money"></price-format>
|
|
</view>
|
|
<view>
|
|
<u-message-input @change="change" @finish="finish" :focus="true" :maxlength="6" :dot-fill="true" v-model="pwd" :disabled-keyboard="true"></u-message-input>
|
|
</view>
|
|
</u-keyboard>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
mapGetters
|
|
} from 'vuex'
|
|
import {
|
|
getUser,
|
|
checkPayPassword
|
|
} from "@/api/user";
|
|
|
|
export default {
|
|
name: "pay-keyboard",
|
|
props: {
|
|
info: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
money: {
|
|
type: [String, Number],
|
|
default: ""
|
|
},
|
|
showPay: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
showKeyboard: false,
|
|
pwd: ''
|
|
};
|
|
},
|
|
methods: {
|
|
close() {
|
|
this.$emit('closeKeyboard')
|
|
},
|
|
changeVal(val) {
|
|
if (this.pwd.length < 6) {
|
|
this.pwd += val;
|
|
if (this.pwd.length == 6) {
|
|
checkPayPassword({
|
|
pay_password: this.pwd
|
|
}).then(res => {
|
|
if (res.code == 1) {
|
|
this.$emit('paySuccess', true)
|
|
}
|
|
|
|
this.pwd = ''
|
|
})
|
|
}
|
|
}
|
|
},
|
|
backspace() {
|
|
if (this.pwd.length) this.pwd = this.pwd.substr(0, this.pwd.length - 1);
|
|
}
|
|
},
|
|
computed: {
|
|
...mapGetters(["userInfo"]),
|
|
isShow: {
|
|
get() {
|
|
if (this.showPay == true && this.userInfo.hasPayPassword == 0) {
|
|
this.$toast({
|
|
title: '请先设置支付密码'
|
|
}, {
|
|
tab: 5,
|
|
url: '/bundle/pages/user_profile/user_profile',
|
|
endtime: 800
|
|
});
|
|
} else {
|
|
return this.showPay
|
|
}
|
|
},
|
|
|
|
set(val) {
|
|
return val
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|