|
@@ -15,27 +15,30 @@
|
|
|
<!-- 标题 -->
|
|
|
<div class="mb-10 mt-n8" style="font-size: 22px; font-weight: bold; text-align: center;">{{ $t('enterprise.registeringNewEnterprise') }}</div>
|
|
|
<CtForm ref="CtFormRef" :items="formItems" style="width: 100%;">
|
|
|
- <template #prepare>
|
|
|
- <v-checkbox
|
|
|
- v-model="isPrepare"
|
|
|
- label="筹建中"
|
|
|
- color="primary"
|
|
|
- class="ml-1"
|
|
|
- style="width: 150px; max-height: 38px;"
|
|
|
- @change="isPrepareChange"
|
|
|
- ></v-checkbox>
|
|
|
+ <template #businessLicense>
|
|
|
+ <!-- 上传照片 -->
|
|
|
+ <div class="d-flex flex-column mb-6">
|
|
|
+ <div style="color: var(--color-999);">
|
|
|
+ <span v-if="!prepareValue" class="mr-1" style="color: var(--v-error-base);">*</span>
|
|
|
+ <span>上传营业执照</span>
|
|
|
+ <span>支持jpg、jpeg、png格式,图片大小不得超过10M</span>
|
|
|
+ </div>
|
|
|
+ <div class="file-box">
|
|
|
+ <Img
|
|
|
+ class="mt-3"
|
|
|
+ v-model="licenseUrl"
|
|
|
+ tips="上传图片"
|
|
|
+ :showSnackbar="false"
|
|
|
+ @imgClick="showPreview = !showPreview"
|
|
|
+ :showCursor="true"
|
|
|
+ @success="handleUploadImg"
|
|
|
+ @delete="handleDeleteImg"
|
|
|
+ ></Img>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</CtForm>
|
|
|
- <!-- 上传照片 -->
|
|
|
- <div style="color: var(--color-999);">
|
|
|
- <span v-if="!isPrepare" class="mr-1" style="color: var(--v-error-base);">*</span>
|
|
|
- <span>上传营业执照</span>
|
|
|
- <span>支持jpg、jpeg、png格式,图片大小不得超过10M</span>
|
|
|
- </div>
|
|
|
- <div class="file-box">
|
|
|
- <Img class="mt-3" :value="licenseUrl" tips="上传图片" @imgClick="showPreview = !showPreview" :showCursor="true" @success="val => licenseUrl = val" @delete="licenseUrl = ''"></Img>
|
|
|
- </div>
|
|
|
- <div class="note mt-10">
|
|
|
+ <div class="note">
|
|
|
<h4>注意事项:</h4>
|
|
|
<span>企业名称为对外展示的企业名称,建议填写公司营业执照上的名称,请区分总公司和分公司</span>
|
|
|
</div>
|
|
@@ -52,24 +55,28 @@
|
|
|
</div>
|
|
|
</v-card>
|
|
|
<PreviewImg v-if="showPreview" :current="current" :list="[licenseUrl]" @close="showPreview = !showPreview"></PreviewImg>
|
|
|
+
|
|
|
+ <Loading :visible="loading"></Loading>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+defineOptions({name: 'enterprise-enterpriseRegister-register'})
|
|
|
import CtForm from '@/components/CtForm'
|
|
|
import Snackbar from '@/plugins/snackbar'
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
import { useRouter } from 'vue-router'; const router = useRouter()
|
|
|
import { enterpriseRegisterApply } from '@/api/personal/user'
|
|
|
-import { onMounted, ref } from 'vue';
|
|
|
+import { onMounted, ref, computed } from 'vue';
|
|
|
import { checkEmail } from '@/utils/validate'
|
|
|
-defineOptions({name: 'enterprise-enterpriseRegister-register'})
|
|
|
+import { getBusinessLicenseOCR } from '@/api/common'
|
|
|
+
|
|
|
const { t } = useI18n()
|
|
|
const CtFormRef = ref()
|
|
|
-
|
|
|
const loginLoading = ref(false)
|
|
|
|
|
|
// 图片预览
|
|
|
+const loading = ref(false)
|
|
|
const showPreview = ref(false)
|
|
|
const current = ref(0)
|
|
|
const email = localStorage.getItem('loginAccount') || ''
|
|
@@ -86,12 +93,11 @@ import { useRoute } from 'vue-router'; const route = useRoute()
|
|
|
const pageType = route?.query?.type || '' // type: noLoginToRegister:->登录页注册企业
|
|
|
|
|
|
// 是否筹建中
|
|
|
-const isPrepare = ref(false)
|
|
|
const isPrepareChange = () => {
|
|
|
const code = formItems.value.options.find(e => e.key === 'code')
|
|
|
if (code) {
|
|
|
- code.label = isPrepare.value ? '企业统一社会信用代码' : '企业统一社会信用代码 *'
|
|
|
- code.rules = isPrepare.value ? [] : [v => !!v || '请输入企业统一社会信用代码']
|
|
|
+ code.label = prepareValue.value ? '企业统一社会信用代码' : '企业统一社会信用代码 *'
|
|
|
+ code.rules = prepareValue.value ? [] : [v => !!v || '请输入企业统一社会信用代码']
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -109,6 +115,21 @@ const handlePassword = () => {
|
|
|
|
|
|
const formItems = ref({
|
|
|
options: [
|
|
|
+ {
|
|
|
+ type: 'ifRadio',
|
|
|
+ key: 'prepare',
|
|
|
+ value: false,
|
|
|
+ label: '是否筹建中 *',
|
|
|
+ width: 100,
|
|
|
+ items: [
|
|
|
+ { label: '是', value: true },
|
|
|
+ { label: '否', value: false }
|
|
|
+ ],
|
|
|
+ change: isPrepareChange
|
|
|
+ },
|
|
|
+ {
|
|
|
+ slotName: 'businessLicense'
|
|
|
+ },
|
|
|
{
|
|
|
type: 'text',
|
|
|
key: 'name',
|
|
@@ -118,7 +139,6 @@ const formItems = ref({
|
|
|
rules: [v => !!v || '请输入企业名称']
|
|
|
},
|
|
|
{
|
|
|
- slotName: 'prepare',
|
|
|
type: 'text',
|
|
|
key: 'code',
|
|
|
value: '',
|
|
@@ -129,23 +149,21 @@ const formItems = ref({
|
|
|
{
|
|
|
type: 'text',
|
|
|
key: 'contactName',
|
|
|
- value: '',
|
|
|
+ value: '林小姐',
|
|
|
label: '联系人姓名 *',
|
|
|
- // col: 6,
|
|
|
- // flexStyle: 'mr-3',
|
|
|
rules: [v => !!v || '请输入联系人姓名']
|
|
|
},
|
|
|
{
|
|
|
type: 'phoneNumber',
|
|
|
key: 'phone',
|
|
|
- value: '',
|
|
|
+ value: '13229740091',
|
|
|
label: '联系电话 *',
|
|
|
rules: [v => !!v || '请输入联系电话']
|
|
|
},
|
|
|
{
|
|
|
type: 'text',
|
|
|
key: 'email',
|
|
|
- value: email ? email : '',
|
|
|
+ value: email ? email : 'lin@qq.com',
|
|
|
label: '企业邮箱 *',
|
|
|
rules: [
|
|
|
value => {
|
|
@@ -161,7 +179,7 @@ const formItems = ref({
|
|
|
{
|
|
|
type: 'password',
|
|
|
key: 'password',
|
|
|
- value: '',
|
|
|
+ value: 'Citu123456',
|
|
|
appendInnerIcon: 'mdi-eye-off-outline',
|
|
|
label: '账户登录密码 *',
|
|
|
placeholder: '请输入账户登录密码',
|
|
@@ -180,7 +198,7 @@ const formItems = ref({
|
|
|
{
|
|
|
type: 'password',
|
|
|
key: 'passwordConfirm',
|
|
|
- value: '',
|
|
|
+ value: 'Citu123456',
|
|
|
appendInnerIcon: 'mdi-eye-off-outline',
|
|
|
label: '请再次输入账户登录密码 *',
|
|
|
placeholder: '请再次输入账户登录密码',
|
|
@@ -209,8 +227,40 @@ const formItems = ref({
|
|
|
]
|
|
|
})
|
|
|
|
|
|
+// 是否筹建中
|
|
|
+const prepareValue = computed(() => {
|
|
|
+ return formItems.value.options.find(e => e.key === 'prepare').value
|
|
|
+})
|
|
|
+
|
|
|
+// 识别营业执照图片
|
|
|
+const business = ref({})
|
|
|
+const getOcr = async () => {
|
|
|
+ loading.value = true
|
|
|
+ try {
|
|
|
+ const data = await getBusinessLicenseOCR(licenseUrl.value)
|
|
|
+ if (data && Object.keys(data).length) {
|
|
|
+ formItems.value.options.find(e => e.key === 'code').value = data.code
|
|
|
+ formItems.value.options.find(e => e.key === 'name').value = data.name
|
|
|
+ business.value = data
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 上传
|
|
|
let licenseUrl = ref('')
|
|
|
+const handleUploadImg = (url) => {
|
|
|
+ licenseUrl.value = url
|
|
|
+ if (licenseUrl.value) getOcr()
|
|
|
+}
|
|
|
+
|
|
|
+const handleDeleteImg = () => {
|
|
|
+ licenseUrl.value = ''
|
|
|
+ business.value = {}
|
|
|
+ formItems.value.options.find(e => e.key === 'code').value = ''
|
|
|
+ formItems.value.options.find(e => e.key === 'name').value = ''
|
|
|
+}
|
|
|
|
|
|
// 提交 企业注册
|
|
|
const handleCommit = async () => {
|
|
@@ -218,14 +268,13 @@ const handleCommit = async () => {
|
|
|
if (!valid) return
|
|
|
|
|
|
const businessLicenseUrl = licenseUrl.value;
|
|
|
- if (!isPrepare.value && !businessLicenseUrl) return Snackbar.warning('请上传营业执照图片')
|
|
|
+ if (!prepareValue.value && !businessLicenseUrl) return Snackbar.warning('请上传营业执照图片')
|
|
|
const params = {
|
|
|
businessLicenseUrl,
|
|
|
- prepare: isPrepare.value,
|
|
|
+ prepare: prepareValue.value,
|
|
|
}
|
|
|
formItems.value.options.forEach(e => { params[e.key] = e.value })
|
|
|
- // 邮箱登录密码校验
|
|
|
- // if (params.password !== params.passwordConfirm) return Snackbar.warning('两次输入的密码不一致,请确认')
|
|
|
+ if (business.value && Object.keys(business.value).length) params.ocr = business.value
|
|
|
|
|
|
await enterpriseRegisterApply(params)
|
|
|
localStorage.removeItem('loginAccount')
|
|
@@ -240,7 +289,7 @@ const info = JSON.parse(localStorage.getItem('userApplyInfo'))
|
|
|
if (info && Object.keys(info).length && info.status === '2') {
|
|
|
failureReason.value = info?.reason || ''
|
|
|
licenseUrl.value = info?.businessLicenseUrl
|
|
|
- isPrepare.value = info?.prepare || false
|
|
|
+ // prepareValue.value = info?.prepare || false
|
|
|
isPrepareChange()
|
|
|
formItems.value.options.forEach(e => {
|
|
|
if (e.key === 'passwordConfirm') e.value = info.password
|
|
@@ -249,6 +298,7 @@ if (info && Object.keys(info).length && info.status === '2') {
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
+
|
|
|
<style lang="scss" scoped>
|
|
|
.CtFormClass {
|
|
|
margin: 0 auto;
|