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,267 +161,319 @@ 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 (
<div className='appInfoBox'> <Spin tip='正在加载,请稍后...' size="small" spinning={downLoading} >
{/* {contextHolder} */} {contextHolder}
<div className='bigLine'></div> <div className='appInfoBox'>
<div className='appInfoFormBox' style={{ {/* {contextHolder} */}
height: height <div className='bigLine'></div>
}}> <div className='appInfoFormBox' style={{
height: height
}}>
<Form form={form} onFinish={onFinish} <Form form={form} onFinish={onFinish}
onFinishFailed={() => { onFinishFailed={() => {
message.error('请完善信息') message.error('请完善信息')
}} }}
> >
<div style={{
display: 'flex',
justifyContent: 'space-between',
width: '900px',
// background: 'pink'
}}>
<div className='appInfoFormInput'>
<div className='FormInputTitle'>/<span style={{ color: 'red', }}>*</span></div>
<Form.Item name="name" label="" rules={[{ required: true, message: '请输入企业/机构名称' },
]}>
<Input
allowClear
style={{
width: '300px',
height: '42px',
}} placeholder="请输入企业/机构名称" />
</Form.Item>
</div>
<div className='appInfoFormInput'>
<div className='FormInputTitle' style={{
}}><span style={{ color: 'red', }}>*</span></div>
<Form.Item name="type" label="" rules={[{ required: true, message: '请输入证件号' },
]}>
<Input
allowClear
style={{
width: '300px',
height: '42px',
}} placeholder="请输入证件号" />
</Form.Item>
</div>
</div>
<div style={{
display: 'flex',
justifyContent: 'space-between',
width: '900px',
}}>
<div className='appInfoFormInput'>
<div className='FormInputTitle' style={{
}}><span style={{ color: 'red', }}>*</span></div>
<div style={{
// background: 'pink',
position: 'relative',
}}>
<Form.Item name="img" label="" rules={[
{ required: true, message: '请上传文件' },
// 添加自定义验证规则
// { validator: validateUpload }
]}>
<Upload
showUploadList={false}
action={uploadFileUrl()}
// defaultFileList={upImgArray}
beforeUpload={beforeUpload}
onChange={handleChange}
headers={{ 'Auth': `Bearer ${token}` }}
// disabled={!!imageUrl}
// beforeUpload={beforeUpload}
>
{imageUrl ?
<div style={{
height: '150px',
width: '300px',
}}>
<Image src={imageUrl} style={{ width: '300px', height: '150px' }}
preview={{
mask: '查看', // 设置点击放大时显示的文字
}}
/>
</div>
: <Button className='upBtn' style={{
height: '150px',
width: '300px',
border: '1px dashed #ccc',
borderRadius: '5px',
color: '#929292',
}}
disabled={loading}
>
{loading ? <span><span style={{ marginRight: 5 }}></span><LoadingOutlined /></span> :
'点击上传文件'
}
</Button>}
</Upload>
</Form.Item>
<div style={{
position: 'absolute',
right: -50,
bottom: 20,
//background:'skyblue',
padding: '5px 10px',
cursor: 'pointer',
color: 'red',
display: imageUrl ? 'block' : 'none',
}}
onClick={() => {
setImageUrl('')
form.setFieldsValue({
img: '', // 将值设置为 undefined 以清除错误状态
})
}}
></div>
</div>
</div>
<div className='appInfoFormInput'>
<div className='FormInputTitle' style={{
}}><span style={{ color: 'red', }}>*</span>
<a style={{
textAlign: 'center',
paddingLeft: 23,
display: 'block',
}}
onClick={() => {
alert('下载授权书')
}}
></a>
</div>
<div style={{
position: 'relative',
}}>
<Form.Item name="textImg" label="" rules={[
{ required: true, message: '请上传文件' },
]}>
<Upload
showUploadList={false}
action={uploadFileUrl()}
beforeUpload={beforeUpload}
onChange={textHandleChange}
onRemove={() => {
}}
headers={{ 'Auth': `Bearer ${token}` }}
// disabled={!!imageUrl}
>
{textImageUrl ?
<div style={{
height: '150px',
width: '300px',
}}>
<Image src={textImageUrl} style={{ width: '300px', height: '150px' }}
preview={{
mask: '查看',
}}
/>
</div>
: <Button className='upBtn' style={{
height: '150px',
width: '300px',
border: '1px dashed #ccc',
borderRadius: '5px',
color: '#929292',
}}
disabled={textloading}
>
{textloading ? <span><span style={{ marginRight: 5 }}></span><LoadingOutlined /></span> :
'点击上传文件'
}
</Button>}
</Upload>
</Form.Item>
<div style={{
position: 'absolute',
right: -50,
bottom: 20,
//background:'skyblue',
padding: '5px 10px',
cursor: 'pointer',
color: 'red',
display: textImageUrl ? 'block' : 'none',
}}
onClick={() => {
setTextImageUrl('')
form.setFieldsValue({
textImg: '', // 将值设置为 undefined 以清除错误状态
})
}}
></div>
</div>
</div>
</div>
<div style={{
display: 'flex',
color: 'red',
justifyContent: 'center',
// paddingBottom: '20px',
}}>
<div style={{
marginRight: '10px',
}}>:</div>
<div style={{ <div style={{
display: 'flex', display: 'flex',
flexDirection: 'column', justifyContent: 'space-between',
alignItems: 'flex-start', width: '900px',
// background: 'pink'
}}> }}>
<div>1.,,</div> <div className='appInfoFormInput'>
<div>2.4MB的图片(JPGJPEGPNGBMP)</div> <div className='FormInputTitle'>/<span style={{ color: 'red', }}>*</span></div>
<Form.Item name="companyName" label="" rules={[{ required: true, message: '请输入企业/机构名称' },
]}>
<Input
allowClear
style={{
width: '300px',
height: '42px',
}} placeholder="请输入企业/机构名称" />
</Form.Item>
</div>
<div className='appInfoFormInput'>
<div className='FormInputTitle' style={{
}}><span style={{ color: 'red', }}>*</span></div>
<Form.Item name="companyNumber" label="" rules={[{ required: true, message: '请输入证件号' },
]}>
<Input
allowClear
style={{
width: '300px',
height: '42px',
}} placeholder="请输入证件号" />
</Form.Item>
</div>
</div> </div>
</div>
</Form> <div style={{
display: 'flex',
justifyContent: 'space-between',
width: '900px',
}}>
<div className='appInfoFormInput'>
<div className='FormInputTitle' style={{
}}><span style={{ color: 'red', }}>*</span></div>
<div style={{
// background: 'pink',
position: 'relative',
}}>
<Form.Item name="companyPhoto" label="" rules={[
// { required: true, message: '请上传文件' },
// { required: !imageUrl, message: '请上传文件' },
// 添加自定义验证规则
// { validator: validateUpload }
{ validator: validateImageUrl }
]}>
<Upload
name='image'
showUploadList={false}
action={uploadImageUrl()}
// defaultFileList={upImgArray}
beforeUpload={beforeUpload}
onChange={handleChange}
headers={{ 'Auth': `Bearer ${token}` }}
disabled={!!imageUrl}
// beforeUpload={beforeUpload}
>
{imageUrl ?
<div style={{
height: '150px',
width: '300px',
display: 'flex', justifyContent: 'center', alignItems: 'center',
border: '1px dashed #ccc',
}}>
<Image src={imageUrl} style={{ maxWidth: '298px', height: '148px' }}
preview={{
mask: '查看', // 设置点击放大时显示的文字
}}
/>
</div>
: <Button className='upBtn' style={{
height: '150px',
width: '300px',
border: '1px dashed #ccc',
borderRadius: '5px',
color: '#929292',
}}
disabled={loading}
>
{loading ? <span><span style={{ marginRight: 5 }}></span><LoadingOutlined /></span> :
'点击上传文件'
}
</Button>}
</Upload>
</Form.Item>
<div style={{
position: 'absolute',
right: -50,
bottom: 20,
//background:'skyblue',
padding: '5px 10px',
cursor: 'pointer',
color: 'red',
display: imageUrl ? 'block' : 'none',
}}
onClick={() => {
setImageUrl('')
form.setFieldsValue({
companyPhoto: '', // 将值设置为 undefined 以清除错误状态
})
}}
></div>
</div>
</div>
<div className='appInfoFormInput'>
<div className='FormInputTitle' style={{
}}><span style={{ color: 'red', }}>*</span>
<a style={{
textAlign: 'center',
paddingLeft: 23,
display: 'block',
}}
onClick={async () => {
// 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>
</div>
<div style={{
position: 'relative',
}}>
<Form.Item name="companyAuth" label="" rules={[
// { required: true, message: '请上传文件' },
{ validator: validateTextImageUrl }
]}>
<Upload
name='image'
showUploadList={false}
action={uploadImageUrl()}
beforeUpload={beforeUpload}
onChange={textHandleChange}
headers={{ 'Auth': `Bearer ${token}` }}
disabled={!!textImageUrl}
>
{textImageUrl ?
<div style={{
height: '150px',
width: '300px',
display: 'flex', justifyContent: 'center', alignItems: 'center',
border: '1px dashed #ccc',
}}>
<Image src={textImageUrl} style={{ maxWidth: '298px', height: '148px' }}
preview={{
mask: '查看',
}}
/>
</div>
: <Button className='upBtn' style={{
height: '150px',
width: '300px',
border: '1px dashed #ccc',
borderRadius: '5px',
color: '#929292',
}}
disabled={textloading}
>
{textloading ? <span><span style={{ marginRight: 5 }}></span><LoadingOutlined /></span> :
'点击上传文件'
}
</Button>}
</Upload>
</Form.Item>
<div style={{
position: 'absolute',
right: -50,
bottom: 20,
//background:'skyblue',
padding: '5px 10px',
cursor: 'pointer',
color: 'red',
display: textImageUrl ? 'block' : 'none',
}}
onClick={() => {
setTextImageUrl('')
form.setFieldsValue({
textImg: '', // 将值设置为 undefined 以清除错误状态
})
}}
></div>
</div>
</div>
</div>
<div style={{
display: 'flex',
color: 'red',
justifyContent: 'center',
// paddingBottom: '20px',
}}>
<div style={{
marginRight: '10px',
}}>:</div>
<div style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'flex-start',
}}>
<div>1.,,</div>
<div>2.4MB的图片(JPGJPEGPNGBMP)</div>
</div>
</div>
</Form>
</div>
<div className='bigLine'></div>
<div className='nextBtnBxo'>
<Button
style={{
width: '235px',
height: '46px',
borderRadius: '5px',
}}
type='primary'
onClick={() => {
handleSubmit()
}}></Button>
</div>
</div> </div>
</Spin>
<div className='bigLine'></div>
<div className='nextBtnBxo'>
<Button
style={{
width: '235px',
height: '46px',
borderRadius: '5px',
}}
type='primary'
onClick={() => {
handleSubmit()
}}></Button>
</div>
</div>
) )
} }

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,14 +1035,17 @@ export default function Index() {
} }
} }
useEffect(() => { useEffect(() => {
nav('/app-electron', { if (location.pathname == '/app-electron') {
state: { nav('/app-electron', {
appKeyWords: appKeyWords, state: {
checkStatus: appExamineStatus, appKeyWords: appKeyWords,
appOrderStatus: appApplyStatus checkStatus: appExamineStatus,
} appOrderStatus: appApplyStatus
}) }
}, [appKeyWords,appExamineStatus,appApplyStatus]) })
}
}, [appKeyWords, appExamineStatus, appApplyStatus])
// 获取电子软著可选商品列表 // 获取电子软著可选商品列表
const getAppGoodsList = async () => { const getAppGoodsList = async () => {
try { try {