cancelAccount.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="container">
  3. <view class="desc-box">
  4. <view class="desc-text">您正在申请广州市房地产中介协会会员中心小程序账户注销,为保障您的权益,我们再次提醒您:</view>
  5. <view class="desc-text">1、您的账号可能绑定了信用信息卡信息、业务水平证书信息、会费缴交记录等重要数据,一旦注销系统将无法恢复相关数据,请您务必谨慎操作!我们将在您申请注销账号起7个工作日内完成与该账号相关的数据处理工作。</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">{{codeText}}</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" :labelDisabled="true">
  29. <view>我已阅读并同意
  30. <text @click="toCancelAgree">&#x300A;会员中心小程序账号注销通知&#x300B;</text>
  31. </view>
  32. </u-checkbox>
  33. </u-checkbox-group>
  34. <u-button type="primary" shape="circle" @click="onSubmit">提交</u-button>
  35. </view>
  36. </view>
  37. </template>
  38. <script setup>
  39. import { ref, reactive } from 'vue'
  40. import { onShow, onReady } from '@dcloudio/uni-app'
  41. import { msgError, msgSuccess, showConfirm, msg } from '@/utils/common'
  42. import { useAuthStore } from '@/store/authStore'
  43. import {
  44. smsSend
  45. } from "@/api/login.js"
  46. import { unregister } from '@/api/setting.js'
  47. const authStore = useAuthStore()
  48. const formRef = ref()
  49. const formData = reactive({
  50. form: {
  51. phone: null,
  52. code: null,
  53. captchaUuid: null
  54. },
  55. rules: {
  56. phone: [
  57. {
  58. required: true,
  59. message: '请输入绑定手机号',
  60. // 可以单个或者同时写两个触发验证方式
  61. trigger: 'blur',
  62. }
  63. ],
  64. code: [
  65. {
  66. required: true,
  67. message: '请输入验证码',
  68. // 可以单个或者同时写两个触发验证方式
  69. trigger: 'blur',
  70. }
  71. ],
  72. }
  73. })
  74. const isAwaitCode = ref(false)
  75. const codeText = ref('获取验证码') // 59秒重新获取
  76. const cancelCheck = ref(false)
  77. function getCode() {
  78. let {phone} = formData.form
  79. if (!/^1[3-9]\d{9}$/.test(phone)) {
  80. msg("请输入正确的手机号");
  81. return;
  82. }
  83. if (!isAwaitCode.value) {
  84. smsSend({phone}).then(res => {
  85. if (res && res.data.captchaUuid) {
  86. formData.form.captchaUuid = res.data.captchaUuid
  87. isAwaitCode.value = true
  88. // 倒计时60秒后重新获取
  89. let time = 60
  90. codeText.value = `重新获取(${time > 10 ? time : '0' + time}s)`
  91. const timer = setInterval(() => {
  92. time--
  93. codeText.value = `重新获取(${time > 10 ? time : '0' + time}s)`
  94. if (time <= 0) {
  95. clearInterval(timer)
  96. codeText.value = '获取验证码'
  97. isAwaitCode.value = false
  98. }
  99. }, 1000)
  100. }
  101. })
  102. } else {
  103. msg('倒计时结束后再发送');
  104. }
  105. }
  106. function onSubmit() {
  107. formRef.value.validate((valid) => {
  108. if (valid) {
  109. if (!cancelCheck.value) {
  110. msg('请阅读并同意《会员中心小程序账号注销通知》')
  111. return
  112. }
  113. // 提交
  114. showConfirm('是否确认注销').then(res => {
  115. if (res.confirm) {
  116. const form = {
  117. captcha: formData.form.code,
  118. captchaUuid: formData.form.captchaUuid
  119. }
  120. uni.showLoading({
  121. title: "请稍候..."
  122. })
  123. unregister(form).then(res => {
  124. if (res && res.code === 0) {
  125. uni.hideLoading()
  126. authStore.clearAuthToken()
  127. authStore.cleanUserInfo()
  128. uni.reLaunch({
  129. url: '/pages/initial/initial?isCancelAccount=1'
  130. })
  131. }
  132. })
  133. }
  134. })
  135. }
  136. })
  137. }
  138. function toCancelAgree(){
  139. uni.navigateTo({
  140. url: "/pages/agreement/privacyAgree/privacyAgree?mode=cancel"
  141. })
  142. }
  143. onReady(() => {
  144. formRef.value.setRules(formData.rules)
  145. })
  146. onShow(() => {
  147. formData.form.phone = authStore.userInfo.phone
  148. })
  149. </script>
  150. <style lang="scss" scoped>
  151. .container {
  152. height: 100vh;
  153. width: 100vw;
  154. background-color: $uni-bg-color;
  155. padding: 20rpx;
  156. .desc-box {
  157. padding: 20rpx 0;
  158. margin-bottom: 20rpx;
  159. .desc-text {
  160. text-indent: 2em;
  161. line-height: 60rpx;
  162. &:nth-child(1) {
  163. text-indent: 0em;
  164. }
  165. }
  166. }
  167. .form-box {
  168. padding: 20rpx 0;
  169. .input-code {
  170. display: flex;
  171. align-items: center;
  172. gap: 20rpx;
  173. .input {
  174. width: 70%;
  175. }
  176. .btn {
  177. width: 30%;
  178. text-align: center;
  179. }
  180. }
  181. }
  182. .bottom-box {
  183. margin-top: 50rpx;
  184. padding: 0 50rpx;
  185. }
  186. }
  187. </style>