cancelAccount.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <view class="container">
  3. <view class="desc-box">
  4. <view class="desc-text">您正在申请广州市房地产中介协会会员中心小程序账户注销,为保障您的权益,我们再次提醒您:</view>
  5. <view class="desc-text">1、注销申请一旦提交,将无法撤销,且系统可能无法恢复相关数据,请您务必谨慎操作!我们将在您申请注销账号起15个工作日内完成与该账号相关的数据处理工作。</view>
  6. <view class="desc-text">2、账号注销7个工作日内,您无法通过相同手机号或身份证重新注册/登录广州市房地产中介协会会员中心小程序账号。</view>
  7. <view class="desc-text">3、如您在注销账号的过程中遇到任何问题,请拨打协会客服热线(020-66676400)与我们取得联系。</view>
  8. </view>
  9. <view class="form-box">
  10. <u-form :model="formData.form" ref="formRef" label-width="120" :label-style="{fontWeight: 'bold', fontSize: '26rpx'}">
  11. <u-form-item prop="phone">
  12. <view class="input-code">
  13. <view class="input">
  14. <u-input v-model="formData.form.phone" disabled :border="true" type="text" placeholder="请输入绑定手机号"/>
  15. </view>
  16. <view class="btn">
  17. <text class="form-item-text" @click="getCode">{{tips}}</text>
  18. </view>
  19. </view>
  20. </u-form-item>
  21. <u-form-item prop="code">
  22. <u-input v-model="formData.form.code" :border="true" type="text" placeholder="请输入验证码"/>
  23. </u-form-item>
  24. </u-form>
  25. </view>
  26. <view class="bottom-box">
  27. <u-checkbox-group style="display: flex;justify-content: center;margin-bottom: 20rpx;">
  28. <u-checkbox v-model="cancelCheck" name="yes" shape="circle" label-size="26">我已阅读并同意&#x300A;会员中心小程序账号注销通知&#x300B;</u-checkbox>
  29. </u-checkbox-group>
  30. <u-button type="primary" shape="circle" @click="onSubmit">提交</u-button>
  31. </view>
  32. </view>
  33. </template>
  34. <script setup>
  35. import { ref, reactive } from 'vue'
  36. import { onLoad, onReady } from '@dcloudio/uni-app'
  37. import { msgError, msgSuccess, showConfirm } from '@/utils/common'
  38. import { useAuthStore } from '@/store/authStore'
  39. import {
  40. smsSend
  41. } from "@/api/login.js"
  42. const authStore = useAuthStore()
  43. const formRef = ref()
  44. const formData = reactive({
  45. form: {
  46. phone: null,
  47. code: null,
  48. captchaUuid: null
  49. },
  50. rules: {
  51. phone: [
  52. {
  53. required: true,
  54. message: '请输入绑定手机号',
  55. // 可以单个或者同时写两个触发验证方式
  56. trigger: 'blur',
  57. }
  58. ],
  59. code: [
  60. {
  61. required: true,
  62. message: '请输入验证码',
  63. // 可以单个或者同时写两个触发验证方式
  64. trigger: 'blur',
  65. }
  66. ],
  67. }
  68. })
  69. const isAwaitCode = ref(false)
  70. const tips = ref('获取验证码') // 59秒重新获取
  71. const cancelCheck = ref(false)
  72. function getCode() {
  73. let {phone} = formData.form
  74. if (!isAwaitCode.value) {
  75. smsSend({phone}).then(res => {
  76. if (res && res.data.captchaUuid) {
  77. formData.form.captchaUuid = res.data.captchaUuid
  78. isSendCode.value = true
  79. setTimeout(() => {
  80. }, 60 * 1000)
  81. }
  82. })
  83. } else {
  84. msg('倒计时结束后再发送');
  85. }
  86. }
  87. function onSubmit() {
  88. formRef.value.validate((valid) => {
  89. if (valid) {
  90. // 提交
  91. showConfirm('是否确认注销').then(res => {
  92. if (res.confirm) {
  93. authStore.clearAuthToken()
  94. authStore.cleanUserInfo()
  95. uni.reLaunch({
  96. url: '/pages/initial/initial?isCancelAccount=1'
  97. })
  98. }
  99. })
  100. }
  101. })
  102. }
  103. onReady(() => {
  104. formRef.value.setRules(formData.rules)
  105. })
  106. onLoad(() => {
  107. formData.form.phone = authStore.phone
  108. })
  109. </script>
  110. <style lang="scss" scoped>
  111. .container {
  112. height: 100vh;
  113. width: 100vw;
  114. background-color: $uni-bg-color;
  115. padding: 20rpx;
  116. .desc-box {
  117. padding: 20rpx 0;
  118. margin-bottom: 20rpx;
  119. .desc-text {
  120. text-indent: 2em;
  121. line-height: 60rpx;
  122. &:nth-child(1) {
  123. text-indent: 0em;
  124. }
  125. }
  126. }
  127. .form-box {
  128. padding: 20rpx 0;
  129. .input-code {
  130. display: flex;
  131. align-items: center;
  132. gap: 20rpx;
  133. .input {
  134. width: 70%;
  135. }
  136. .btn {
  137. width: 30%;
  138. text-align: center;
  139. }
  140. }
  141. }
  142. .bottom-box {
  143. margin-top: 50rpx;
  144. padding: 0 50rpx;
  145. }
  146. }
  147. </style>