clear-user.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="">
  3. <u-popup v-model="show" mode="center" width="80%" :border-radius="10" negativeTop="200">
  4. <view style="padding:30rpx 0rpx;display: flex;flex-direction: column;justify-content: space-between;">
  5. <view class="center text-center padding-bottom-30">
  6. <text>注销账户</text>
  7. </view>
  8. <view class="flex-sub" style="margin: 50rpx 30rpx;">
  9. <text class=" text-red"
  10. style="font-size: 28rpx;line-height: 56rpx;">您的个人信息,账户信息,认证信息将被清空/删除,确定进行此操作?</text>
  11. <view class="margin-top " v-if="hasMember">
  12. <text class="cuIcon-title text-red"></text>
  13. <text class="text-sm ">业主角色请到【家人管理】处移除房间下的成员</text>
  14. </view>
  15. </view>
  16. <view class="text-sm" style="display: flex;padding: 5rpx 32rpx 38rpx">
  17. <u-checkbox v-model="checked" size="26" name="checked">
  18. <text style="font-size: 28rpx;">确定注销账户</text>
  19. </u-checkbox>
  20. </view>
  21. <view style="display: flex;justify-content: center">
  22. <u-button v-if="type==1" :customStyle="createStyle" @click="createRoom">创建新房间</u-button>
  23. <u-button v-else :customStyle="cancelStyle" @click="show=false">暂不注销</u-button>
  24. <u-button :disabled="time>0" type="primary" :customStyle="confirmStyle" @click="confirm">
  25. <text v-if="time>0">{{time}}s</text>
  26. <text v-else>确定注销</text>
  27. </u-button>
  28. </view>
  29. </view>
  30. </u-popup>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. name: '',
  36. data() {
  37. return {
  38. hasMember: false,
  39. time: 8,
  40. interval: null,
  41. checked: false,
  42. show: false,
  43. roomList: [],
  44. iconStyle: {
  45. 'color': '#2f7ff5'
  46. },
  47. createStyle: {
  48. backgroundColor: '#ff9900',
  49. height: '70rpx',
  50. lineHeight: '70rpx',
  51. width: '210rpx',
  52. fontSize: '28rpx',
  53. color: '#FFFFFF',
  54. marginLeft: '15rpx',
  55. borderRadius: '0'
  56. },
  57. cancelStyle: {
  58. height: '70rpx',
  59. lineHeight: '70rpx',
  60. width: '210rpx',
  61. fontSize: '28rpx',
  62. border: '1rpx solid #afb0b3',
  63. marginRight: '15rpx',
  64. borderRadius: '0'
  65. },
  66. confirmStyle: {
  67. height: '70rpx',
  68. lineHeight: '70rpx',
  69. width: '210rpx',
  70. fontSize: '28rpx',
  71. marginLeft: '15rpx',
  72. borderRadius: '0'
  73. }
  74. };
  75. },
  76. created() {
  77. this.countdown()
  78. },
  79. beforeDestroy() {
  80. if (this.interval) {
  81. clearInterval(this.interval)
  82. }
  83. },
  84. methods: {
  85. async showModal() {
  86. let res = await this.$http.hasMember(this.vuex_member.id)
  87. this.hasMember = res.data.data
  88. this.show = true
  89. },
  90. confirm() {
  91. if (!this.checked) {
  92. this.$u.toast('请先勾选确定注销账户操作')
  93. this.show = true
  94. return
  95. }
  96. if (this.hasMember) {
  97. this.$u.toast('请先移除相关成员')
  98. return
  99. }
  100. this.$http.logout(this.vuex_member.id)
  101. this.show = false
  102. this.$dialog.showModal("注销成功,请退出小程序", false).then(res => {
  103. this.$store.commit('clear')
  104. getApp().globalData.anyHousePass = false
  105. getApp().globalData.member = null
  106. uni.clearStorage()
  107. uni.reLaunch({
  108. url: "/pages/index/index"
  109. })
  110. })
  111. },
  112. countdown() {
  113. this.interval = setInterval(() => {
  114. if (this.time > 0) {
  115. this.time -= 1
  116. }
  117. }, 1000)
  118. }
  119. }
  120. };
  121. </script>
  122. <style lang="scss" scoped>
  123. </style>