123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- 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 (
- <div className="user-content" >
- <Modal maskClosable={false} visible={this.state.visible}
- onOk={this.onShow} onCancel={this.onCancel}
- width='800px'
- title='退单审核'
- footer=''
- className="admin-desc-content">
- <Form layout="horizontal" onSubmit={(e)=>{this.handleSubmit(e,1)}} >
- <Spin spinning={this.state.loading}>
- <div className="clearfix">
- <FormItem className="half-item" {...formItemLayout} label="退单编号">
- <span>{theData.id}</span>
- </FormItem>
- <FormItem className="half-item" {...formItemLayout} label="退单时间">
- <span>{theData.createDate}</span>
- </FormItem>
- <FormItem className="half-item" {...formItemLayout} label="订单编号">
- <span>{theData.orderNo}</span>
- </FormItem>
- <FormItem className="half-item" {...formItemLayout} label="订单状态">
- <span>{getNewOrderStatus(theData.orderStatus)}</span>
- </FormItem>
- <FormItem className="half-item" {...formItemLayout} label="结算状态">
- <span>{getLiquidationStatus(theData.liquidationStatus)}</span>
- </FormItem>
- <div className="clearfix">
- <FormItem labelCol={{ span:5 }} wrapperCol={{ span: 17 }} label="终止合同">
- <Upload className="demandDetailShow-upload"
- listType="picture-card"
- fileList={this.state.orgCodeUrl}
- onPreview={(file) => {
- this.setState({
- previewImage: file.url || file.thumbUrl,
- previewVisible: true,
- });
- }} />
- {/*<div style={{paddingTop:'10px',paddingBottom:'10px'}}>*/}
- {/* <ImgList fileList={this.state.orgCodeUrl} ItemWidth={'96px'}/>*/}
- {/*</div>*/}
- <Modal maskClosable={false} footer={null}
- visible={this.state.previewVisible}
- onCancel={() => { this.setState({ previewVisible: false }) }}>
- <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
- </Modal>
- </FormItem>
- </div>
- <div className="clearfix">
- <FormItem labelCol={{ span:5 }} wrapperCol={{ span: 17 }} label="退单申请表">
- <Upload className="demandDetailShow-upload"
- listType="picture-card"
- fileList={this.state.orgCodeUrlNo}
- onPreview={(file) => {
- this.setState({
- previewImage: file.url || file.thumbUrl,
- previewVisible: true,
- });
- }} />
- {/*<div style={{paddingTop:'10px',paddingBottom:'10px'}}>*/}
- {/* <ImgList fileList={this.state.orgCodeUrlNo} ItemWidth={'96px'}/>*/}
- {/*</div>*/}
- <Modal maskClosable={false} footer={null}
- visible={this.state.previewVisible}
- onCancel={() => { this.setState({ previewVisible: false }) }}>
- <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
- </Modal>
- </FormItem>
- </div>
- <FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 16 }} label="退单原因">
- <span>{theData.reason}</span>
- </FormItem>
- <FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 16 }} label="拒绝原因">
- <Input
- type="textarea"
- rows={4}
- placeholder="若拒绝,请输入拒绝退单原因"
- value={this.state.remarks}
- onChange={(e) => {
- this.setState({ remarks: e.target.value });
- }}
- />
- </FormItem>
- <FormItem wrapperCol={{ span: 12, offset:5 }}>
- <Button type="primary" htmlType="submit" style={{marginRight:20}}>同意退单</Button>
- <Button type="primary" onClick={(e)=>{this.handleSubmit(e,2)}} style={{marginRight:20}}>拒绝退单</Button>
- <Button type="default" onClick={()=>{this.onCancel()}}>取消</Button>
- </FormItem>
- </div>
- </Spin>
- </Form>
- </Modal>
- </div>
- );
- }
- });
- export default Form.create()(Examine);
|