transaction-password.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <v-page>
  3. <!-- <v-header :title="`${user.is_set_payword?$t('safe.c9'):$t('safe.d0')} ${$t('safe.d1')}`"></v-header> -->
  4. <v-header :title="`${$t('safe.d1')}`"></v-header>
  5. <main class="layout-main bg-panel-4 m-t-md">
  6. <view class="form-item border-b p-md">
  7. <view class="label m-b-xs">{{$t('safe.b3')}}</view>
  8. <view class="input color-light">
  9. <v-input type="password" v-model="form.payword" :placeholder="$t('safe.b4')"></v-input>
  10. </view>
  11. </view>
  12. <view class="form-item border-b p-md">
  13. <view class="label m-b-xs">{{$t('safe.b5')}}</view>
  14. <view class="input color-light">
  15. <v-input type="password" v-model="form.payword_confirmation" :placeholder="$t('safe.b6')"></v-input>
  16. </view>
  17. </view>
  18. <view class="form-item border-b p-md" v-if="user.phone_status==1">
  19. <view class="label m-b-xs">SMS{{$t('safe.a7')}}</view>
  20. <view class="input color-light">
  21. <v-input v-model="form.sms_code" :placeholder="$t('safe.a6')">
  22. <template #right>
  23. <v-code url="/user/getCode" :data="{type:1}" />
  24. </template>
  25. </v-input>
  26. </view>
  27. </view>
  28. <view class="form-item border-b p-md" v-if="user.email_status==1">
  29. <view class="label m-b-xs">{{$t('safe.a5')}}</view>
  30. <view class="input color-light">
  31. <v-input v-model="form.email_code" :placeholder="$t('safe.a6')">
  32. <template #right>
  33. <v-code url="/user/getCode" :data="{type:2}" />
  34. </template>
  35. </v-input>
  36. </view>
  37. </view>
  38. <view class="form-item border-b p-md" v-if="user.google_status==1">
  39. <view class="label m-b-xs">google{{$t('safe.a7')}}</view>
  40. <view class="input color-light">
  41. <v-input v-model="form.google_code" :placeholder="$t('safe.a6')"></v-input>
  42. </view>
  43. </view>
  44. </main>
  45. <view class="p-md bg-panel-4">
  46. <v-button class="w-max" block type="theme" ref="btn" @click="setPassword">{{$t('safe.e3')}}</v-button>
  47. </view>
  48. <van-toast id="van-toast" />
  49. </v-page>
  50. </template>
  51. <script>
  52. import Setting from "@/api/setting";
  53. import { mapState, mapActions } from "vuex";
  54. export default {
  55. data() {
  56. return {
  57. form: {
  58. payword: "",
  59. payword_confirmation: "",
  60. sms_code: "",
  61. email_code: "",
  62. google_code: "",
  63. },
  64. };
  65. },
  66. computed: {
  67. ...mapState({
  68. user: "user",
  69. }),
  70. },
  71. methods: {
  72. ...mapActions({
  73. setUserInfo: "setUserInfo",
  74. }),
  75. setPassword() {
  76. let data = this.form
  77. if(!data.payword){
  78. return this.$toast(this.$t('safe.b4'))
  79. }
  80. if(!data.payword_confirmation){
  81. return this.$toast(this.$t('safe.b6'))
  82. }
  83. if(data.payword_confirmation != data.payword){
  84. return this.$toast(this.$t('safe.f1'))
  85. }
  86. if(this.user.phone_status==1){
  87. if(!data.sms_code){
  88. return this.$toast(this.$t('safe.f2'))
  89. }
  90. }
  91. if(this.user.email_status==1){
  92. if(!data.email_code){
  93. return this.$toast(this.$t('safe.f2'))
  94. }
  95. }
  96. if(this.user.google_status==1){
  97. if(!data.google_code){
  98. return this.$toast(this.$t('safe.f2'))
  99. }
  100. }
  101. Setting.setOrResetPaypwd(this.form, { btn: this.$refs.btn }).then(() => {
  102. this.$toast.success(this.$t('safe.e4'));
  103. this.$back();
  104. this.setUserInfo();
  105. });
  106. },
  107. },
  108. };
  109. </script>
  110. <style lang="scss" scoped>
  111. </style>