PayPasswordEditCheck.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view>
  3. <view class="back-icon" @click="backPage"><u-icon name="close" size="32"></u-icon></view>
  4. <view>
  5. <view class="top-view">
  6. <view class="title">设置支付密码</view>
  7. <view class="desc">请输入支付密码,以验证身份</view>
  8. </view>
  9. <view class="u-flex u-row-center">
  10. <u-message-input :mask="false" mode="box" :maxlength="6" :dot-fill="true" v-model="password" :disabled-keyboard="true" @finish="finish"></u-message-input>
  11. </view>
  12. </view>
  13. <u-keyboard
  14. default=""
  15. ref="uKeyboard"
  16. mode="number"
  17. :mask="false"
  18. :mask-close-able="false"
  19. :dot-enabled="false"
  20. v-model="show"
  21. :safe-area-inset-bottom="true"
  22. :tooltip="false"
  23. @change="onChange"
  24. @backspace="onBackspace"
  25. ></u-keyboard>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {
  32. show: true,
  33. password: ''
  34. };
  35. },
  36. computed: {
  37. userInfo() {
  38. return this.$store.state.userStatus;
  39. }
  40. },
  41. onLoad() {},
  42. methods: {
  43. backPage() {
  44. uni.navigateBack();
  45. },
  46. //按键被点击(不包含退格键被点击)
  47. onChange(val) {
  48. if (this.password.length < 6) {
  49. this.password += val;
  50. }
  51. if (this.password.length >= 6) {
  52. this.checkPayPassword();
  53. }
  54. },
  55. //键盘退格键被点击
  56. onBackspace(e) {
  57. if (this.password.length > 0) {
  58. this.password = this.password.substring(0, this.password.length - 1);
  59. }
  60. },
  61. checkPayPassword() {
  62. this.$u.api
  63. .checkPayPassword({
  64. id: this.userInfo.id,
  65. payPassword: this.password
  66. })
  67. .then(res => {
  68. this.goPage('/pagesT/money/PayPassword', 'redirectTo');
  69. })
  70. .catch(err => {
  71. this.password = '';
  72. });
  73. },
  74. showPop(flag = true) {
  75. this.password = '';
  76. this.show = flag;
  77. },
  78. finish() {
  79. console.log(11111);
  80. }
  81. }
  82. };
  83. </script>
  84. <style>
  85. page {
  86. background-color: #ffffff;
  87. }
  88. </style>
  89. <style lang="scss" scoped>
  90. .top-view {
  91. text-align: center;
  92. padding-top: 300rpx;
  93. .title {
  94. font-size: 32rpx;
  95. font-weight: bold;
  96. padding-bottom: 30rpx;
  97. }
  98. .desc {
  99. padding-bottom: 100rpx;
  100. }
  101. }
  102. .back-icon {
  103. position: fixed;
  104. top: 100rpx;
  105. left: 40rpx;
  106. z-index: 999999;
  107. }
  108. </style>