examine.jsx 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. import React from 'react';
  2. import $ from 'jquery/src/ajax';
  3. import { Form,Button, Input, Spin, message, Modal, Upload } from 'antd';
  4. import {getNewOrderStatus,getLiquidationStatus,splitUrl} from '@/tools.js';
  5. import ImgList from "../../../common/imgList";
  6. const Examine=React.createClass({
  7. loadData(record) {
  8. this.state.data = [];
  9. this.setState({
  10. loading: true
  11. });
  12. $.ajax({
  13. method: "get",
  14. dataType: "json",
  15. crossDomain: false,
  16. url: globalConfig.context + '/api/admin/newOrder/orderRefundDetail',
  17. data: {
  18. id:record?record.id:this.props.data.id
  19. },
  20. success: function (data) {
  21. if (!data.data) {
  22. if (data.error && data.error.length) {
  23. message.warning(data.error[0].message);
  24. };
  25. } else {
  26. let thisdata=data.data;
  27. this.setState({
  28. id:thisdata.id,
  29. data:thisdata,
  30. orderNo:thisdata.orderNo,
  31. orgCodeUrl: thisdata.contractUrl ? splitUrl(thisdata.contractUrl, ',', globalConfig.avatarHost + '/upload') : [],
  32. orgCodeUrlNo: thisdata.applicationUrl ? splitUrl(thisdata.applicationUrl, ',', globalConfig.avatarHost + '/upload') : [],
  33. });
  34. }
  35. }.bind(this),
  36. }).always(function () {
  37. this.setState({
  38. loading: false
  39. });
  40. }.bind(this));
  41. },
  42. getInitialState() {
  43. return {
  44. loading: false,
  45. visible:false,
  46. showDesc:false,
  47. };
  48. },
  49. //保存
  50. handleSubmit(e,index){
  51. e.preventDefault();
  52. if(index=='2'&&!this.state.remarks){
  53. message.warning('请填写拒绝退单的原因');
  54. return false;
  55. }
  56. this.setState({
  57. loading: true
  58. });
  59. $.ajax({
  60. method: "post",
  61. dataType: "json",
  62. async:true,
  63. url: globalConfig.context + '/api/admin/financial/changeRefund',
  64. data: index=='2'?{
  65. id: this.props.data.id,
  66. refundStatus:index,
  67. remarks:this.state.remarks
  68. }:{
  69. id: this.props.data.id,
  70. refundStatus:index,
  71. }
  72. }).done(function (data) {
  73. this.setState({
  74. loading: false
  75. });
  76. if (!data.error.length) {
  77. message.success('操作成功!');
  78. this.onShow(index);
  79. } else {
  80. message.warning(data.error[0].message);
  81. }
  82. }.bind(this));
  83. },
  84. onCancel(){
  85. this.setState({
  86. visible:false
  87. })
  88. this.props.closeDesc(false,false);
  89. },
  90. onShow(index) {
  91. this.setState({
  92. visible: false,
  93. });
  94. this.props.closeDesc(false, true,index);
  95. },
  96. componentWillMount() {
  97. this.setState({
  98. remarks:''
  99. })
  100. },
  101. componentWillReceiveProps(nextProps) {
  102. if(nextProps.data.orderNo){
  103. this.loadData(nextProps.data);
  104. }
  105. this.state.visible=nextProps.showDesc;
  106. this.setState({
  107. remarks:''
  108. })
  109. },
  110. render() {
  111. const theData = this.state.data || {};
  112. const FormItem = Form.Item;
  113. const formItemLayout = {
  114. labelCol: { span: 10 },
  115. wrapperCol: { span: 12 },
  116. };
  117. return (
  118. <div className="user-content" >
  119. <Modal maskClosable={false} visible={this.state.visible}
  120. onOk={this.onShow} onCancel={this.onCancel}
  121. width='800px'
  122. title='退单审核'
  123. footer=''
  124. className="admin-desc-content">
  125. <Form layout="horizontal" onSubmit={(e)=>{this.handleSubmit(e,1)}} >
  126. <Spin spinning={this.state.loading}>
  127. <div className="clearfix">
  128. <FormItem className="half-item" {...formItemLayout} label="退单编号">
  129. <span>{theData.id}</span>
  130. </FormItem>
  131. <FormItem className="half-item" {...formItemLayout} label="退单时间">
  132. <span>{theData.createDate}</span>
  133. </FormItem>
  134. <FormItem className="half-item" {...formItemLayout} label="订单编号">
  135. <span>{theData.orderNo}</span>
  136. </FormItem>
  137. <FormItem className="half-item" {...formItemLayout} label="订单状态">
  138. <span>{getNewOrderStatus(theData.orderStatus)}</span>
  139. </FormItem>
  140. <FormItem className="half-item" {...formItemLayout} label="结算状态">
  141. <span>{getLiquidationStatus(theData.liquidationStatus)}</span>
  142. </FormItem>
  143. <div className="clearfix">
  144. <FormItem labelCol={{ span:5 }} wrapperCol={{ span: 17 }} label="终止合同">
  145. <Upload className="demandDetailShow-upload"
  146. listType="picture-card"
  147. fileList={this.state.orgCodeUrl}
  148. onPreview={(file) => {
  149. this.setState({
  150. previewImage: file.url || file.thumbUrl,
  151. previewVisible: true,
  152. });
  153. }} />
  154. {/*<div style={{paddingTop:'10px',paddingBottom:'10px'}}>*/}
  155. {/* <ImgList fileList={this.state.orgCodeUrl} ItemWidth={'96px'}/>*/}
  156. {/*</div>*/}
  157. <Modal maskClosable={false} footer={null}
  158. visible={this.state.previewVisible}
  159. onCancel={() => { this.setState({ previewVisible: false }) }}>
  160. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  161. </Modal>
  162. </FormItem>
  163. </div>
  164. <div className="clearfix">
  165. <FormItem labelCol={{ span:5 }} wrapperCol={{ span: 17 }} label="退单申请表">
  166. <Upload className="demandDetailShow-upload"
  167. listType="picture-card"
  168. fileList={this.state.orgCodeUrlNo}
  169. onPreview={(file) => {
  170. this.setState({
  171. previewImage: file.url || file.thumbUrl,
  172. previewVisible: true,
  173. });
  174. }} />
  175. {/*<div style={{paddingTop:'10px',paddingBottom:'10px'}}>*/}
  176. {/* <ImgList fileList={this.state.orgCodeUrlNo} ItemWidth={'96px'}/>*/}
  177. {/*</div>*/}
  178. <Modal maskClosable={false} footer={null}
  179. visible={this.state.previewVisible}
  180. onCancel={() => { this.setState({ previewVisible: false }) }}>
  181. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  182. </Modal>
  183. </FormItem>
  184. </div>
  185. <FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 16 }} label="退单原因">
  186. <span>{theData.reason}</span>
  187. </FormItem>
  188. <FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 16 }} label="拒绝原因">
  189. <Input
  190. type="textarea"
  191. rows={4}
  192. placeholder="若拒绝,请输入拒绝退单原因"
  193. value={this.state.remarks}
  194. onChange={(e) => {
  195. this.setState({ remarks: e.target.value });
  196. }}
  197. />
  198. </FormItem>
  199. <FormItem wrapperCol={{ span: 12, offset:5 }}>
  200. <Button type="primary" htmlType="submit" style={{marginRight:20}}>同意退单</Button>
  201. <Button type="primary" onClick={(e)=>{this.handleSubmit(e,2)}} style={{marginRight:20}}>拒绝退单</Button>
  202. <Button type="default" onClick={()=>{this.onCancel()}}>取消</Button>
  203. </FormItem>
  204. </div>
  205. </Spin>
  206. </Form>
  207. </Modal>
  208. </div>
  209. );
  210. }
  211. });
  212. export default Form.create()(Examine);