cancelAccount.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view class="container">
  3. <view class="desc-box">
  4. 请您注意,注销申请一经提交,则无法撤销,请谨慎选择!
  5. </view>
  6. <view class="form-box">
  7. <u-form :model="formData.form" ref="formRef" label-width="120" :label-style="{fontWeight: 'bold', fontSize: '26rpx'}">
  8. <u-form-item prop="phone">
  9. <view class="input-code">
  10. <view class="input">
  11. <u-input v-model="formData.form.phone" :border="true" type="text" placeholder="请输入绑定手机号"/>
  12. </view>
  13. <view class="btn">
  14. <text class="form-item-text" @click="getCode">{{tips}}</text>
  15. </view>
  16. </view>
  17. </u-form-item>
  18. <u-form-item prop="code">
  19. <u-input v-model="formData.form.code" :border="true" type="text" placeholder="请输入验证码"/>
  20. </u-form-item>
  21. </u-form>
  22. </view>
  23. <view class="bottom-box">
  24. <u-button type="primary" shape="circle" @click="onSubmit">确定注销</u-button>
  25. </view>
  26. </view>
  27. </template>
  28. <script setup>
  29. import { ref, reactive } from 'vue'
  30. import { onLoad, onReady } from '@dcloudio/uni-app'
  31. import { msgError, msgSuccess, showConfirm } from '@/utils/common'
  32. const formRef = ref()
  33. const formData = reactive({
  34. form: {
  35. phone: null,
  36. code: null
  37. },
  38. rules: {
  39. phone: [
  40. {
  41. required: true,
  42. message: '请输入绑定手机号',
  43. // 可以单个或者同时写两个触发验证方式
  44. trigger: 'blur',
  45. }
  46. ],
  47. code: [
  48. {
  49. required: true,
  50. message: '请输入验证码',
  51. // 可以单个或者同时写两个触发验证方式
  52. trigger: 'blur',
  53. }
  54. ],
  55. }
  56. })
  57. const tips = ref('获取验证码') // 59秒重新获取
  58. function onSubmit() {
  59. formRef.value.validate((valid) => {
  60. if (valid) {
  61. // 提交
  62. showConfirm('是否确认注销').then(res => {
  63. if (res.confirm) {
  64. }
  65. })
  66. }
  67. })
  68. }
  69. onReady(() => {
  70. formRef.value.setRules(formData.rules)
  71. })
  72. </script>
  73. <style lang="scss" scoped>
  74. .container {
  75. height: 100vh;
  76. width: 100vw;
  77. background-color: $uni-bg-color;
  78. padding: 20rpx;
  79. .desc-box {
  80. text-indent: 2em;
  81. line-height: 60rpx;
  82. padding: 20rpx 0;
  83. margin-bottom: 20rpx;
  84. }
  85. .form-box {
  86. padding: 20rpx 0;
  87. .input-code {
  88. display: flex;
  89. align-items: center;
  90. gap: 20rpx;
  91. .input {
  92. width: 70%;
  93. }
  94. .btn {
  95. width: 30%;
  96. text-align: center;
  97. }
  98. }
  99. }
  100. .bottom-box {
  101. margin-top: 50rpx;
  102. padding: 0 50rpx;
  103. }
  104. }
  105. </style>