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

feat: 接口联调

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