register.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div class="pt-5">
  3. <v-card class="default-width pa-5">
  4. <!-- 标题 -->
  5. <div class="resume-header">
  6. <div class="resume-title">{{ $t('enterprise.registeringNewEnterprise') }}</div>
  7. </div>
  8. <!-- 表单 -->
  9. <div class="CtFormClass" style="width: 600px;">
  10. <CtForm ref="CtFormRef" :items="formItems" style="width: 100%;"></CtForm>
  11. <!-- 上传照片 -->
  12. <div style="color: #999;">
  13. <span class="mr-1" style="color: #fe574a;">*</span>
  14. <span>上传营业执照</span>
  15. <!-- <span class="mx-3 defaultLink">查看示例</span> -->
  16. <span>支持jpg、jpeg、png格式,照片大小不得超过10M</span>
  17. </div>
  18. <div class="file-box">
  19. <div class="file-item" v-if="licenseUrl">
  20. <v-img width="100%" height="100%" :src="licenseUrl"></v-img>
  21. <!-- <v-img width="100%" height="100%" src="http://menduner.citupro.com:6868/admin-api/infra/file/24/get/cd7f5e26a239fb0ab335585e04c709b065f52832fc31539b3a5423224fc6d16c.png"></v-img> -->
  22. </div>
  23. <div class="file-item file-input-box" :class="{'verifyAct': fileVerify}" @click="openFileInput">
  24. <div class="icon text-center">
  25. <span class="mdi mdi-plus" style="font-size: 20px;"></span>
  26. <div style="font-size: 12px; ">上传照片</div>
  27. </div>
  28. <input
  29. type="file"
  30. ref="fileInput"
  31. accept="image/png, image/jpg, image/jpeg"
  32. style="display: none;"
  33. @change="handleUploadFile"
  34. />
  35. </div>
  36. </div>
  37. <!-- 注意事项 -->
  38. <div class="note mt-5">
  39. <h4>注意事项:</h4>
  40. <span>企业名称为对外展示的企业名称,建议填写公司营业执照上的名称,请区分总公司和分公司</span>
  41. <!-- <div>
  42. <span>2.若公司已注册,请上传公司委托证明下载模版</span>
  43. <span class="mx-3 defaultLink">下载模版</span>
  44. </div> -->
  45. </div>
  46. </div>
  47. <div class="text-center">
  48. <!-- 提交 -->
  49. <v-btn
  50. :loading="loginLoading"
  51. color="primary" class="white--text my-8" min-width="350"
  52. @click="handleCommit"
  53. >
  54. {{ $t('common.complete') }}
  55. </v-btn>
  56. </div>
  57. <!-- 底部 个人不能绑定企业 要去后端管理员加 -->
  58. <!-- <div class="text-center">
  59. <v-btn color="primary" variant="text" @click="router.push({ path: '/enterprise/joiningEnterprise' })">{{ $t('enterprise.joiningEnterprise') }}</v-btn>
  60. </div> -->
  61. </v-card>
  62. </div>
  63. </template>
  64. <script setup>
  65. import CtForm from '@/components/CtForm'
  66. import Snackbar from '@/plugins/snackbar'
  67. import { uploadFile } from '@/api/common'
  68. import { useI18n } from '@/hooks/web/useI18n'
  69. import { useRouter } from 'vue-router'
  70. import { enterpriseRegisterApply } from '@/api/personal/user'
  71. import { ref } from 'vue';
  72. defineOptions({name: 'enterprise-enterpriseRegister-register'})
  73. const { t } = useI18n()
  74. const CtFormRef = ref()
  75. const router = useRouter()
  76. const fileVerify = ref(false)
  77. const loginLoading = ref(false)
  78. const formItems = ref({
  79. options: [
  80. {
  81. type: 'text',
  82. key: 'name',
  83. value: '',
  84. label: '企业名称(需要与营业执照完全一致)*',
  85. counter: 50,
  86. rules: [v => !!v || '请输入企业名称']
  87. },
  88. {
  89. type: 'text',
  90. key: 'code',
  91. value: '',
  92. label: '企业统一社会信用代码 *',
  93. rules: [v => !!v || '请输入企业统一社会信用代码']
  94. },
  95. {
  96. type: 'text',
  97. key: 'phone',
  98. value: '',
  99. label: '联系电话 *',
  100. rules: [v => !!v || '请输入联系电话']
  101. },
  102. {
  103. type: 'text',
  104. key: 'email',
  105. value: '',
  106. label: '联系邮箱 *',
  107. rules: [v => !!v || '请输入联系邮箱']
  108. },
  109. ]
  110. })
  111. // 选择文件
  112. const fileInput = ref()
  113. const clicked = ref(false)
  114. const openFileInput = () => {
  115. if (clicked.value) return
  116. clicked.value = true
  117. fileInput.value.click()
  118. clicked.value = false
  119. }
  120. // 上传
  121. let licenseUrl = ref('')
  122. const handleUploadFile = async (e) => {
  123. const file = e.target.files[0]
  124. const formData = new FormData()
  125. formData.append('file', file)
  126. const { data } = await uploadFile(formData)
  127. if (!data) return
  128. licenseUrl.value = data
  129. fileVerify.value = false
  130. // console.log('uploadFile->data', data)
  131. Snackbar.success(t('common.uploadSucMsg'))
  132. }
  133. // 提交 企业注册
  134. const handleCommit = async () => {
  135. // 广州辞图科技有限公司
  136. const { valid } = await CtFormRef.value.formRef.validate()
  137. if (!valid) return
  138. const businessLicenseUrl = licenseUrl.value
  139. if (!businessLicenseUrl) {
  140. fileVerify.value = true
  141. return
  142. }
  143. const baseInfo = {}
  144. formItems.value.options.forEach(e => { baseInfo[e.key] = e.value })
  145. await enterpriseRegisterApply({ ...baseInfo, businessLicenseUrl })
  146. Snackbar.success(t('common.submittedSuccessfully'))
  147. router.push({ path: '/enterprise/inReview' })
  148. // 暂时自动跳转
  149. setTimeout(() => {
  150. router.push({ path: '/enterprise' })
  151. }, 8000);
  152. }
  153. </script>
  154. <style lang="scss" scoped>
  155. .CtFormClass {
  156. margin: 0 auto;
  157. }
  158. .note {
  159. color: #666;
  160. font-size: 14px;
  161. line-height: 32px;
  162. }
  163. .file-box {
  164. display: flex;
  165. flex-wrap: wrap; /* 允许换行 */
  166. width: 100%; /* 设置容器宽度 */
  167. .file-item {
  168. height: 80px;
  169. width: 100px;
  170. border-radius: 5px;
  171. margin-right: 8px;
  172. margin-top: 12px;
  173. // border: 1px solid rgb(188, 188, 188);
  174. border: 1px solid rgba(188, 188, 188, 0.5);
  175. }
  176. .file-input-box {
  177. position: relative;
  178. border: 1px solid rgb(188, 188, 188);
  179. cursor: pointer;
  180. .icon {
  181. position: absolute;
  182. top: 45%;
  183. left: 50%;
  184. transform: translate(-50%, -50%);
  185. color: #999;
  186. }
  187. }
  188. // 验证是否为空
  189. .verifyAct {
  190. color: #fe574a;
  191. border: 1px solid #fe574a;
  192. .icon { color: #fe574a; }
  193. }
  194. }
  195. </style>