import React, { PureComponent } from 'react'; import { connect } from 'dva'; import { routerRedux } from 'dva/router'; import { Spin, Card, Form, Switch, Radio, Button, Input } from 'antd'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import { getLocalUser } from '../../utils/helper'; @connect(state => ({ merchant: state.merchant })) @Form.create() export default class MerchantInfo extends PureComponent { handlePageCancel = () => { this.props.dispatch(routerRedux.push('/')); } handlePageSubmit = (e) => { e.preventDefault(); const { form, dispatch } = this.props; const { getFieldsValue, validateFields } = form; validateFields((errors) => { if (errors) return; const data = { ...getFieldsValue() }; const { merchantId } = getLocalUser(); data.id = merchantId; dispatch({ type: 'merchant/update', payload: data, callback: () => { dispatch(routerRedux.push('/')); }, }); }); } render() { const { form, merchant } = this.props; const { item, loading } = merchant; const { getFieldDecorator } = form; const formItemLayout = { labelCol: { xs: { span: 24 }, sm: { span: 7 }, }, wrapperCol: { xs: { span: 24 }, sm: { span: 12 }, md: { span: 10 }, }, }; const submitFormLayout = { wrapperCol: { xs: { span: 24, offset: 0 }, sm: { span: 10, offset: 7 }, }, }; return (
{/* {getFieldDecorator('code',{ rules: [{ required: true, type: 'string', message: '编号为必填写!' }], initialValue: item.code, })()} {getFieldDecorator('name',{ rules: [{ required: true, type: 'string', message: '名称为必填项!' }], initialValue: item.name, })()} {getFieldDecorator('domain',{ initialValue: item.domain || Codes.CODE_PJ, })( {Object.keys(domains).map(key => {domains[Number(key)]} )} )} */} {getFieldDecorator('depositBank', { rules: [{ required: true, type: 'string', message: '开户银行为必填项!' }], initialValue: item.depositBank, })()} {getFieldDecorator('bankAccount', { rules: [{ required: true, type: 'string', message: '银行账户为必填项!' }], initialValue: item.bankAccount, })()} {getFieldDecorator('licenseId', { initialValue: item.licenseId, })()} {getFieldDecorator('taxNumber', { initialValue: item.taxNumber, })()} {getFieldDecorator('receiptType', { initialValue: item.receiptType || 'SPECIAL', })( 普通发票 增值税发票 )}
); } }