| | |
| | | reactive, |
| | | computed, |
| | | ref, |
| | | h, |
| | | onMounted, |
| | | defineAsyncComponent, |
| | | onUnmounted, |
| | |
| | | } from "@/api/register/index"; |
| | | import { cloneDeep } from "@pureadmin/utils"; |
| | | import { changeCusExtend } from "@/api/mine"; |
| | | |
| | | import agreement from "../component/agreement.vue"; |
| | | const route = useRoute(); |
| | | export function useRegister() { |
| | | const isLoading = ref(false); |
| | |
| | | isShowPassword: false, |
| | | ruleForm: { |
| | | id: null, // 主键Id,可为空 |
| | | enterpriseType: "", // 企业类型,不可空,最小长度1 |
| | | enterpriseType: [], // 企业类型,不可空,最小长度1 |
| | | exRoleCode: "", // 主体角色代码,不可空,最小长度1 |
| | | transactionCode: "", // 交易主体代码(同角色代码exRoleCode,不可空,最小长度1) |
| | | businessLicense: "", // 营业执照文件路径,不可空,最小长度1 |
| | |
| | | |
| | | // 验证码区域文字说明 |
| | | const spanRef = ref(); |
| | | |
| | | const uploadSFZ = ref(); |
| | | async function sendValidationCode() { |
| | | if (!state.ruleForm.operatorPhone) { |
| | | return message("请先输入业务经办人联系电话", { type: "warning" }); |
| | |
| | | async function sumbitData(formEl: FormInstance | undefined) { |
| | | if (!formEl) return; |
| | | await formEl.validate((valid, fields) => { |
| | | router.replace({ |
| | | path: "/RegisterSucess", |
| | | query: { |
| | | code: state.ruleForm.exRoleCode |
| | | } |
| | | }); |
| | | if (valid && state.checkedAgree) { |
| | | addDialog({ |
| | | width: "20%", |
| | | title: "确认信息", |
| | | contentRenderer: () => ( |
| | | <p> |
| | | 请您认真核对填报的资料是否正确,如因填报错误影响后续投标等操作,平台不承担任何责任,所有后果需要自行承担,请您谨慎填写! |
| | | </p> |
| | | ), // jsx 语法 (注意在.vue文件启用jsx语法,需要在script开启lang="tsx") |
| | | closeCallBack: ({ options, args }) => { |
| | | // options.props 是响应式的 |
| | | // const { formInline } = options.props as FormProps; |
| | | // const text = `姓名:${formInline.user} 城市:${formInline.region}`; |
| | | if (args?.command === "cancel") { |
| | | // 您点击了取消按钮 |
| | | // active.value -= 1; |
| | | } else if (args?.command === "sure") { |
| | | state.ruleForm.account = state.ruleForm.operatorPhone; |
| | | const obj = cloneDeep(state.ruleForm); |
| | | obj.enterpriseType = state.ruleForm.enterpriseType.join(","); |
| | | register(obj).then(res => { |
| | | if (res?.code == 200) { |
| | | message("注册成功!", { type: "success" }); |
| | | router.replace({ |
| | | path: "/RegisterSucess", |
| | | query: { |
| | | code: obj.exRoleCode |
| | | } |
| | | }); |
| | | } else { |
| | | message(res?.message, { type: "warning" }); |
| | | } |
| | | }); |
| | | } else { |
| | | if (valid) { |
| | | if (state.checkedAgree) { |
| | | addDialog({ |
| | | width: "20%", |
| | | title: "确认信息", |
| | | contentRenderer: () => ( |
| | | <p> |
| | | 请您认真核对填报的资料是否正确,如因填报错误影响后续投标等操作,平台不承担任何责任,所有后果需要自行承担,请您谨慎填写! |
| | | </p> |
| | | ), // jsx 语法 (注意在.vue文件启用jsx语法,需要在script开启lang="tsx") |
| | | closeCallBack: ({ options, args }) => { |
| | | if (args?.command === "cancel") { |
| | | // 您点击了取消按钮 |
| | | } else if (args?.command === "sure") { |
| | | state.ruleForm.account = state.ruleForm.operatorPhone; |
| | | const obj = cloneDeep(state.ruleForm); |
| | | obj.enterpriseType = state.ruleForm.enterpriseType.join(","); |
| | | register(obj).then(res => { |
| | | if (res?.code == 200) { |
| | | message("注册成功!", { type: "success" }); |
| | | router.replace({ |
| | | path: "/RegisterSucess", |
| | | query: { |
| | | code: obj.exRoleCode |
| | | } |
| | | }); |
| | | } else { |
| | | message(res?.message, { type: "warning" }); |
| | | } |
| | | }); |
| | | } else { |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | message("请勾选用户协议", { type: "warning" }); |
| | | } |
| | | } else { |
| | | const fail = []; |
| | | for (const key in fields) { |
| | | fail.push(fields[key][0].message); |
| | | } |
| | | message(fail[0], { |
| | | type: "warning" |
| | | }); |
| | | return; |
| | | } else message("请勾选用户协议", { type: "warning" }); |
| | | } |
| | | }); |
| | | } |
| | | function handleAvatarSuccess( |
| | |
| | | if (response.code == "200") { |
| | | // state.ruleForm.businessLicense = URL.createObjectURL(uploadFile.raw!); |
| | | const res = response.result; |
| | | // if (res.info.Name !== state.ruleForm.enterpriseName) { |
| | | // message("请上传法定代表人身份证!", { type: "error" }); |
| | | // } else { |
| | | state.ruleForm.legalRepresentativeIdCard = res.url; // 法定代表人身份证文件路径 |
| | | state.ruleForm.legalRepresentativeIdNumber = res.info.IdNum; // 法定代表人身份证号码 |
| | | // } |
| | | } else { |
| | | message(response.message, { |
| | | type: "error" |
| | |
| | | return resolve([]); |
| | | } |
| | | } |
| | | function openAgreement() { |
| | | addDialog({ |
| | | width: "40%", |
| | | title: "确认信息", |
| | | contentRenderer: () => h(agreement), // jsx 语法 (注意在.vue文件启用jsx语法,需要在script开启lang="tsx") |
| | | closeCallBack: ({ options, args }) => { |
| | | if (args?.command === "cancel") { |
| | | // 您点击了取消按钮 |
| | | } else if (args?.command === "sure") { |
| | | } else { |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | // 去登录 |
| | | function toLogin() { |
| | | router.push({ name: "Login" }); |
| | | } |
| | | return { |
| | | state, |
| | | resetForm, |
| | |
| | | getCaptcha, |
| | | ruleFormRef, |
| | | spanRef, |
| | | uploadSFZ, |
| | | isLoading, |
| | | beforeAvatarUpload, |
| | | handleAvatarSuccessOperator, |
| | | handleAvatarSuccessLegalRepresentative, |
| | | sumbitData, |
| | | handleAvatarSuccess, |
| | | loadNode, |
| | | handlebankAccountIMG |
| | | handlebankAccountIMG, |
| | | openAgreement, |
| | | toLogin |
| | | }; |
| | | } |