transaction.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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 { Reset } 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. this.Reset()
  44. if(this.userInfo.phone == null){
  45. this.account = '';
  46. }else{
  47. this.account = this.userInfo.phone;
  48. this.show = false;
  49. }
  50. uni.setNavigationBarTitle({
  51. title: this.$t("tab.b3"),
  52. });
  53. },
  54. watch: {
  55. // 监听倒计时
  56. countDown(i) {
  57. if (i == 0) {
  58. clearInterval(this.time);
  59. }
  60. }
  61. },
  62. methods: {
  63. //发送验证码
  64. verification() {
  65. let obj = this;
  66. if (this.account == '') {
  67. this.$api.msg(obj.$t("safe.b5"));
  68. return;
  69. }
  70. if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(this.account)) {
  71. this.$api.msg(obj.$t("safe.b8"));
  72. return;
  73. }
  74. // 判断是否在倒计时
  75. if (obj.countDown > 0) {
  76. return false;
  77. } else {
  78. obj.countDown = 60;
  79. obj.time = setInterval(() => {
  80. obj.countDown--;
  81. }, 1000);
  82. //调用验证码接口
  83. verify({
  84. phone: obj.account,
  85. type: ''
  86. })
  87. .then(({ data }) => {})
  88. .catch(err => {
  89. console.log(err);
  90. });
  91. }
  92. },
  93. confirm(e) {
  94. // 检查两次输入的新密码是否一致
  95. if (this.password === this.repeat) {
  96. // 发送请求或执行逻辑来修改密码
  97. // 根据具体需求进行操作
  98. console.log('密码修改成功');
  99. // 更新交易密码
  100. this.password = this.repeat;
  101. // 清空输入框
  102. this.password = '';
  103. this.repeat = '';
  104. } else {
  105. console.log('两次输入的密码不一致');
  106. }
  107. }
  108. }
  109. };
  110. </script>
  111. <style lang="scss">
  112. page {
  113. background: #f3f3f3;
  114. }
  115. .row {
  116. display: flex;
  117. align-items: center;
  118. position: relative;
  119. padding: 0 30rpx;
  120. height: 110rpx;
  121. background: $font-color-white;
  122. .tit {
  123. min-width: 130rpx;
  124. flex-shrink: 0;
  125. font-size: 30rpx;
  126. }
  127. .input {
  128. flex: 1;
  129. font-size: 30rpx;
  130. color: $font-color-light;
  131. padding-left: 20rpx;
  132. }
  133. .iconlocation {
  134. font-size: 36rpx;
  135. color: $font-color-light;
  136. }
  137. }
  138. .add-btn {
  139. display: flex;
  140. align-items: center;
  141. justify-content: center;
  142. height: 100rpx;
  143. margin: 60rpx auto;
  144. font-size: $font-lg;
  145. background-color: #FFF;
  146. border:none;
  147. }
  148. .bg-gray{
  149. background-color: $color-gray;
  150. }
  151. .code {
  152. color: #000s;
  153. font-size: 23rpx;
  154. border-left: 1px solid #eeeeee;
  155. width: 150rpx;
  156. flex-shrink: 0;
  157. text-align: center;
  158. }
  159. </style>