You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.6 KiB

3 years ago
  1. <template>
  2. <view class="app">
  3. <view class="page-tit row">
  4. <text class="f-m">设置支付密码</text>
  5. </view>
  6. <view class="input-wrap pwd-wrap row b-b">
  7. <text class="mix-icon icon-mima"></text>
  8. <input class="input" v-model="password" :password="!showPwd" type="number" maxlength="6" placeholder="支付密码,请输入6位数字" placeholder-style="color:#999;font-size:30rpx" />
  9. <text class="mix-icon icon-eye" :class="showPwd ? 'icon-yanjing': 'icon-biyan'" @click.stop.prevent="changePwdState"></text>
  10. </view>
  11. <view class="input-wrap row b-b">
  12. <text class="mix-icon icon-yanzhengma1"></text>
  13. <input class="input" v-model="code" type="number" maxlength="6" placeholder="请输入手机验证码" placeholder-style="color:#999;font-size:30rpx" />
  14. <mix-code templateCode="SMS_194050994" action="设置支付密码"></mix-code>
  15. </view>
  16. <mix-button ref="confirmBtn" text="提交" marginTop="80rpx" @onConfirm="confirm"></mix-button>
  17. </view>
  18. </template>
  19. <script>
  20. import {checkStr} from '@/common/js/util'
  21. export default {
  22. data() {
  23. return {
  24. showPwd: false,
  25. password: '',
  26. code: ''
  27. }
  28. },
  29. methods: {
  30. async confirm(){
  31. const {password, code} = this;
  32. if(!checkStr(password, 'payPwd')){
  33. this.$util.msg('支付密码应为6位数字');
  34. this.$refs.confirmBtn.stop();
  35. return;
  36. }
  37. if(!checkStr(code, 'mobileCode')){
  38. this.$util.msg('验证码错误');
  39. this.$refs.confirmBtn.stop();
  40. return;
  41. }
  42. const res = await this.$request('user', 'setPayPasswod', {
  43. username: this.$store.state.userInfo.username,
  44. pay_password: password,
  45. code
  46. });
  47. this.$util.msg(res.msg);
  48. this.$refs.confirmBtn.stop();
  49. if(res.status === 1){
  50. this.$store.dispatch('getUserInfo');
  51. setTimeout(()=>{
  52. uni.navigateBack();
  53. }, 1000)
  54. }
  55. },
  56. changePwdState(){
  57. this.showPwd = !this.showPwd;
  58. }
  59. }
  60. }
  61. </script>
  62. <style scoped lang="scss">
  63. .app{
  64. padding-top: 30rpx;
  65. }
  66. .page-tit{
  67. height: 80rpx;
  68. padding-left: 50rpx;
  69. font-size: 34rpx;
  70. color: #333;
  71. font-weight: 700;
  72. }
  73. .input-wrap{
  74. height: 110rpx;
  75. margin: 20rpx 50rpx 0;
  76. padding-right: 20rpx;
  77. &.pwd-wrap{
  78. position: relative;
  79. z-index: 100;
  80. }
  81. .input{
  82. flex: 1;
  83. font-size: 32rpx;
  84. color: #333;
  85. }
  86. .mix-icon{
  87. width: 60rpx;
  88. font-size: 40rpx;
  89. color: $base-color;
  90. }
  91. .icon-eye{
  92. width: auto;
  93. padding: 20rpx;
  94. font-size: 36rpx;
  95. color: #999;
  96. transform: translateX(14rpx);
  97. }
  98. }
  99. </style>