登录 个人 与 零星采购
This commit is contained in:
@ -5,6 +5,7 @@ import { Form, Button, message, Radio, Checkbox, Modal, Spin } from 'antd';
|
||||
import { HomeOutlined } from '@ant-design/icons';
|
||||
import DomesticForm from './supplier/DomesticForm';
|
||||
import ForeignForm from './supplier/ForeignForm';
|
||||
import Person from './supplier/Person';
|
||||
import { addAgent, coscoSupplierBaseAdd, fetchSurveyQuestions } from '@/servers/api/register';
|
||||
import './register.less';
|
||||
|
||||
@ -80,18 +81,30 @@ const SupplierRegister: React.FC<supplierWithInputProps> = (props) => {
|
||||
values.coscoSupplierBase = values.coscoSupplierBase || {};
|
||||
values.coscoSupplierBase.supplierType = supplierType;
|
||||
|
||||
if(supplierType === 'pe') {
|
||||
values.coscoSupplierBase.personName = values.coscoSupplierBase.name;
|
||||
values.coscoSupplierBase.personPhone = values.coscoSupplierBase.contactPhone;
|
||||
values.coscoSupplierSurveyAttachments = [{
|
||||
attachmentsType: "accessory",
|
||||
fileName: values.attachments.file.response.fileName,
|
||||
fileType: values.attachments.file.response.fileType,
|
||||
fileSize: values.attachments.file.response.fileSize,
|
||||
filePath: values.attachments.file.response.filePath,
|
||||
fileUrl: values.attachments.file.response.filePath,
|
||||
}]
|
||||
}
|
||||
console.log('供应商注册信息:', values);
|
||||
// 直接调用API supplierWithInput === true 供应商注册代录 否则 注册 accessory
|
||||
|
||||
// 直接调用API supplierWithInput === true 供应商注册代录 否则 注册
|
||||
const response = await (supplierWithInput? addAgent(values) : coscoSupplierBaseAdd(values));
|
||||
const response = await (supplierWithInput ? addAgent(values) : coscoSupplierBaseAdd(values));
|
||||
|
||||
if (response.success) {
|
||||
if(!supplierWithInput) {
|
||||
if (!supplierWithInput) {
|
||||
message.success('注册成功,请登录');
|
||||
history.push('/login');
|
||||
} else {
|
||||
message.success(`${exitId? '修改成功': '注册成功'}`);
|
||||
onOk;
|
||||
message.success(`${exitId ? '修改成功' : '注册成功'}`);
|
||||
onOk?.();
|
||||
}
|
||||
} else {
|
||||
message.error(response.message || '注册失败,请重试');
|
||||
@ -143,9 +156,13 @@ const SupplierRegister: React.FC<supplierWithInputProps> = (props) => {
|
||||
<Radio.Group onChange={handleSupplierTypeChange} buttonStyle="solid" value={supplierType}>
|
||||
<Radio.Button value="dvs">境内企业/机构</Radio.Button>
|
||||
<Radio.Button value="ovs">境外企业</Radio.Button>
|
||||
{supplierWithInput && (
|
||||
<Radio.Button value="pe">个人</Radio.Button>
|
||||
)}
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
|
||||
|
||||
{supplierType === 'dvs' ? (
|
||||
<DomesticForm
|
||||
form={form}
|
||||
@ -153,42 +170,54 @@ const SupplierRegister: React.FC<supplierWithInputProps> = (props) => {
|
||||
surveyQuestions={surveyQuestions}
|
||||
handleGetCaptcha={handleGetCaptcha}
|
||||
/>
|
||||
) : (
|
||||
) : supplierType === 'ovs' ? (
|
||||
<ForeignForm
|
||||
form={form}
|
||||
countdown={countdown}
|
||||
handleGetCaptcha={handleGetCaptcha}
|
||||
surveyQuestions={surveyQuestions}
|
||||
/>
|
||||
) : (
|
||||
<Person
|
||||
form={form}
|
||||
countdown={countdown}
|
||||
handleGetCaptcha={handleGetCaptcha}
|
||||
surveyQuestions={surveyQuestions}
|
||||
/>
|
||||
)}
|
||||
<Form.Item
|
||||
name="agreement"
|
||||
valuePropName="checked"
|
||||
labelCol={{ span: 2 }}
|
||||
wrapperCol={{ span: 19 }}
|
||||
rules={[
|
||||
{
|
||||
validator: (_, value) =>
|
||||
value
|
||||
? Promise.resolve()
|
||||
: Promise.reject(new Error('请阅读并同意注册信息承诺书')),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Checkbox>
|
||||
我已阅读并同意
|
||||
<Button
|
||||
type="link"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setModalVisible(true);
|
||||
}}
|
||||
>
|
||||
《注册信息承诺书》
|
||||
</Button>
|
||||
</Checkbox>
|
||||
</Form.Item>
|
||||
{supplierType !== 'pe' && (
|
||||
<Form.Item
|
||||
name="agreement"
|
||||
valuePropName="checked"
|
||||
labelCol={{ span: 2 }}
|
||||
wrapperCol={{ span: 19 }}
|
||||
rules={[
|
||||
{
|
||||
validator: (_, value) =>
|
||||
value
|
||||
? Promise.resolve()
|
||||
: Promise.reject(new Error('请阅读并同意注册信息承诺书')),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Checkbox>
|
||||
我已阅读并同意
|
||||
<Button
|
||||
type="link"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setModalVisible(true);
|
||||
}}
|
||||
>
|
||||
《注册信息承诺书》
|
||||
</Button>
|
||||
</Checkbox>
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
|
||||
|
||||
<Form.Item wrapperCol={{ span: 24 }}>
|
||||
<div style={{ textAlign: 'center' }}>
|
||||
<Button type="primary" htmlType="submit" loading={loading}>
|
||||
|
Reference in New Issue
Block a user