Files
fe_supplier_frontend/src/pages/register/supplier/DomesticForm.tsx

311 lines
10 KiB
TypeScript
Raw Normal View History

2025-06-17 14:20:06 +08:00
/* 境内企业/机构 表单项 */
2025-07-15 10:02:33 +08:00
import React, { useEffect, useState } from 'react';
import { Form, Input, Button, Select, Upload, DatePicker, Row, Col, message, Space } from 'antd';
2025-06-17 14:20:06 +08:00
import {
MobileOutlined,
MailOutlined,
EnvironmentOutlined,
UploadOutlined,
} from '@ant-design/icons';
2025-07-15 10:02:33 +08:00
import { getDictList } from '@/servers/api/dicts';
import type { DictItem } from '@/servers/api/dicts';
2025-06-17 14:20:06 +08:00
/**
*
*/
import {
QualificationSection,
InvoiceSection,
BankAccountSection,
SurveySection,
AttachmentSection,
} from './CommonFormSections';
import { validateFileSize } from '@/utils/utils';
const { Option } = Select;
const { TextArea } = Input;
// 移除不再需要的addressOptions
interface DomesticFormProps {
form: any;
countdown: number;
handleGetCaptcha: () => void;
surveyQuestions?: API.SurveyQuestionResponse; // 本身就是数组类型
}
/**
*
*
* 使
*/
const DomesticForm: React.FC<DomesticFormProps> = ({
form,
countdown,
handleGetCaptcha,
surveyQuestions,
}) => {
2025-07-15 10:02:33 +08:00
const [contactsTypeOptions, setContactsTypeOptions] = useState<DictItem[]>([]);
2025-07-15 10:21:24 +08:00
// 企业类别
const [companyTypeOptions, setCompanyTypeOptions] = useState<DictItem[]>([]);
2025-07-15 10:02:33 +08:00
useEffect(() => {
// 从字典中 联系人身份类别contacts_type 获取数据
2025-07-15 10:21:24 +08:00
getDictList('contacts_type').then((res) => {
2025-07-15 10:02:33 +08:00
if (res.code === 200) {
setContactsTypeOptions(res.data);
}
});
2025-07-15 10:21:24 +08:00
// 企业类别
getDictList('enterprise_type').then((res) => {
if (res.code === 200) {
setCompanyTypeOptions(res.data);
}
});
2025-07-15 10:02:33 +08:00
}, []);
2025-06-17 14:20:06 +08:00
return (
<>
<div className="form-section-title"></div>
{/* 营业执照附件和有效期 */}
<Row gutter={24}>
<Col span={8}>
<Form.Item
name={['coscoSupplierBase', 'licenceAccessory']}
label="营业执照附件"
extra="pdf,jpg,jpeg,png类型的文件,大小不超过10MB"
rules={[{ required: true, message: '请上传营业执照附件' }]}
>
<Upload
name="businessLicense"
action="/api/upload"
listType="text"
maxCount={1}
beforeUpload={(file) => validateFileSize(file, 10, ['pdf', 'jpg', 'jpeg', 'png'])}
>
<Button icon={<UploadOutlined />}></Button>
</Upload>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name={['coscoSupplierBase', 'licenceDate']}
label="营业执照有效期"
rules={[{ required: false, message: '请选择营业执照有效期' }]}
>
2025-07-15 10:02:33 +08:00
<DatePicker placeholder="请选择日期" style={{ width: '100%' }} format="YYYY-MM-DD" />
2025-06-17 14:20:06 +08:00
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name={['coscoSupplierBase', 'name']}
label="企业名称"
rules={[{ required: true, message: '请输入企业名称' }]}
>
<Input placeholder="请输入企业名称" />
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="socialCreditCode"
label="统一社会信用代码"
rules={[
{ required: true, message: '请输入统一社会信用代码' },
{ pattern: /^[0-9A-HJ-NPQRTUWXY]{18}$/, message: '请输入正确的统一社会信用代码' },
]}
>
<Input placeholder="请输入正确的统一社会信用代码" />
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="legalPerson"
label="企业法定代表人"
rules={[{ required: true, message: '请输入企业法定代表人/负责人' }]}
>
<Input placeholder="张三" />
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="registeredCapital"
label="注册资本"
rules={[{ required: true, message: '请输入注册资本' }]}
>
2025-07-15 10:02:33 +08:00
<Input type="number" placeholder="请输入金额" addonBefore="人民币" addonAfter="万元" />
2025-06-17 14:20:06 +08:00
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="companyType"
2025-07-15 10:02:33 +08:00
label="企业类别"
rules={[{ required: true, message: '请选择企业类别' }]}
2025-06-17 14:20:06 +08:00
>
2025-07-15 10:21:24 +08:00
<Select
placeholder="请选择企业类别"
options={companyTypeOptions.map((item) => ({
label: item.dicName,
value: item.code,
}))}
/>
2025-06-17 14:20:06 +08:00
</Form.Item>
</Col>
2025-07-15 10:02:33 +08:00
{/* <Col span={8}>
2025-06-17 14:20:06 +08:00
<Form.Item
name="supplierType"
label="供应商类型"
rules={[{ required: true, message: '请选择供应商类型' }]}
>
<Select placeholder="请选择类型">
<Option value="manufacturer"></Option>
<Option value="agent"></Option>
<Option value="service"></Option>
<Option value="other"></Option>
</Select>
</Form.Item>
2025-07-15 10:02:33 +08:00
</Col> */}
2025-06-17 14:20:06 +08:00
<Col span={8}>
<Form.Item name="parentCompanyInfo" label="母公司/出资人">
<Input placeholder="请输入母公司或出资人信息" />
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="registeredAddress"
label="注册地址"
rules={[{ required: true, message: '请输入注册地址' }]}
>
<Input prefix={<EnvironmentOutlined />} placeholder="上海市普陀区XX路1888号" />
</Form.Item>
</Col>
<Col span={8}>
<Form.Item name="officeAddress" label="办公地址">
<Input
prefix={<EnvironmentOutlined />}
placeholder="请具体注明省、市、区、路、门牌号"
/>
</Form.Item>
</Col>
2025-06-23 10:54:39 +08:00
<Col span={8}>
2025-06-17 14:20:06 +08:00
<Form.Item
name="businessScope"
label="经营范围"
rules={[{ required: true, message: '请输入经营范围' }]}
>
<TextArea
placeholder="金融专用产品、广告传媒"
rows={2}
maxLength={200}
showCount
style={{ resize: 'none' }}
/>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="contactPerson"
label="联系人姓名"
rules={[{ required: true, message: '请输入联系人姓名' }]}
>
<Input placeholder="请输入联系人姓名" />
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="contactPhone"
label="联系人手机"
rules={[
{ required: true, message: '请输入联系人手机号' },
{ pattern: /^1[3-9]\d{9}$/, message: '请输入有效的手机号' },
]}
2025-07-15 10:21:24 +08:00
extra="该手机号用于后续联系和找回密码"
2025-06-17 14:20:06 +08:00
>
2025-07-15 10:21:24 +08:00
<Input
prefix={<MobileOutlined />}
placeholder="请输入11位手机号码"
addonAfter={
<Button
type="link"
size="small"
disabled={countdown > 0}
onClick={handleGetCaptcha}
>
{countdown > 0 ? `${countdown}s` : '获取验证码'}
</Button>
}
/>
2025-06-17 14:20:06 +08:00
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="captcha"
label="验证码"
rules={[{ required: true, message: '请输入验证码' }]}
>
2025-07-15 10:21:24 +08:00
<Input placeholder="请输入短信验证码" />
2025-06-17 14:20:06 +08:00
</Form.Item>
</Col>
2025-07-15 10:02:33 +08:00
{/* <Col span={8}>
2025-06-17 14:20:06 +08:00
<Form.Item name="contactIdType" label="联系人身份类别">
<Select placeholder="请选择类型">
<Option value="idcard"></Option>
<Option value="passport"></Option>
<Option value="other"></Option>
</Select>
</Form.Item>
2025-07-15 10:02:33 +08:00
</Col> */}
2025-06-17 14:20:06 +08:00
<Col span={8}>
2025-07-15 10:21:24 +08:00
<Form.Item label="联系人证件号码" required>
<Space.Compact size="large">
<Form.Item
name="contactIdType"
noStyle
rules={[{ required: true, message: '请选择联系人证件类型' }]}
>
2025-07-15 10:02:33 +08:00
<Select placeholder="请选择类型">
2025-07-15 10:21:24 +08:00
{contactsTypeOptions.map((item) => (
<Option key={item.code} value={item.code}>
{item.dicName}
</Option>
2025-07-15 10:02:33 +08:00
))}
</Select>
</Form.Item>
2025-07-15 10:21:24 +08:00
<Form.Item
name="contactIdNumber"
noStyle
rules={[{ required: true, message: '请填写联系人正确的身份证号' }]}
>
2025-07-15 10:02:33 +08:00
<Input placeholder="请填写联系人正确的身份证号" />
</Form.Item>
</Space.Compact>
2025-06-17 14:20:06 +08:00
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="contactEmail"
label="联系人邮箱"
rules={[
{ type: 'email', message: '请输入有效的电子邮箱' },
{ required: true, message: '请输入电子邮箱' },
]}
>
<Input prefix={<MailOutlined />} placeholder="XXX@XXX.com " />
2025-06-17 14:20:06 +08:00
</Form.Item>
</Col>
<Col span={8}>
<Form.Item name="telephone" label="固定电话">
<Input placeholder="请输入企业联系电话" />
2025-06-17 14:20:06 +08:00
</Form.Item>
</Col>
</Row>
{/* 使用通用表单组件 */}
<QualificationSection form={form} />
<InvoiceSection form={form} />
2025-07-15 10:02:33 +08:00
<BankAccountSection form={form} supplierType={'dvs'} />
2025-06-17 14:20:06 +08:00
<SurveySection form={form} surveyQuestions={surveyQuestions} />
<AttachmentSection form={form} />
</>
);
};
export default DomesticForm;