This commit is contained in:
lyp 2025-05-27 15:19:41 +08:00
parent f7f5faf597
commit 83f87eeedc
4 changed files with 346 additions and 261 deletions

View File

@ -135,11 +135,14 @@ export const bigClassList = () => aiShopRequest.get(`/aishop/api/data/listbypare
// 获取小类 // 获取小类
export const smallClassList = (id:string) => aiShopRequest.get(`/aishop/api/data/listbyparentid/8abb5b58-83d2-465c-b164-a189efee28c1/${id}`) export const smallClassList = (id:string) => aiShopRequest.get(`/aishop/api/data/listbyparentid/8abb5b58-83d2-465c-b164-a189efee28c1/${id}`)
// 下单购买APP电子软著 // 下单购买APP电子软著
export const buyAppGoods = (orderMoneyId:string) => aiShopRequest.post(`/aishop/api/apporder/pay/${orderMoneyId}`) export const buyAppGoods = (orderMoneyId:string) => aiShopRequest.post(`/aishop/api/apporder/pay/${orderMoneyId}`)
// 获取我的app电子软著订单列表 // 获取我的app电子软著订单列表
export const appOrderList = (params:any) => aiShopRequest.get(`/aishop/api/apporder/listpage-self`, { params }) export const appOrderList = (params:any) => aiShopRequest.get(`/aishop/api/apporder/listpage-self`, { params })
// 获取app电子软著详情 // 获取app电子软著详情
export const appOrderDetail = (appOrderId:any) => aiShopRequest.get(`/aishop/api/apporder/get/${appOrderId}`) export const appOrderDetail = (appOrderId:any) => aiShopRequest.get(`/aishop/api/apporder/get/${appOrderId}`)
// 生成授权书word文件
export const authorizeWord = (appOrderId:any,companyName:string) => aiShopRequest.get(`/aishop/api/apporder/create-file/SHOP04/${appOrderId}?name=${companyName}授权书&companyName=${companyName}`)
// 企业认证
export const companyAuth = (appOrderId:any,params:any) => aiShopRequest.post(`aishop/api/apporder/update/1/${appOrderId}`,{ params})
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -304,6 +304,11 @@ export default function AppEdit() {
<AppCompany <AppCompany
appOrderId={appOrderId} appOrderId={appOrderId}
companyInfo={companyInfo} companyInfo={companyInfo}
setCompanyInfo={
(val: any) => {
setCompanyInfo(val)
}
}
setEditProcess={ setEditProcess={
(num: number) => { (num: number) => {
setEditProcess(num) setEditProcess(num)

View File

@ -1,10 +1,12 @@
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import './app-company.css' import './app-company.css'
import { uploadFileUrl, showImage } from '../../../../request/request' import { uploadImageUrl, showImage } from '../../../../request/request'
import { authorizeWord, companyAuth } from '../../../../request/api'
import { import {
Button, Form, Input, message, Button, Form, Input, message,
// Select, DatePicker, // Select, DatePicker,
Upload, Image, Upload, Image,
Spin,
// Cascader // Cascader
} from "antd" } from "antd"
import { LoadingOutlined, } from '@ant-design/icons'; import { LoadingOutlined, } from '@ant-design/icons';
@ -22,18 +24,38 @@ import type { UploadProps } from 'antd';
// // pId: string; // // pId: string;
// } // }
export default function AppCompany(props: any) { export default function AppCompany(props: any) {
const [messageApi, contextHolder] = message.useMessage();
const [downLoading, setDownLoading] = useState(false)
const validateImageUrl = () => {
if (!imageUrl) {
return Promise.reject(new Error('请上传文件'));
}
return Promise.resolve();
};
const validateTextImageUrl = () => {
if (!textImageUrl) {
return Promise.reject(new Error('请上传文件'));
}
return Promise.resolve();
};
// 定义 beforeUpload 函数 // 定义 beforeUpload 函数
const beforeUpload = (file: any) => { const beforeUpload = (file: any) => {
const isJpgOrPng = ['image/jpeg', 'image/png', 'image/bmp'].includes(file.type); const isJpgOrPng = ['image/jpeg', 'image/png', 'image/bmp'].includes(file.type);
if (!isJpgOrPng) { if (!isJpgOrPng) {
message.error('只能上传 JPG、JPEG、PNG、BMP 格式的文件!'); message.error('只能上传 JPG、JPEG、PNG、BMP 格式的文件!');
form.setFieldsValue({
'companyPhoto': '',
});
} }
const isLt4M = file.size / 1024 / 1024 < 4; const isLt4M = file.size / 1024 / 1024 < 4;
if (!isLt4M) { if (!isLt4M) {
message.error('文件大小不能超过 4MB!'); message.error('文件大小不能超过 4MB!');
form.setFieldsValue({
'companyPhoto': '',
});
} }
return isJpgOrPng && isLt4M; return isJpgOrPng && isLt4M;
}; };
// type FileType = Parameters<GetProp<UploadProps, 'beforeUpload'>>[0]; // type FileType = Parameters<GetProp<UploadProps, 'beforeUpload'>>[0];
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
@ -54,13 +76,13 @@ export default function AppCompany(props: any) {
// setLoading(false); // setLoading(false);
// setImageUrl(url); // setImageUrl(url);
// }); // });
// console.log(info.file.response.data.fileId); console.log(info.file.response.data.fileId);
setLoading(false); setLoading(false);
const fileId = info.file.response.data.fileId; const fileId = info.file.response.data.fileId;
const url = showImage(fileId, false); const url = showImage(fileId, false);
setImageUrl(url); setImageUrl(url);
form.setFieldsValue({ form.setFieldsValue({
img: fileId, companyPhoto: fileId,
}) })
} }
if (info.file.status === 'error') { if (info.file.status === 'error') {
@ -69,11 +91,11 @@ export default function AppCompany(props: any) {
message.error(`上传失败`); message.error(`上传失败`);
//伤处表单name为ing的值 //伤处表单name为ing的值
form.setFieldsValue({ form.setFieldsValue({
img: '', // 将值设置为 undefined 以清除错误状态 companyPhoto: '', // 将值设置为 undefined 以清除错误状态
}) })
} }
}; };
const[textloading, setTextLoading] = useState(false); const [textloading, setTextLoading] = useState(false);
const [textImageUrl, setTextImageUrl] = useState(''); const [textImageUrl, setTextImageUrl] = useState('');
const textHandleChange: UploadProps['onChange'] = (info) => { const textHandleChange: UploadProps['onChange'] = (info) => {
if (info.file.status === 'uploading') { if (info.file.status === 'uploading') {
@ -92,7 +114,7 @@ export default function AppCompany(props: any) {
const url = showImage(fileId, false); const url = showImage(fileId, false);
setTextImageUrl(url); setTextImageUrl(url);
form.setFieldsValue({ form.setFieldsValue({
textImg: fileId, companyAuth: fileId,
}) })
} }
if (info.file.status === 'error') { if (info.file.status === 'error') {
@ -101,7 +123,7 @@ export default function AppCompany(props: any) {
message.error(`上传失败`); message.error(`上传失败`);
//伤处表单name为ing的值 //伤处表单name为ing的值
form.setFieldsValue({ form.setFieldsValue({
textImg: '', // 将值设置为 undefined 以清除错误状态 companyAuth: '', // 将值设置为 undefined 以清除错误状态
}) })
} }
}; };
@ -139,20 +161,49 @@ export default function AppCompany(props: any) {
}; };
const onFinish = (values: any) => { const onFinish = async (values: any) => {
// 处理表单提交逻辑 // 处理表单提交逻辑
console.log('表单提交成功', values); console.log('表单提交成功', values);
submitInfo(values) console.log('发过来的数据', props.companyInfo);
if (values != props.companyInfo) {
try {
setDownLoading(true)
const res = await companyAuth(props.appOrderId, {
appOrderId: props.appOrderId,
...values
})
setDownLoading(false)
console.log(res);
} catch (error: any) {
if (error.response) {
const data = error.response.data;
messageApi.open({
type: 'error',
content: data.msg ? data.msg : `${data.path}(${data.status})`,
});
} else {
console.error(error)
}
}
}
// submitInfo(values)
console.log('imageurl', imageUrl);
}; };
useEffect(() => { useEffect(() => {
// console.log('认证数据',props.companyInfo); console.log('认证数据', props.companyInfo);
if (props.companyInfo.companyName) { if (props.companyInfo.companyName) {
console.log('嘻嘻'); console.log('嘻嘻');
} }
}, [props.companyInfo]) }, [props.companyInfo])
return ( return (
<Spin tip='正在加载,请稍后...' size="small" spinning={downLoading} >
{contextHolder}
<div className='appInfoBox'> <div className='appInfoBox'>
{/* {contextHolder} */} {/* {contextHolder} */}
<div className='bigLine'></div> <div className='bigLine'></div>
@ -173,7 +224,7 @@ export default function AppCompany(props: any) {
}}> }}>
<div className='appInfoFormInput'> <div className='appInfoFormInput'>
<div className='FormInputTitle'>/<span style={{ color: 'red', }}>*</span></div> <div className='FormInputTitle'>/<span style={{ color: 'red', }}>*</span></div>
<Form.Item name="name" label="" rules={[{ required: true, message: '请输入企业/机构名称' }, <Form.Item name="companyName" label="" rules={[{ required: true, message: '请输入企业/机构名称' },
]}> ]}>
<Input <Input
@ -188,7 +239,7 @@ export default function AppCompany(props: any) {
<div className='appInfoFormInput'> <div className='appInfoFormInput'>
<div className='FormInputTitle' style={{ <div className='FormInputTitle' style={{
}}><span style={{ color: 'red', }}>*</span></div> }}><span style={{ color: 'red', }}>*</span></div>
<Form.Item name="type" label="" rules={[{ required: true, message: '请输入证件号' }, <Form.Item name="companyNumber" label="" rules={[{ required: true, message: '请输入证件号' },
]}> ]}>
<Input <Input
@ -214,29 +265,35 @@ export default function AppCompany(props: any) {
// background: 'pink', // background: 'pink',
position: 'relative', position: 'relative',
}}> }}>
<Form.Item name="img" label="" rules={[ <Form.Item name="companyPhoto" label="" rules={[
{ required: true, message: '请上传文件' }, // { required: true, message: '请上传文件' },
// { required: !imageUrl, message: '请上传文件' },
// 添加自定义验证规则 // 添加自定义验证规则
// { validator: validateUpload } // { validator: validateUpload }
{ validator: validateImageUrl }
]}> ]}>
<Upload <Upload
name='image'
showUploadList={false} showUploadList={false}
action={uploadFileUrl()} action={uploadImageUrl()}
// defaultFileList={upImgArray} // defaultFileList={upImgArray}
beforeUpload={beforeUpload} beforeUpload={beforeUpload}
onChange={handleChange} onChange={handleChange}
headers={{ 'Auth': `Bearer ${token}` }} headers={{ 'Auth': `Bearer ${token}` }}
// disabled={!!imageUrl} disabled={!!imageUrl}
// beforeUpload={beforeUpload} // beforeUpload={beforeUpload}
> >
{imageUrl ? {imageUrl ?
<div style={{ <div style={{
height: '150px', height: '150px',
width: '300px', width: '300px',
display: 'flex', justifyContent: 'center', alignItems: 'center',
border: '1px dashed #ccc',
}}> }}>
<Image src={imageUrl} style={{ width: '300px', height: '150px' }} <Image src={imageUrl} style={{ maxWidth: '298px', height: '148px' }}
preview={{ preview={{
mask: '查看', // 设置点击放大时显示的文字 mask: '查看', // 设置点击放大时显示的文字
@ -275,7 +332,7 @@ export default function AppCompany(props: any) {
onClick={() => { onClick={() => {
setImageUrl('') setImageUrl('')
form.setFieldsValue({ form.setFieldsValue({
img: '', // 将值设置为 undefined 以清除错误状态 companyPhoto: '', // 将值设置为 undefined 以清除错误状态
}) })
}} }}
></div> ></div>
@ -289,35 +346,51 @@ export default function AppCompany(props: any) {
paddingLeft: 23, paddingLeft: 23,
display: 'block', display: 'block',
}} }}
onClick={() => { onClick={async () => {
alert('下载授权书') // alert('下载授权书')
if (form.getFieldValue('companyName')) {
// console.log(form.getFieldValue('companyName'));
setDownLoading(true)
const res: any = await authorizeWord(
props.appOrderId,
form.getFieldValue('companyName'),
)
setDownLoading(false)
window.open(showImage(res.fileId, false));
console.log(res);
} else {
message.error('请完善企业/机构名称')
}
}} }}
></a> ></a>
</div> </div>
<div style={{ <div style={{
position: 'relative', position: 'relative',
}}> }}>
<Form.Item name="textImg" label="" rules={[ <Form.Item name="companyAuth" label="" rules={[
{ required: true, message: '请上传文件' }, // { required: true, message: '请上传文件' },
{ validator: validateTextImageUrl }
]}> ]}>
<Upload <Upload
name='image'
showUploadList={false} showUploadList={false}
action={uploadFileUrl()} action={uploadImageUrl()}
beforeUpload={beforeUpload} beforeUpload={beforeUpload}
onChange={textHandleChange} onChange={textHandleChange}
onRemove={() => {
}}
headers={{ 'Auth': `Bearer ${token}` }} headers={{ 'Auth': `Bearer ${token}` }}
// disabled={!!imageUrl} disabled={!!textImageUrl}
> >
{textImageUrl ? {textImageUrl ?
<div style={{ <div style={{
height: '150px', height: '150px',
width: '300px', width: '300px',
display: 'flex', justifyContent: 'center', alignItems: 'center',
border: '1px dashed #ccc',
}}> }}>
<Image src={textImageUrl} style={{ width: '300px', height: '150px' }} <Image src={textImageUrl} style={{ maxWidth: '298px', height: '148px' }}
preview={{ preview={{
mask: '查看', mask: '查看',
@ -401,5 +474,6 @@ export default function AppCompany(props: any) {
}}></Button> }}></Button>
</div> </div>
</div> </div>
</Spin>
) )
} }

View File

@ -712,7 +712,7 @@ export default function Index() {
const [sellBelongType, setSellBelongType] = useState<string | null>(null) // 所属人类型 const [sellBelongType, setSellBelongType] = useState<string | null>(null) // 所属人类型
// 更改所属人类型 // 更改所属人类型
const sellBelongTypeChange = (value: string) => { const sellBelongTypeChange = (value: string) => {
console.log(`selected ${value}`); // console.log(`selected ${value}`);
setSellBelongType(value) setSellBelongType(value)
} }
const [sellDate, setSellDate] = useState<any | null>(null) // 日期 const [sellDate, setSellDate] = useState<any | null>(null) // 日期
@ -1035,6 +1035,7 @@ export default function Index() {
} }
} }
useEffect(() => { useEffect(() => {
if (location.pathname == '/app-electron') {
nav('/app-electron', { nav('/app-electron', {
state: { state: {
appKeyWords: appKeyWords, appKeyWords: appKeyWords,
@ -1042,7 +1043,9 @@ export default function Index() {
appOrderStatus: appApplyStatus appOrderStatus: appApplyStatus
} }
}) })
}, [appKeyWords,appExamineStatus,appApplyStatus]) }
}, [appKeyWords, appExamineStatus, appApplyStatus])
// 获取电子软著可选商品列表 // 获取电子软著可选商品列表
const getAppGoodsList = async () => { const getAppGoodsList = async () => {
try { try {