Commit 0f7c1776 authored by 张子雨's avatar 张子雨

feat: 接口联调

parent a07ded6e
......@@ -39,6 +39,10 @@ export const businessModel = [
{ label: '到店业务(服务类业务)', value: 3 },
];
export const signDateTypeList = [{ label: '自商品售卖起默认一年', value: 1 }];
export const legalPersonList = [{ label: '长期', value: '长期' }];
// 获取申请信息
export async function getInfo() {
const data = await apiBusinessDetail();
......@@ -49,6 +53,7 @@ export async function getInfo() {
res.customList = res.facilities.customList || [];
res.selfList = res.facilities.selfList || [];
}
res.signDateType = [res.signDateType] || [];
res.accountOpenPermitImage = res.accountOpenPermitImage
? [{ uid: 0, url: res.accountOpenPermitImage }]
: [];
......@@ -87,18 +92,28 @@ export async function getInfo() {
}
settlementType = +res.settlementType;
}
res.checked = res.legalPersonPeriod === '长期';
res.legalPerson =
res.legalPersonPeriod &&
res.legalPersonPeriod !== '长期' &&
res.legalPersonPeriod.split('-').map(item => moment(item));
// 身份证有效期处理
const date = res.legalPersonPeriod.split('-') || [];
res.legalPersonStart = date[0] && moment(date[0]);
res.legalPersonEnd = date[1] && date[1] !== '长期' ? moment(date[1]) : '';
res.checked = date[1] && date[1] === '长期' ? ['长期'] : [];
const checkboxDisabled = date[1] && date[1] === '长期';
res.businessLicensePeriod = res.businessLicensePeriod && moment(res.businessLicensePeriod);
const companyNamedis = !!res.companyName;
// 获取主营类目
let categoryList = [];
if (res.productBusiness.length) {
const dataList = await apiCategoryList(res.productBusiness);
categoryList = dataList.data;
}
this.setState({
settlementType,
businessInfo: res,
checkboxDisabled: res.checked,
checkboxDisabled,
companyNamedis,
categoryList,
mainCategoryId: res.mainCategoryId,
});
}
......
......@@ -33,6 +33,8 @@ import {
getInfo,
getBankList,
businessTypeDesc,
signDateTypeList,
legalPersonList,
} from './data';
import { validatePhone, validateEMail, validNumber } from '@/utils/validator';
import { getErrorMessage } from '@/utils/utils';
......@@ -80,17 +82,13 @@ class BusinessInfo extends Component {
checkboxDisabled: false,
mainCategoryId: null,
companyNamedis: false, // 公司名称
bankAccounts: false,
};
async componentDidMount() {
await getInfo.call(this);
getAreaAddr.call(this);
getInfo.call(this);
getServiceFacility.call(this);
getBankList.call(this);
if (this.state.businessInfo.productBusiness) {
this.getCategoryList(this.state.businessInfo.productBusiness);
}
}
// 主营类目
......@@ -102,11 +100,12 @@ class BusinessInfo extends Component {
// 长期
oncheckedChange = e => {
const str = e.toString();
this.setState({
checkboxDisabled: e.target.checked,
checkboxDisabled: str === '长期',
});
this.props.form.setFieldsValue({
legalPerson: '',
legalPersonEnd: '',
});
};
......@@ -169,10 +168,19 @@ class BusinessInfo extends Component {
info.legalPersonName = res.legalPersonName || '';
info.legalPersonIdCard = res.legalPersonIdCard || '';
} else if (type === 'idCardEmblemImage' && res.legalPersonPeriod) {
info.legalPersonPeriod = res.legalPersonPeriod
.replace(/\./g, '/')
.split('-')
.map(o => moment(o));
// 身份证有效期处理
const date = res.legalPersonPeriod.split('-') || [];
res.legalPersonStart = date[0] && moment(date[0]);
res.legalPersonEnd = date[1] && date[1] !== '长期' ? moment(date[1]) : '';
res.checked = date[1] && date[1] === '长期' ? ['长期'] : [];
const checkboxDisabled = date[1] && date[1] === '长期';
this.setState({
checkboxDisabled,
});
// info.legalPersonPeriod = res.legalPersonPeriod
// .replace(/\./g, '/')
// .split('-')
// .map(o => moment(o));
}
return {
businessInfo: Object.assign(state.businessInfo, info),
......@@ -194,7 +202,6 @@ class BusinessInfo extends Component {
// 返回
onCancel = () => {
// window.history.back();
getInfo.call(this);
};
......@@ -206,13 +213,11 @@ class BusinessInfo extends Component {
if (!err) {
const imgs = this.state.businessInfo;
obj.businessLicensePeriod = moment(obj.businessLicensePeriod).format('YYYY-MM-DD');
if (this.state.checkboxDisabled) {
obj.legalPersonPeriod = '长期';
} else {
obj.legalPersonPeriod = obj.legalPerson
.map(o => moment(o).format('YYYY/MM/DD'))
.join('-');
}
const legalPersonStart = moment(obj.legalPersonStart).format('YYYY/MM/DD');
const legalPersonEnd = this.state.checkboxDisabled
? '长期'
: moment(obj.legalPersonEnd).format('YYYY/MM/DD');
obj.legalPersonPeriod = `${legalPersonStart}-${legalPersonEnd}`;
obj.facilities = {
customList: this.state.businessInfo.customList,
selfList: obj.selfList,
......@@ -238,13 +243,10 @@ class BusinessInfo extends Component {
obj.idCardPortraitImage = imgs.idCardPortraitImage[0].url;
obj.primaryImage = imgs.primaryImage[0].url;
obj.sealImage = imgs.sealImage[0].url;
obj.differentNameAuthorizationImage =
imgs.differentNameAuthorizationImage?.length &&
imgs.differentNameAuthorizationImage[0].url;
obj.householdRegisterImage =
imgs.householdRegisterImage?.length && imgs.householdRegisterImage[0].url;
obj.icbProofImage = imgs.icbProofImage?.length && imgs.icbProofImage[0].url;
obj.brandCertificate = imgs?.brandCertificate[0]?.url || '';
obj.differentNameAuthorizationImage = imgs?.differentNameAuthorizationImage[0]?.url || '';
obj.householdRegisterImage = imgs?.householdRegisterImage[0]?.url || '';
obj.icbProofImage = imgs?.icbProofImage[0]?.url || '';
obj.applySource = 1;
obj.signDateType = 1;
......@@ -296,14 +298,13 @@ class BusinessInfo extends Component {
this.setState({
companyNamedis: !val,
});
};
// 修改银行账号
setBankAccount = () => {
const val = this.state.bankAccounts;
this.setState({
bankAccounts: !val,
});
if (!val) {
this.props.form.setFieldsValue({
companyName: this.state.businessInfo.companyName,
icbProofImage: '',
householdRegisterImage: '',
});
}
};
openMap(e, disabled) {
......@@ -321,6 +322,9 @@ class BusinessInfo extends Component {
onChangeBusinessModel = e => {
this.getCategoryList(e);
this.props.form.setFieldsValue({
mainCategoryId: '',
});
};
// 获取主营类目
......@@ -334,14 +338,7 @@ class BusinessInfo extends Component {
const {
form: { getFieldDecorator },
} = this.props;
const {
businessInfo,
type,
checkboxDisabled,
mainCategoryId,
companyNamedis,
bankAccounts,
} = this.state;
const { businessInfo, type, checkboxDisabled, mainCategoryId, companyNamedis } = this.state;
return (
<div className={styles.infoBox}>
<Form className="login-form" onSubmit={this.handleSubmit} {...formItemLayout}>
......@@ -355,7 +352,7 @@ class BusinessInfo extends Component {
})(
<Checkbox.Group
options={businessModel}
onChange={this.onChangeBusinessModel}
onChange={e => this.onChangeBusinessModel(e)}
/>,
)}
</FormItem>
......@@ -433,7 +430,7 @@ class BusinessInfo extends Component {
{getFieldDecorator('signDateType', {
rules: [{ required: true, message: '请选择签约日期' }],
initialValue: businessInfo.signDateType,
})(<Checkbox>自商品售卖起默认一年</Checkbox>)}
})(<Checkbox.Group options={signDateTypeList} />)}
</FormItem>
</Col>
</Row>
......@@ -492,6 +489,7 @@ class BusinessInfo extends Component {
filterOption={(input, option) =>
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
disabled={+businessInfo.mainCategoryId === 301008}
>
{this.state.categoryList.map(item => (
<Option value={item.id} key={item.id}>
......@@ -560,7 +558,8 @@ class BusinessInfo extends Component {
})(<Input maxLength={32} />)}
</FormItem>
</Col>
{!companyNamedis && businessInfo.companyType && businessInfo.companyType !== 2 && (
{(!companyNamedis && businessInfo.companyType && businessInfo.companyType !== 2) ||
(!companyNamedis && businessInfo?.icbProofImage?.length) ? (
<Col span={12}>
<FormItem label="工商局变更证明" labelCol={{ span: 8 }} wrapperCol={wrapperCol}>
{getFieldDecorator('icbProofImage', {
......@@ -570,9 +569,6 @@ class BusinessInfo extends Component {
<Upload
{...uploadPropsFn.call(this, {
keyName: 'icbProofImage',
type: 3,
maxSize: 1024 * 200,
maxSizeMsg: '文件大小不能超过200K',
limit: 1,
})}
fileList={businessInfo.icbProofImage}
......@@ -582,8 +578,11 @@ class BusinessInfo extends Component {
)}
</FormItem>
</Col>
) : (
''
)}
{!companyNamedis && businessInfo.companyType && businessInfo.companyType === 2 && (
{(!companyNamedis && businessInfo.companyType && businessInfo.companyType === 2) ||
(!companyNamedis && businessInfo?.householdRegisterImage?.length) ? (
<Col span={12}>
<FormItem label="户口本本人页" labelCol={{ span: 8 }} wrapperCol={wrapperCol}>
{getFieldDecorator('householdRegisterImage', {
......@@ -593,9 +592,6 @@ class BusinessInfo extends Component {
<Upload
{...uploadPropsFn.call(this, {
keyName: 'householdRegisterImage',
type: 3,
maxSize: 1024 * 200,
maxSizeMsg: '文件大小不能超过200K',
limit: 1,
})}
fileList={businessInfo.householdRegisterImage}
......@@ -605,34 +601,8 @@ class BusinessInfo extends Component {
)}
</FormItem>
</Col>
)}
{((businessInfo.differentNameAuthorizationImage &&
businessInfo.differentNameAuthorizationImage.length) ||
!companyNamedis) && (
<Col span={24}>
<FormItem
label="非同名结算授权文件"
labelCol={{ span: 4 }}
wrapperCol={wrapperCol}
>
{getFieldDecorator('differentNameAuthorizationImage', {
initialValue: businessInfo.differentNameAuthorizationImage,
})(
<Upload
{...uploadPropsFn.call(this, {
keyName: 'differentNameAuthorizationImage',
type: 3,
maxSize: 1024 * 200,
maxSizeMsg: '文件大小不能超过200K',
limit: 1,
})}
fileList={businessInfo.differentNameAuthorizationImage}
>
<UploadOutlined /> 上传文件
</Upload>,
)}
</FormItem>
</Col>
) : (
''
)}
<Col span={24}>
<FormItem label="营业执照有效期" labelCol={{ span: 4 }}>
......@@ -681,7 +651,7 @@ class BusinessInfo extends Component {
</FormItem>
</Col>
{+mainCategoryId === 301008 && (
<div>
<>
<Col span={24}>
<FormItem label="授权品牌" labelCol={{ span: 4 }}>
{getFieldDecorator('brand', {
......@@ -701,7 +671,6 @@ class BusinessInfo extends Component {
<Upload
{...uploadPropsFn.call(this, {
keyName: 'brandCertificate',
type: 3,
limit: 1,
})}
fileList={businessInfo.brandCertificate}
......@@ -711,7 +680,7 @@ class BusinessInfo extends Component {
)}
</FormItem>
</Col>
</div>
</>
)}
</Row>
</Card>
......@@ -757,7 +726,6 @@ class BusinessInfo extends Component {
)}
</FormItem>
</Col>
<Col span={12}>
<FormItem label="证件姓名" labelCol={{ span: 8 }}>
{getFieldDecorator('legalPersonName', {
......@@ -774,30 +742,39 @@ class BusinessInfo extends Component {
})(<Input maxLength={18} />)}
</FormItem>
</Col>
<Col span={12}>
<FormItem label="身份证起始有效期" labelCol={{ span: 8 }}>
{getFieldDecorator('legalPersonStart', {
rules: [{ required: true, message: '身份证起始有效期!' }],
initialValue: businessInfo.legalPersonStart,
})(<DatePicker style={{ width: '200px' }} />)}
</FormItem>
</Col>
<Col span={12}>
<Row gutter={24}>
<Col span={18}>
<FormItem label="身份证有效期" labelCol={{ span: 8 }}>
{getFieldDecorator('legalPerson', {
rules: [{ required: !checkboxDisabled, message: '请输入身份证有效期!' }],
initialValue: businessInfo.legalPerson,
})(<RangePicker disabled={checkboxDisabled} />)}
<Col span={19}>
<FormItem label="身份证结束有效期" labelCol={{ span: 12 }}>
{getFieldDecorator('legalPersonEnd', {
rules: [{ required: !checkboxDisabled, message: '身份证结束有效期!' }],
initialValue: businessInfo.legalPersonEnd,
})(<DatePicker style={{ width: '200px' }} disabled={checkboxDisabled} />)}
</FormItem>
</Col>
<Col span={6}>
<FormItem labelCol={{ span: 8 }}>
<Col span={5}>
<FormItem>
{getFieldDecorator('legalPersonPeriod', {
initialValue: businessInfo.checked,
})(
<Checkbox Group className={styles.radio} onChange={this.oncheckedChange}>
长期
</Checkbox>,
<Checkbox.Group
options={legalPersonList}
className={styles.radio}
onChange={e => this.oncheckedChange(e)}
/>,
)}
</FormItem>
</Col>
</Row>
</Col>
<Col span={12}>
<FormItem label="手机号" labelCol={{ span: 8 }}>
{getFieldDecorator('legalPersonPhone', {
......@@ -899,19 +876,12 @@ class BusinessInfo extends Component {
</FormItem>
</Col>
<Col span={12}>
<Row>
<Col span={4} style={{ marginTop: '4px' }}>
{businessInfo.companyName && (
<Button onClick={this.setBankAccount}>修改</Button>
)}
</Col>
<FormItem label="银行帐号" labelCol={{ span: 8 }}>
{getFieldDecorator('bankAccount', {
rules: [{ required: true, message: '请输入银行帐号!' }],
initialValue: businessInfo.bankAccount,
})(<Input maxLength={20} disabled={!bankAccounts} />)}
</FormItem>
</Row>
<FormItem label="银行帐号" labelCol={{ span: 8 }}>
{getFieldDecorator('bankAccount', {
rules: [{ required: true, message: '请输入银行帐号!' }],
initialValue: businessInfo.bankAccount,
})(<Input maxLength={20} />)}
</FormItem>
</Col>
<Col span={12}>
<FormItem label="联行号" labelCol={{ span: 8 }}>
......@@ -920,34 +890,27 @@ class BusinessInfo extends Component {
})(<Input maxLength={50} />)}
</FormItem>
</Col>
{((businessInfo.differentNameAuthorizationImage &&
businessInfo.differentNameAuthorizationImage.length) ||
bankAccounts) && (
<Col span={24}>
<FormItem
label="非同名结算授权文件"
labelCol={{ span: 4 }}
wrapperCol={wrapperCol}
>
{getFieldDecorator('differentNameAuthorizationImage', {
initialValue: businessInfo.differentNameAuthorizationImage,
})(
<Upload
{...uploadPropsFn.call(this, {
keyName: 'differentNameAuthorizationImage',
type: 3,
maxSize: 1024 * 200,
maxSizeMsg: '文件大小不能超过200K',
limit: 1,
})}
fileList={businessInfo.differentNameAuthorizationImage}
>
<UploadOutlined /> 上传文件
</Upload>,
)}
</FormItem>
</Col>
)}
<Col span={24}>
<FormItem
label="非同名结算授权文件"
labelCol={{ span: 4 }}
wrapperCol={wrapperCol}
>
{getFieldDecorator('differentNameAuthorizationImage', {
initialValue: businessInfo.differentNameAuthorizationImage,
})(
<Upload
{...uploadPropsFn.call(this, {
keyName: 'differentNameAuthorizationImage',
limit: 1,
})}
fileList={businessInfo.differentNameAuthorizationImage}
>
<UploadOutlined /> 上传文件
</Upload>,
)}
</FormItem>
</Col>
</Row>
)}
{this.state.settlementType === 2 && (
......@@ -1007,7 +970,7 @@ class BusinessInfo extends Component {
)}
</Card>
{/* 汽车301008 */}
{+mainCategoryId === 301008 && (
{+mainCategoryId === 301008 ? (
<Card title="其他信息">
<Row gutter={24}>
<Col span={24}>
......@@ -1018,31 +981,19 @@ class BusinessInfo extends Component {
})(<Input style={{ width: '50%' }} />)}
</FormItem>
</Col>
<Col span={24}>
<FormItem label="邀请码" labelCol={{ span: 4 }}>
{getFieldDecorator('invitationCode', {
rules: [{ required: true, message: '请输入邀请码!' }],
initialValue: businessInfo.invitationCode,
})(<Input style={{ width: '50%' }} />)}
</FormItem>
</Col>
</Row>
</Card>
) : (
''
)}
<div className={styles.formBtns}>
<Row gutter={24}>
<Col span={8}>
<Button type="primary" size="large" htmlType="submit" loading={this.state.loading}>
修改并提交
</Button>
</Col>
<Col span={12}>
<Button size="large" onClick={this.onCancel}>
取消
</Button>
</Col>
</Row>
<Button type="primary" size="large" htmlType="submit" loading={this.state.loading}>
修改并提交
</Button>
<Button size="large" onClick={this.onCancel}>
取消
</Button>
</div>
</Form>
<MapModal
......
......@@ -55,6 +55,10 @@
}
.formBtns {
display: flex;
align-items: center;
justify-content: space-evenly;
width: 100%;
padding: 20px 0;
background-color: #fff;
}
......@@ -24,3 +24,6 @@ export const businessModel = [
{ label: '实物商品业务员', value: 2 },
{ label: '到店业务(服务类业务)', value: 3 },
];
// 营业日
export const businessStatus = [{ label: '停业', value: 2 }, { label: '营业中', value: 1 }];
......@@ -10,14 +10,16 @@ import {
Table,
Pagination,
Modal,
Select,
} from 'antd';
import _ from 'lodash';
import { el } from 'date-fns/locale';
import { searchList, apiEnableStore, apiAddrArea, apiproductBusiness } from './services';
import { stateDesc, weeks, layout } from './data';
import { stateDesc, weeks, layout, businessStatus, businessModel } from './data';
import StoreModal from './components/storeModal';
import style from './style.less';
const { Option } = Select;
const { confirm } = Modal;
export default () => {
const [visible, setVisible] = useState(false);
......@@ -117,6 +119,10 @@ export default () => {
params[ids[i]] = item;
});
}
if (val.businessStatus) {
params.businessStatus = val.businessStatus;
}
getList(params);
};
const closeModal = isReload => {
......@@ -205,74 +211,60 @@ export default () => {
const columns = [
{
title: '门店名称',
dataIndex: 'name',
title: '业务模式',
dataIndex: 'productBusiness',
width: 120,
align: 'center',
render: v => {
let str = '';
v.forEach(it => {
businessModel.forEach(item => {
if (+it === +item.value) {
str += `${item.label}`;
}
});
});
return str;
},
},
{
title: '门店电话',
dataIndex: 'phone',
hideInSearch: true,
title: '门店名称',
dataIndex: 'name',
width: 120,
align: 'center',
},
{
title: '营业时间',
dataIndex: 'businessHours',
hideInSearch: true,
width: 150,
render: businessHours => (
<div>
<div>{getWeekSlots(businessHours.weeks)}</div>
<div>
{businessHours.hoursItems.map(item => (
<div key={item.begin}>
<span>{item.begin}</span>-<span>{item.end}</span>
</div>
))}
</div>
</div>
),
},
{
title: '地区',
dataIndex: 'addr',
width: 200,
hideInSearch: true,
render: (addr, r) => (
<span>{`${r.provinceName}${r.cityName}${r.countyName}${r.townName || ''}`}</span>
),
title: '营业状态',
dataIndex: 'businessStatus',
width: 80,
align: 'center',
render: val => businessStatus.find(item => item.value === val)?.label || '-',
},
{
title: '详细地址',
dataIndex: 'address',
hideInSearch: true,
width: 150,
title: '创建时间',
dataIndex: 'createdAt',
width: 120,
align: 'center',
},
{
title: '经纬度',
dataIndex: 'latlng',
hideInSearch: true,
width: 120,
render: (latlng, r) => <span>{`${r.longitude},${r.latitude}`}</span>,
title: '门店电话',
dataIndex: 'phone',
align: 'center',
width: 100,
},
{
title: '状态',
title: '门店状态',
dataIndex: 'state',
hideInSearch: true,
width: 120,
align: 'center',
width: 80,
render: v => <span>{`${stateDesc[v]}`}</span>,
},
{
title: '创建时间',
dataIndex: 'createdAt',
hideInSearch: true,
width: 120,
},
{
title: '操作',
hideInSearch: true,
dataIndex: 'action',
width: 170,
width: 200,
fixed: 'right',
render: (val, r) => (
<div className={style.actionBtn}>
......@@ -310,17 +302,28 @@ export default () => {
</Form.Item>
</Col>
<Col span={8}>
<Button type="primary" htmlType="submit" size="middle">
搜索
</Button>
<Button size="middle" className={style.searchBtn} onClick={() => onReset()}>
重置
</Button>
<Button type="primary" size="middle" onClick={() => onCreate()}>
新建
</Button>
<Form.Item label="营业状态" name="businessStatus">
<Select>
{businessStatus.map(item => (
<Option label={item.label} value={item.value} key={item.value}>
{item.label}
</Option>
))}
</Select>
</Form.Item>
</Col>
</Row>
<div className={style.search}>
<Button type="primary" htmlType="submit" size="middle">
搜索
</Button>
<Button size="middle" className={style.searchBtn} onClick={() => onReset()}>
重置
</Button>
<Button type="primary" size="middle" onClick={() => onCreate()}>
新建
</Button>
</div>
</Form>
</div>
<Table
......
.serachForm {
margin-bottom: 20px;
padding: 20px 50px 0 10px;
padding: 20px 50px 10px 10px;
background-color: #fff;
}
.search {
display: flex;
justify-content: end;
}
.searchBtn {
margin: 0 10px;
}
......@@ -16,8 +20,9 @@
.actionBtn {
display: flex;
flex-direction: column;
align-items: center;
// flex-direction: column;
justify-content: space-around;
button {
width: 75px;
margin-bottom: 5px;
......
import React, { useState, useRef } from 'react';
import ProTable from '@ant-design/pro-table';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { notification, Button, Modal, Image } from 'antd';
import { notification, Button, Modal, Image, message } from 'antd';
import { query } from './services';
const ContractView = () => {
const [visible, setVisible] = useState(false);
const url =
'https://contract-test.q-gp.com/621-621T18364B279E2null.pdf?Expires=1679994655&OSSAccessKeyId=LTAI5tGV1jdSEBjuKDUYZVHY&Signature=nVC2YgG8t5DWZl6sMyRmCzeRYLw%3D';
const [url, setUrl] = useState();
// 查看
const onLook = ({ contractPdfUrl }) => {
setVisible(true);
// window.open(url)
if (contractPdfUrl) {
setUrl(contractPdfUrl);
setVisible(true);
} else {
message.error('暂无合同');
}
};
// 下载
const ondown = ({ contractPdfUrl }) => {
window.open(url);
if (contractPdfUrl) {
window.open(contractPdfUrl);
} else {
message.error('暂无合同');
}
};
const columns = [
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment