feat: 创建企业逻辑对接
This commit is contained in:
@ -277,18 +277,23 @@ const onTabChange = () => {
|
||||
const getProfileInfo = async () => {
|
||||
const { code, data } = await fetchProfileInfo();
|
||||
if (code === 200) {
|
||||
let enterprises = data['enterprises'];
|
||||
mobileNumber.value = data['mobile'];
|
||||
accounts.value = enterprises;
|
||||
// 已开通
|
||||
if (data.primary_enterprise?.subscribe_status === 1) {
|
||||
const enterprises = data['enterprises'];
|
||||
mobileNumber.value = data['mobile'];
|
||||
accounts.value = enterprises;
|
||||
|
||||
if (enterprises.length > 0) {
|
||||
enterpriseStore.setEnterpriseInfo(data.enterprises[0]);
|
||||
if (enterprises.length === 1) {
|
||||
handleUserLogin();
|
||||
} else {
|
||||
// 多个企业时候需要弹窗让用户选择企业
|
||||
selectAccountModalRef.value.open();
|
||||
if (enterprises.length > 0) {
|
||||
enterpriseStore.setEnterpriseInfo(data.enterprises[0]);
|
||||
if (enterprises.length === 1) {
|
||||
handleUserLogin();
|
||||
} else {
|
||||
// 多个企业时候需要弹窗让用户选择企业
|
||||
selectAccountModalRef.value.open();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
router.push({name: 'Trial'})
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -312,7 +317,6 @@ const handleSubmit = async () => {
|
||||
const _fn = isCaptchaLogin.value ? fetchAuthorizationsCaptcha : postLoginPassword;
|
||||
const { code, data, message: errorInfo } = await _fn(loginForm);
|
||||
|
||||
console.log(code, errorInfo);
|
||||
if (code === 10001) {
|
||||
errMsg.value = errorInfo;
|
||||
return;
|
||||
|
||||
@ -293,19 +293,24 @@ const handleVerificationSubmit = async () => {
|
||||
const getProfileInfo = async () => {
|
||||
const { code, data } = await fetchProfileInfo();
|
||||
if (code === 200) {
|
||||
let enterprises = data['enterprises'];
|
||||
mobileNumber.value = data['mobile'];
|
||||
accounts.value = enterprises;
|
||||
// 已开通
|
||||
if (data.primary_enterprise?.subscribe_status === 1) {
|
||||
const enterprises = data['enterprises'];
|
||||
mobileNumber.value = data['mobile'];
|
||||
accounts.value = enterprises;
|
||||
|
||||
if (enterprises.length > 0) {
|
||||
enterpriseStore.setEnterpriseInfo(data.enterprises[0]);
|
||||
if (enterprises.length === 1) {
|
||||
setTimeout(() => {
|
||||
handleUserLogin();
|
||||
}, 1500);
|
||||
} else {
|
||||
selectAccountModalRef.value.open();
|
||||
if (enterprises.length > 0) {
|
||||
enterpriseStore.setEnterpriseInfo(data.enterprises[0]);
|
||||
if (enterprises.length === 1) {
|
||||
setTimeout(() => {
|
||||
handleUserLogin();
|
||||
}, 1500);
|
||||
} else {
|
||||
selectAccountModalRef.value.open();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
router.push({name: 'Trial'})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<Layout.Header class="header-wrap">
|
||||
<div class="h-full px-24px">
|
||||
<div class="w-full h-full relative flex justify-between">
|
||||
<div class="flex items-center cursor-pointer" @click="handleUserHome">
|
||||
<div class="flex items-center">
|
||||
<img src="@/assets/img/icon-logo.png" alt="" width="96" height="24" />
|
||||
</div>
|
||||
<RightSide />
|
||||
@ -13,7 +13,7 @@
|
||||
<Layout class="flex trial-content items-center">
|
||||
<div class="w-800px">
|
||||
<!-- 未建联 -->
|
||||
<section class="w-full" v-if="status === 1">
|
||||
<section class="w-full" v-if="!primary_enterprise">
|
||||
<div class="rounded-16px mb-16px bg-#fff px-24px py-16px flex justify-between">
|
||||
<div class="flex items-center">
|
||||
<span class="cts !text-18px !lh-26px !color-#000 mr-8px">申请试用</span>
|
||||
@ -25,18 +25,18 @@
|
||||
<div class="rounded-16px mb-16px bg-#fff p-24px">
|
||||
<p class="cts !text-16px !lh-24px !color-#000 mb-32px">基本信息</p>
|
||||
<Form ref="formRef" :model="formData" :rules="formRules" layout="vertical" class="w-full form-wrap">
|
||||
<FormItem name="name" label="联系人">
|
||||
<FormItem name="contact" label="联系人">
|
||||
<Input
|
||||
v-model:value="formData.name"
|
||||
v-model:value="formData.contact"
|
||||
placeholder="请输入您的姓名"
|
||||
size="large"
|
||||
allowClear
|
||||
class="w-500px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem name="company_name" label="公司名称">
|
||||
<FormItem name="name" label="公司名称">
|
||||
<Input
|
||||
v-model:value="formData.company_name"
|
||||
v-model:value="formData.name"
|
||||
placeholder="请输入您的公司名称,个人用户写无"
|
||||
size="large"
|
||||
allowClear
|
||||
@ -65,7 +65,7 @@
|
||||
</section>
|
||||
|
||||
<!-- 建立商务联系中 -->
|
||||
<section class="w-full" v-if="status === 2">
|
||||
<section class="w-full" v-if="primary_enterprise.audit_status === 1">
|
||||
<div class="rounded-16px bg-#fff px-36px pt-80px pb-60px flex flex-col items-center">
|
||||
<img :src="icon2" width="96" height="96" class="mb-8px" />
|
||||
<p class="cts !text-18px !lh-26px mb-8px">您的试用申请已提交</p>
|
||||
@ -87,7 +87,7 @@
|
||||
</section>
|
||||
|
||||
<!-- 试用到期 -->
|
||||
<section class="w-full" v-if="status === 3">
|
||||
<section class="w-full" v-if="primary_enterprise.subscribe_status === 4">
|
||||
<div class="rounded-16px bg-#fff px-36px pt-80px pb-60px flex flex-col items-center">
|
||||
<img :src="icon1" width="96" height="96" class="mb-8px" />
|
||||
<p class="cts !text-18px !lh-26px mb-8px">试用已到期</p>
|
||||
@ -115,24 +115,28 @@
|
||||
<script setup lang="ts">
|
||||
import { Layout, Form, Button, FormItem, Input, Steps } from 'ant-design-vue';
|
||||
import RightSide from '@/layouts/components/navbar/components/right-side/index.vue';
|
||||
|
||||
import { postCreateEnterprises } from '@/api/all/login';
|
||||
import { exactFormatTime } from '@/utils/tools';
|
||||
import { handleUserHome } from '@/utils/user';
|
||||
import { useUserStore } from '@/stores';
|
||||
|
||||
import icon1 from './img/icon-info.png';
|
||||
import icon2 from './img/icon-check.png';
|
||||
|
||||
type Status = 1 | 2 | 3;
|
||||
// 0-未开通,1-已开通,2-试用中,3-已到期,4-试用结束
|
||||
type Status = 0 | 1 | 2 | 3 | 4;
|
||||
|
||||
const userStore = useUserStore();
|
||||
const formRef = ref();
|
||||
const submitting = ref(false);
|
||||
const status = ref<Status>(1);
|
||||
// const status = ref<Status>(1);
|
||||
const formData = ref({
|
||||
mobile: '',
|
||||
contact: '',
|
||||
name: '',
|
||||
company_name: '',
|
||||
});
|
||||
const formRules = {
|
||||
name: {
|
||||
contact: {
|
||||
required: true,
|
||||
trigger: ['blur'],
|
||||
|
||||
@ -144,7 +148,7 @@ const formRules = {
|
||||
}
|
||||
},
|
||||
},
|
||||
company_name: {
|
||||
name: {
|
||||
required: true,
|
||||
trigger: ['blur'],
|
||||
|
||||
@ -170,11 +174,13 @@ const formRules = {
|
||||
},
|
||||
};
|
||||
|
||||
const primary_enterprise = computed(() => userStore.userInfo?.primary_enterprise);
|
||||
|
||||
const trialingStepsItems = computed(() => {
|
||||
return [
|
||||
{
|
||||
title: '提交申请',
|
||||
description: '2025/09/01 12:00:00',
|
||||
description: exactFormatTime(primary_enterprise.value?.created_at),
|
||||
},
|
||||
{
|
||||
title: '人工审核',
|
||||
@ -190,7 +196,7 @@ const trialEndStepsItems = computed(() => {
|
||||
return [
|
||||
{
|
||||
title: '提交申请',
|
||||
description: '2025/09/01 12:00:00',
|
||||
description: exactFormatTime(primary_enterprise.value?.created_at),
|
||||
},
|
||||
{
|
||||
title: '人工审核',
|
||||
@ -207,8 +213,11 @@ const handleSubmit = async () => {
|
||||
submitting.value = true;
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
console.log('验证通过');
|
||||
.then(async () => {
|
||||
const { code } = await postCreateEnterprises(formData.value);
|
||||
if (code === 200) {
|
||||
userStore.getUserInfo();
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
submitting.value = false;
|
||||
|
||||
Reference in New Issue
Block a user