transaction.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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("user",['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(obj.$t("safe.b5"));
  67. return;
  68. }
  69. if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(this.account)) {
  70. this.$api.msg(obj.$t("safe.b8"));
  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. this.loding = true;
  94. uni.showLoading({
  95. title: this.$t("userinfo.u23"),
  96. mask: true
  97. });
  98. Reset({
  99. account: this.account,
  100. captcha: this.captcha,
  101. password: this.password,
  102. repeat: this.repeat
  103. })
  104. .then(() => {
  105. this.loding = false;
  106. uni.showToast({
  107. title: this.$t("safe.d3"),
  108. icon:"success",
  109. mask:true
  110. });
  111. })
  112. .catch(err => {
  113. this.loding = false;
  114. console.log(err);
  115. });
  116. }
  117. }
  118. };
  119. </script>
  120. <style lang="scss">
  121. page {
  122. background: #f3f3f3;
  123. }
  124. .row {
  125. display: flex;
  126. align-items: center;
  127. position: relative;
  128. padding: 0 30rpx;
  129. height: 110rpx;
  130. background: $font-color-white;
  131. .tit {
  132. min-width: 130rpx;
  133. flex-shrink: 0;
  134. font-size: 30rpx;
  135. }
  136. .input {
  137. flex: 1;
  138. font-size: 30rpx;
  139. color: $font-color-light;
  140. padding-left: 20rpx;
  141. }
  142. .iconlocation {
  143. font-size: 36rpx;
  144. color: $font-color-light;
  145. }
  146. }
  147. .add-btn {
  148. display: flex;
  149. align-items: center;
  150. justify-content: center;
  151. height: 100rpx;
  152. margin: 60rpx auto;
  153. font-size: $font-lg;
  154. background-color: #FFF;
  155. border:none;
  156. }
  157. .bg-gray{
  158. background-color: $color-gray;
  159. }
  160. .code {
  161. color: #000s;
  162. font-size: 23rpx;
  163. border-left: 1px solid #eeeeee;
  164. width: 150rpx;
  165. flex-shrink: 0;
  166. text-align: center;
  167. }
  168. </style>