moneyPwd.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <view class="container">
  3. <view class="row b-b" v-if="type == 2">
  4. <text class="tit">原密码</text>
  5. <input class="input" v-model="oldPassword" type="text" placeholder="请填写原密码" placeholder-class="placeholder" />
  6. </view>
  7. <view class="row b-b">
  8. <text class="tit">新密码</text>
  9. <input class="input" v-model="password" type="password" placeholder="请填写6位新密码" placeholder-class="placeholder" />
  10. </view>
  11. <view class="row b-b">
  12. <text class="tit">再次输入</text>
  13. <input class="input" v-model="yzpassword" type="password" placeholder="请重新填写6位新密码" placeholder-class="placeholder" />
  14. </view>
  15. <button class="add-btn" :class="{ 'bg-gray': loding }" @click="loding ? '' : confirm()">提交</button>
  16. </view>
  17. </template>
  18. <script>
  19. import { verify } from '@/api/login.js';
  20. import { mapState } from 'vuex';
  21. import { is_pas, transaction } from '@/api/set.js';
  22. export default {
  23. data() {
  24. return {
  25. type: 1,
  26. oldPassword: '', //老密码
  27. password: '', //新密码
  28. yzpassword: '', //重复输入
  29. loding: false //是否载入中
  30. };
  31. },
  32. computed: {
  33. ...mapState('user', ['userInfo'])
  34. },
  35. onLoad() {
  36. is_pas().then(({ data }) => {
  37. console.log();
  38. if (data.status != 0) {
  39. this.type = 2;
  40. }
  41. });
  42. },
  43. watch: {
  44. // 监听倒计时
  45. countDown(i) {
  46. if (i == 0) {
  47. clearInterval(this.time);
  48. }
  49. }
  50. },
  51. methods: {
  52. confirm(e) {
  53. const reg = /^[0-9]{6}$/;
  54. console.log(this.yzpassword);
  55. if (!reg.test(this.yzpassword)) {
  56. uni.showModal({
  57. title: '错误',
  58. content: '请输入6位数字支付密码',
  59. showCancel: false
  60. });
  61. return false;
  62. }
  63. if (this.yzpassword != this.password) {
  64. uni.showModal({
  65. title: '错误',
  66. content: '密码不一致请重新输入',
  67. showCancel: false
  68. });
  69. return false;
  70. }
  71. this.loding = true;
  72. transaction({
  73. type: this.type,
  74. payment: this.password,
  75. old_payment: this.oldPassword
  76. })
  77. .then(({ data }) => {
  78. this.loding = false;
  79. uni.showModal({
  80. title: '提示',
  81. content: '修改成功',
  82. showCancel: false,
  83. confirmText: '返回个人中心',
  84. success: res => {
  85. uni.switchTab({
  86. url: '/pages/user/user'
  87. });
  88. }
  89. });
  90. })
  91. .catch(err => {
  92. this.loding = false;
  93. console.log(err);
  94. });
  95. }
  96. }
  97. };
  98. </script>
  99. <style lang="scss">
  100. page {
  101. background: $page-color-base;
  102. }
  103. .container {
  104. padding-top: 30rpx;
  105. }
  106. .row {
  107. display: flex;
  108. align-items: center;
  109. position: relative;
  110. padding: 0 30rpx;
  111. height: 110rpx;
  112. background: #fff;
  113. .tit {
  114. flex-shrink: 0;
  115. width: 120rpx;
  116. font-size: 30rpx;
  117. color: $font-color-dark;
  118. }
  119. .input {
  120. flex: 1;
  121. font-size: 30rpx;
  122. color: $font-color-dark;
  123. }
  124. .iconlocation {
  125. font-size: 36rpx;
  126. color: $font-color-light;
  127. }
  128. }
  129. .add-btn {
  130. display: flex;
  131. align-items: center;
  132. justify-content: center;
  133. width: 690rpx;
  134. height: 80rpx;
  135. margin: 60rpx auto;
  136. font-size: $font-lg;
  137. color: #fff;
  138. background: #dc262b;
  139. border-radius: 10rpx;
  140. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  141. }
  142. .bg-gray {
  143. background-color: $color-gray;
  144. }
  145. .code {
  146. color: #5dbc7c;
  147. font-size: 23rpx;
  148. border-left: 1px solid #eeeeee;
  149. width: 150rpx;
  150. flex-shrink: 0;
  151. text-align: center;
  152. }
  153. </style>