PayPassword.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view :class="['qn-page-' + theme]">
  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. onLoad() {},
  37. methods: {
  38. backPage() {
  39. uni.navigateBack();
  40. },
  41. //按键被点击(不包含退格键被点击)
  42. onChange(val) {
  43. if (this.password.length < 6) {
  44. this.password += val;
  45. }
  46. if (this.password.length >= 6) {
  47. this.pay();
  48. }
  49. },
  50. //键盘退格键被点击
  51. onBackspace(e) {
  52. if (this.password.length > 0) {
  53. this.password = this.password.substring(0, this.password.length - 1);
  54. }
  55. },
  56. pay() {
  57. this.goPage('/pagesT/money/PayPasswordAgin?password=' + this.password, 'redirectTo');
  58. },
  59. showPop(flag = true) {
  60. this.password = '';
  61. this.show = flag;
  62. },
  63. finish() {
  64. console.log(11111);
  65. }
  66. }
  67. };
  68. </script>
  69. <style>
  70. page {
  71. background-color: #ffffff;
  72. }
  73. </style>
  74. <style lang="scss" scoped>
  75. .top-view {
  76. text-align: center;
  77. padding-top: 300rpx;
  78. .title {
  79. font-size: 32rpx;
  80. font-weight: bold;
  81. padding-bottom: 30rpx;
  82. }
  83. .desc {
  84. padding-bottom: 100rpx;
  85. }
  86. }
  87. .back-icon {
  88. position: fixed;
  89. top: 100rpx;
  90. left: 40rpx;
  91. z-index: 999999;
  92. }
  93. </style>