import React from 'react'; import $ from 'jquery/src/ajax'; import { Form,Button, Input, Spin, message, Modal, Upload } from 'antd'; import {getNewOrderStatus,getLiquidationStatus,splitUrl} from '@/tools.js'; import ImgList from "../../../common/imgList"; 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/newOrder/orderRefundDetail', data: { id:record?record.id:this.props.data.id }, success: function (data) { if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { let thisdata=data.data; this.setState({ id:thisdata.id, data:thisdata, orderNo:thisdata.orderNo, orgCodeUrl: thisdata.contractUrl ? splitUrl(thisdata.contractUrl, ',', globalConfig.avatarHost + '/upload') : [], orgCodeUrlNo: thisdata.applicationUrl ? splitUrl(thisdata.applicationUrl, ',', 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.remarks){ message.warning('请填写拒绝退单的原因'); return false; } this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", async:true, url: globalConfig.context + '/api/admin/financial/changeRefund', data: index=='2'?{ id: this.props.data.id, refundStatus:index, remarks:this.state.remarks }:{ id: this.props.data.id, refundStatus:index, } }).done(function (data) { this.setState({ loading: false }); if (!data.error.length) { message.success('操作成功!'); this.onShow(index); } else { message.warning(data.error[0].message); } }.bind(this)); }, onCancel(){ this.setState({ visible:false }) this.props.closeDesc(false,false); }, onShow(index) { this.setState({ visible: false, }); this.props.closeDesc(false, true,index); }, 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.createDate} {theData.orderNo} {getNewOrderStatus(theData.orderStatus)} {getLiquidationStatus(theData.liquidationStatus)}
{ 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);