moneyPwd.vue 3.3 KB

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