Commit 3be4820d authored by 罗超's avatar 罗超

完成企业账号创建

parent eb6c7035
......@@ -35,7 +35,7 @@ class FileService {
}
}
static getImageSizeWithoutDownloading = async (url: string): Promise<{ width: number; height: number }> => {
const response = await fetch(url, { method: 'HEAD' }); // Use HEAD request to get metadata
const response = await fetch(url, { method: 'GET' }); // Use HEAD request to get metadata
const contentLength = response.headers.get('Content-Length');
if (!contentLength) {
......
......@@ -27,5 +27,15 @@ class OrderService{
let msg = {no}
return Api.Post("ppt_order_pay_status",msg)
}
static async GetActiveTenantOrderAsync():Promise<HttpResponse>{
let msg = {}
return Api.Post("ppt_get_activetenantorder",msg)
}
static async SetTentantAsync(id:string,name:string):Promise<HttpResponse>{
let msg = {id,name}
return Api.Post("travel_create_tentant",msg)
}
}
export default OrderService;
\ No newline at end of file
......@@ -70,6 +70,10 @@ export const useUserStore = defineStore('user', {
this.userInfo={}
window.location.href='/login'
},
setNewUserInfo(user:any){
this.token = user.token
this.userInfo = user.userinfo
},
async setUserPasswordLoginAsync(account:string,pwd:string,tid:string='') {
try {
let response = await UserService.PasswordLoginAsync(account,pwd,tid)
......
......@@ -194,14 +194,14 @@ const setImgs = async () => {
type: 'warning',
})
}
if(activeName.value=='4'){
if(activeName.value=='1'||activeName.value=='3' || activeName.value == '4'){
const downLoading = ElLoading.service({
lock:true,
text:'正在导入图片'
})
try {
downloadInfo = await FileService.convertNetworkToBase64Async(url)
url = downloadInfo.url
//url = downloadInfo.url
propsDatas.value.src = url
} catch (error) {}
if(downloadInfo.url == ''){
......@@ -222,7 +222,7 @@ const setImgs = async () => {
if(imgType.value==2){
if(activeName.value=='1'||activeName.value=='3' || activeName.value == '4'){
let tempSize = downloadInfo
if(activeName.value != '4') tempSize = await FileService.getImageSizeWithoutDownloading(propsDatas.value.src)
//if(activeName.value != '4') tempSize = await FileService.getImageSizeWithoutDownloading(propsDatas.value.src)
setPropsDatas(tempSize)
} else{
const image = new Image()
......
......@@ -140,7 +140,7 @@
<template v-if="!userInfo.it">
<div class="row items-center">
<div class="text-info text-small col">未加入任何企业</div>
<el-button type="primary" @click="()=>orderVisible=true" link icon="officeBuilding">立即创建企业</el-button>
<el-button type="primary" @click="createEnterpriseHandler" link icon="officeBuilding">立即创建企业</el-button>
</div>
<el-divider />
<el-menu mode="vertical">
......@@ -163,7 +163,8 @@
</div>
</div>
</div>
<OrderReview v-if="orderVisible" :default-type="2" @close="()=>orderVisible=false"></OrderReview>
<OrderReview v-if="orderVisible && activeOrderId==''" :default-type="2" @close="()=>orderVisible=false"></OrderReview>
<CreateEnterprise :order-id="activeOrderId" v-if="orderVisible && activeOrderId!=''" @close="()=>orderVisible=false"></CreateEnterprise>
</template>
<script lang="ts" setup>
......@@ -171,18 +172,23 @@ import { useUserStore } from "@/store/user";
import { storeToRefs } from "pinia";
import SearchDocument from "@/views/SellTemplate/components/SearchDocument.vue";
import UserCard from "@/components/User/UserCard.vue";
import CreateEnterprise from '@/views/components/Order/CreateEnterprise.vue'
import { Plus, Setting } from "@element-plus/icons-vue";
import { openNewBlank } from "@/utils/common";
import { useSellTemplateStore } from "@/store";
import { useRouter } from "vue-router";
import { ref } from "vue";
import OrderReview from '@/views/components/Order/Review.vue'
import { ElLoading } from "element-plus";
import OrderService from "@/services/OrderService";
import { ApiResult } from "@/configs/axios";
const { userInfo } = storeToRefs(useUserStore());
const sellStore = useSellTemplateStore()
const orderVisible = ref(false)
const router = useRouter()
const isWorkspace = ref(true)
const activeOrderId = ref('')
isWorkspace.value = !router.currentRoute.value.path.includes('/space/cp')
const openMarketHandler = (type: string = "") => {
......@@ -200,7 +206,21 @@ const openFilePosition = (playload:any)=>{
path:"/"+currentMenu
})
}
const createEnterpriseHandler = async ()=>{
const pageLoading = ElLoading.service({
lock:true,
text:'正在加载'
})
const response = await OrderService.GetActiveTenantOrderAsync()
if(response.data.resultCode == ApiResult.SUCCESS){
activeOrderId.value = response.data.data
}else{
activeOrderId.value = ''
}
pageLoading.close()
orderVisible.value=true
}
const redicetTo = (path:string)=>{
isWorkspace.value = !path.includes('/space/cp')
......
<template>
<div class="full-dialog column flex-center items-center" ref="enterpriseRef">
<div class="create-enter-box">
<div class="close-btn column items-center flex-center cusor-pointer" @click="close">
<IconClose size="0.83vw"></IconClose>
</div>
<div class="row full-width">
<div class="column flex-center items-center q-px-xl">
<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1714372736000_535.png" style="width:20vw;">
</div>
<div class="create-enter col column flex-center items-center" style="height: 30vw;">
<div class="text-weight-bold " style="font-size: 1.25vw;">创建团队/企业</div>
<div class="full-width" style="margin: 3.5vw 0;">
<div style="font-size: 0.73vw;" class="q-mb-sm">你的团队/企业名称</div>
<el-input v-model="groupName" placeholder="请输入团队/企业名称" size="large" @input="validator" input-style="background: transparent;font-family:pingfangr" />
<div class="q-mt-sm text-negative text-small" :style="{'visibility':errorMsg==''?'hidden':'visible'}">&nbsp;{{ errorMsg }}</div>
</div>
<el-button :type="groupName==''?'info':'primary'" :disabled="groupName==''" :loading="loading" size="large" @click="createTenantHandler" class="text-weight-bolder full-width pingfangr">
<span style="font-size: 14px;" :style="{'color':groupName==''?'grey':'unset'}">立即创建</span>
</el-button>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ApiResult } from "@/configs/axios";
import OrderService from "@/services/OrderService";
import { ElLoading, ElMessage } from "element-plus";
import { onMounted, ref } from "vue";
import { useUserStore } from "@/store";
const props = defineProps({
orderId: {
type: String,
required: true,
},
})
const emit = defineEmits<{
(event: 'close'): void
}>()
const useUser = useUserStore()
const enterpriseRef = ref()
const groupName = ref('')
const errorMsg = ref('')
const loading = ref(false)
const validator = ()=>{
if(groupName.value=='') errorMsg.value='请填写你的团队/企业名称'
else if(groupName.value.length<2) errorMsg.value='团队/企业名称至少需要2个字'
else errorMsg.value=''
}
const createTenantHandler = async ()=>{
validator()
if(errorMsg.value=='' && !loading.value){
loading.value=true
const response = await OrderService.SetTentantAsync(props.orderId,groupName.value)
if(response.data.resultCode==ApiResult.SUCCESS){
changeUserInfo(response.data.data)
} else {
ElMessage.error({ message:response.data.message })
}
loading.value=false
}
}
const changeUserInfo = (userInfo:any)=>{
ElLoading.service({
lock:true,
text:'正在切换新的身份信息'
})
setTimeout(() => {
useUser.setNewUserInfo(userInfo)
location.reload()
}, 1000);
}
const close = ()=> emit('close')
onMounted(()=>{
if(enterpriseRef.value){
enterpriseRef.value.click()
}
})
</script>
<style scoped>
.create-enter-box{
width: 50vw;
background: linear-gradient(90deg, #638FEB, #5921DB);
border-radius:0.52vw;
padding: 4px;
position: relative;
}
.create-enter-box .close-btn{
position: absolute;
top:-1.93vw;
right: -1.93vw;
width: 1.77vw;
height: 1.77vw;
border:2px solid #AFAFAF;
text-align: center;
color:#AFAFAF;
border-radius: 50%;
}
.create-enter-box .create-enter{
background: #FFF;
border-radius: 10px;
padding:3vw;
}
</style>
\ No newline at end of file
......@@ -51,6 +51,9 @@
<template v-if="currentProduct.price>0 && qrCode!='none'">
<QRCode :value="qrCode" size="100%" v-if="!qrLoading"></QRCode>
<QRCode value="http://www.viitto.com" size="100%" v-if="qrLoading"></QRCode>
<div class="q-mt-md flex-center row items-center">
请在 <el-countdown title="" format="mm:ss" :value="countValue" value-style="font-size:14px;color:#f89c53;" class="inline q-mx-sm" @finish="setPaymentQrCode" /> 完成支付
</div>
<div style="color: #929292;margin:0.63vw 0 1.15vw 0">使用 微信 扫码支付 支付即视为你同意 <span class="cusor-pointer text-primary">相关协议</span> 条例</div>
<div class="rounded bg-info column flex-center items-center text-dark" style="padding:1.5vw;">
<div class="text-weight-bold" style="margin-bottom: 1.2vw">实付金额</div>
......@@ -104,6 +107,7 @@ const OrderReviewRef = ref()
const orderNum = ref('')
const queryTimer = ref<any>(null)
const currentPayStatus = ref(0)
const countValue = ref(Date.now() + 1000 * 60 * 30)
const changeVersionHandler = (v:number)=>{
activeVersion.value=v
......@@ -173,6 +177,7 @@ const setPaymentQrCode = async ()=>{
if(response.data.resultCode==ApiResult.SUCCESS){
qrCode.value = response.data.data.qr
orderNum.value = response.data.data.no
countValue.value = Date.now() + 1000 * 60 * 30
beginTimerHandler()
}else{
qrCode.value='none'
......@@ -180,6 +185,7 @@ const setPaymentQrCode = async ()=>{
qrLoading.value=false
}
const close = ()=>{
stopTimerHandler()
emit('close')
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment