import React from 'react'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import { Form,Button, Input, Spin, message, Modal, Upload } from 'antd'; import {getNewOrderStatus,getLiquidationStatus,splitUrl} from '@/tools.js'; const Examine=React.createClass({ loadData(record) { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/order/getOrderCommodity', data: { orderNo:record?record.orderNo:this.props.data.orderNo }, success: function (data) { let theArr = []; if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { for (let i = 0; i < data.data.length; i++) { let thisdata = data.data[i]; theArr.push({ key: i, id:thisdata.id, data:thisdata, orderNo:thisdata.orderNo, orgCodeUrl: thisdata.contractPictureUrl ? splitUrl(thisdata.contractPictureUrl, ',', globalConfig.avatarHost + '/upload') : [], orgCodeUrlNo: thisdata.contractPictureUrl ? splitUrl(thisdata.contractPictureUrl, ',', globalConfig.avatarHost + '/upload') : [], }); }; } }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { loading: false, visible:false, showDesc:false, }; }, //保存 handleSubmit(e,index){ e.preventDefault(); if(index=='2'&&!this.state.remark){ message.warning('请填写拒绝退单的原因'); return false; } this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", async:true, url: globalConfig.context + '/api/admin/financial/changeRefund', data: { id: this.props.data.id, refundStatus:index, remarks:index=='2'?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({ remarks:'' }) }, componentWillReceiveProps(nextProps) { if(nextProps.data.orderNo){ this.loadData(nextProps.data); } this.state.visible=nextProps.showDesc; this.setState({ remarks:'' }) }, render() { const theData = this.state.data || {}; const FormItem = Form.Item; const formItemLayout = { labelCol: { span: 10 }, wrapperCol: { span: 12 }, }; return (
{this.handleSubmit(e,1)}} >
{theData.id} {theData.createTime?(new Date(theData.createTime)).toLocaleString():''} {theData.orderNo} {getNewOrderStatus(theData.orderStatus)} {getLiquidationStatus(theData.liquidationStatus)} {theData.payerName} {theData.payeeName} {theData.billNo}
{ this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true, }); }} > { this.setState({ previewVisible: false }) }}>
{ this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true, }); }} > { this.setState({ previewVisible: false }) }}>
{theData.reason} { this.setState({ remarks: e.target.value }); }} />
); } }); export default Form.create()(Examine);