import React from 'react'; import $ from 'jquery/src/ajax'; import { Form, Button, Input, Select, Spin,InputNumber, message, Modal ,DatePicker} from 'antd'; import {transactionChannel} from '@/dataDic.js'; import moment from 'moment'; const Receivable=React.createClass({ getInitialState() { return { loading: false, visible:false, showDesc:false, data:{} }; }, //保存 handleSubmit(e){ e.preventDefault(); if(this.state.settlementAmount === ''){ message.warning('请填写金额'); return false; } if(!this.state.transactionChannel){ message.warning('请选择交易渠道'); return false; } if(!this.state.contractNo){ message.warning('请填写合同编号'); return false; } if(!this.state.financialPayTimes){ message.warning('请选择财务流水时间'); return false; } this.setState({ loading: true }); let data = this.props.data || {}; $.ajax({ method: "post", dataType: "json", async:true, url: globalConfig.context + this.props.api, data: { orderNo: data.orderNo, payeeId:data.companyId, payerId:data.buyerId, contractNo:this.state.contractNo, transactionAmount: this.state.settlementAmount, transactionSubject: ~((this.props.title).indexOf('退款'))?'2':'0', transactionChannel: this.state.transactionChannel, financialPayNo:this.state.financialPayNo, financialPayTimes:this.state.financialPayTimes, remarks:this.state.remarks } }).done(function (data) { this.setState({ loading: false }); if (!data.error.length) { message.success('操作成功!'); this.onShow(); } else { message.warning(data.error[0].message); } }.bind(this)); }, onCancel(){ this.setState({ visible:false }) this.props.closeDesc(false,false); }, onShow() { this.setState({ visible: false, }); this.props.closeDesc(false, true); }, componentWillMount() { this.setState({ transactionProject:undefined, settlementAmount:undefined, transactionChannel:undefined, financialPayNo:'', financialPayTimes:undefined, remarks:'' }) }, componentWillReceiveProps(nextProps) { this.state.visible=nextProps.showDesc; this.setState({ transactionProject:undefined, settlementAmount:undefined, transactionChannel:'2', financialPayNo:'', financialPayTimes:undefined, remarks:'', contractNo:nextProps.data.contractNo }) }, render() { const theData = this.props.data || {}; const FormItem = Form.Item; const formItemLayout = { labelCol: { span: 8 }, wrapperCol: { span: 12 }, }; return (