transaction.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="container">
  3. <view class="row b-b">
  4. <text class="tit">{{$t('reg.a2')}}</text>
  5. <input class="input" v-model="account" type="text" :placeholder="$t('reg.a3')" placeholder-class="placeholder" />
  6. </view>
  7. <view class="row b-b">
  8. <text class="tit">{{$t('reg.a8')}}</text>
  9. <input class="input" v-model="password" type="password" :placeholder="$t('reg.a9')" placeholder-class="placeholder" />
  10. </view>
  11. <view class="row b-b">
  12. <text class="tit">{{$t('reg.b0')}}</text>
  13. <input class="input" v-model="repeat" type="password" :placeholder="$t('reg.b1')" placeholder-class="placeholder" />
  14. </view>
  15. <view class="row b-b">
  16. <text class="tit">{{$t('reg.a6')}}</text>
  17. <input class="input" v-model="captcha" type="text" :placeholder="$t('reg.a7')" placeholder-class="placeholder" />
  18. <view class="code" @click="verification">{{ countDown == 0 ? $t('reg.c6') : countDown }}</view>
  19. </view>
  20. <button class="add-btn" :class="{'bg-gray':loding}" @click="loding?'':confirm()">{{$t('common.submit')}}</button>
  21. </view>
  22. </template>
  23. <script>
  24. import { verify } from '@/api/login.js';
  25. import { mapState } from 'vuex';
  26. import { registerReset } from '@/api/set.js';
  27. export default {
  28. data() {
  29. return {
  30. time: '', //保存倒计时对象
  31. countDown: 0, //倒计时
  32. account: '', //手机号
  33. captcha: '', //验证码
  34. password: '' ,//新密码
  35. repeat: '', //重复密码
  36. loding:false,//是否载入中
  37. };
  38. },
  39. computed: {
  40. ...mapState(['userInfo'])
  41. },
  42. onLoad() {
  43. if(this.userInfo.phone == null){
  44. this.account = '';
  45. }else{
  46. this.account = this.userInfo.phone;
  47. this.show = false;
  48. }
  49. uni.setNavigationBarTitle({
  50. title: this.$t("tab.b3"),
  51. });
  52. },
  53. watch: {
  54. // 监听倒计时
  55. countDown(i) {
  56. if (i == 0) {
  57. clearInterval(this.time);
  58. }
  59. }
  60. },
  61. methods: {
  62. //发送验证码
  63. verification() {
  64. let obj = this;
  65. if (this.account == '') {
  66. this.$api.msg('请输入电话号码');
  67. return;
  68. }
  69. if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(this.account)) {
  70. this.$api.msg('请输入正确的手机号');
  71. return;
  72. }
  73. // 判断是否在倒计时
  74. if (obj.countDown > 0) {
  75. return false;
  76. } else {
  77. obj.countDown = 60;
  78. obj.time = setInterval(() => {
  79. obj.countDown--;
  80. }, 1000);
  81. //调用验证码接口
  82. verify({
  83. phone: obj.account,
  84. type: ''
  85. })
  86. .then(({ data }) => {})
  87. .catch(err => {
  88. console.log(err);
  89. });
  90. }
  91. },
  92. confirm(e) {
  93. // 检查两次输入的新密码是否一致
  94. if (this.password === this.repeat) {
  95. // 发送请求或执行逻辑来修改密码
  96. // 根据具体需求进行操作
  97. console.log('密码修改成功');
  98. // 更新交易密码
  99. this.password = this.repeat;
  100. // 清空输入框
  101. this.password = '';
  102. this.repeat = '';
  103. } else {
  104. console.log('两次输入的密码不一致');
  105. }
  106. }
  107. }
  108. };
  109. </script>
  110. <style lang="scss">
  111. page {
  112. background: #f3f3f3;
  113. }
  114. .row {
  115. display: flex;
  116. align-items: center;
  117. position: relative;
  118. padding: 0 30rpx;
  119. height: 110rpx;
  120. background: $font-color-white;
  121. .tit {
  122. min-width: 130rpx;
  123. flex-shrink: 0;
  124. font-size: 30rpx;
  125. }
  126. .input {
  127. flex: 1;
  128. font-size: 30rpx;
  129. color: $font-color-light;
  130. padding-left: 20rpx;
  131. }
  132. .iconlocation {
  133. font-size: 36rpx;
  134. color: $font-color-light;
  135. }
  136. }
  137. .add-btn {
  138. display: flex;
  139. align-items: center;
  140. justify-content: center;
  141. height: 100rpx;
  142. margin: 60rpx auto;
  143. font-size: $font-lg;
  144. background-color: #FFF;
  145. border:none;
  146. }
  147. .bg-gray{
  148. background-color: $color-gray;
  149. }
  150. .code {
  151. color: #5dbc7c;
  152. font-size: 23rpx;
  153. border-left: 1px solid #eeeeee;
  154. width: 150rpx;
  155. flex-shrink: 0;
  156. text-align: center;
  157. }
  158. </style>