payDialog.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <view class="key-pop" :hidden="!show_key">
  3. <view class="key-bg"></view>
  4. <view class="keyborad" :style="{transform : show_key2 ? 'translateY(0)':'translateY(100%)'}">
  5. <view class="key_main">
  6. <view class="main_title">
  7. <u-icon name="close" @tap="hideFun"></u-icon>
  8. <text>请输入兑换密码</text>
  9. </view>
  10. <view class="main_content">
  11. <view class="content_num">
  12. <view v-for="item in inputArray" :key="item" class="content_item">{{password[item-1] ? '●' :''}}</view>
  13. </view>
  14. <view class="main_forget" @tap="forgetFun">忘记密码</view>
  15. </view>
  16. <view class="main_keyboard">
  17. <view class="key_num" v-for="item in numberArray" :key="item" @tap="inputNumFun({num:item})">{{item}}</view>
  18. <view class="key_null"></view>
  19. <view class="key_0" @tap="inputNumFun({num:0})">0</view>
  20. <view class="key_del" @tap="delNumFun">
  21. <image src="/static/img/del_2.png" mode="aspectFill"></image>
  22. </view>
  23. </view>
  24. <view style="height: 100rpx;"></view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <style lang="scss">
  30. .key-pop{position: fixed;width: 100%;height: 100%;left: 0;top: 0;}
  31. .key-pop .key-bg{position: absolute;width: 100%;height: 100%;left: 0;top: 0;background: rgba(0, 0, 0, 0.5);}
  32. .keyborad{width:100vw;height: 100vh;position: fixed;bottom: 0px;top:0px;left:0px;right:0px;z-index:100;display: flex;flex-direction: column;justify-content: flex-end;transform: translateY(100%);transition:all 0.4s;
  33. .key_main{ width:100vw;height: 1000rpx;background: rgba(245,245,245,0.9);box-sizing: border-box;display: flex;flex-direction: column;justify-content: space-between;
  34. .main_title{ font-size:34rpx;color: #000000;height: 100rpx;display: flex;align-items: center;letter-spacing: 2rpx;width:100%;box-sizing: border-box;padding:0px 20rpx;border-bottom:2rpx solid #e1e1e1;
  35. image{ width:48rpx;height: 48rpx;position: relative;z-index:10}
  36. text{ flex:1;margin-left:-48rpx;display: flex;justify-content: center;}
  37. }
  38. .main_content{ width:100%;box-sizing: border-box;padding:0px 30rpx;margin-top:40rpx;
  39. .content_num{ width:100%;height: 100rpx;border:2rpx solid #DBDBDB;border-radius: 10rpx;display: flex;align-items: center;
  40. .content_item{ flex: 1;height: 100%;border-right: 2rpx solid #DBDBDB;display: flex;justify-content: center;align-items: center;}
  41. .content_item:last-child{ border-right:none}
  42. }
  43. .main_forget{ display: flex;justify-content: center;align-items: center;width:100%;font-size:28rpx;color: #007AFF;margin-top:40rpx}
  44. }
  45. .main_keyboard{ width:100%;height: 500rpx;background: #FFFFFF;display: flex;flex-flow: wrap;
  46. .key_null,.key_del{ background: #e2e7eb;}
  47. image{ width:48rpx;height: 48rpx;}
  48. .key_num,.key_null,.key_del,.key_0{ width:250rpx;height: 125rpx;display: flex;align-items: center;justify-content: center;font-size: 18px;font-weight: bold;}
  49. .key_num{ border-right:2rpx solid #f1f4f4;border-bottom:2rpx solid #f1f4f4;box-sizing: border-box;}
  50. .key_num:active{background: #f1f1f1;}
  51. .key_num:nth-child(8){border-bottom: none;}
  52. .key_0{ border-top:2rpx solid #f1f4f4}
  53. }
  54. }
  55. }
  56. </style>
  57. <script>
  58. export default{
  59. props:{
  60. },
  61. computed:{},
  62. data(){
  63. return{
  64. inputArray:[1,2,3,4,5,6],//输入密码的长度
  65. numberArray:[1,2,3,4,5,6,7,8,9],//密码键盘的数字
  66. password:'',//密码
  67. show_key:false,
  68. show_key2:false
  69. }
  70. },
  71. methods:{
  72. inputNumFun(op){
  73. let _this = this
  74. if(_this.password.length <=6){
  75. _this.password += op.num
  76. if(_this.password.length == 6){
  77. _this.$emit('getPassword',{password:_this.password});
  78. }
  79. }
  80. },
  81. show:function(){
  82. this.password = "";
  83. this.show_key = true;
  84. setTimeout(()=>{
  85. this.show_key2 =true;
  86. },200);
  87. },
  88. delNumFun(){
  89. if(this.password.length == 0) return
  90. this.password = this.password.substring(0,this.password.length - 1);
  91. },
  92. cleanNum(){
  93. this.password = "";
  94. },
  95. forgetFun(){
  96. uni.navigateTo({
  97. url:"/pages/user/userinfo/security/mobileFind"
  98. });
  99. },
  100. hideFun(){
  101. this.show_key2 = false;
  102. setTimeout(()=>{
  103. this.show_key = false;
  104. },300);
  105. }
  106. }
  107. }
  108. </script>