tuiDan.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. import React,{Component} from 'react';
  2. import ajax from 'jquery/src/ajax/xhr.js';
  3. import $ from 'jquery/src/ajax';
  4. import moment from 'moment';
  5. import './public.less';
  6. import { Button,Form,Select , Input, Spin, Table, Switch, message, DatePicker } from 'antd';
  7. import Receivable from './receivable';
  8. import Examine from './examine';
  9. import OrderDesc from '../orderDetail/orderDesc';
  10. import {getLiquidationStatus,getNewOrderStatus,getRefundStatus} from '@/tools';
  11. const TuiDan = React.createClass({
  12. loadData(pageNo) {
  13. this.state.data = [];
  14. this.setState({
  15. selectedRowKeys:[],
  16. selectedRowKey:[],
  17. page:pageNo,
  18. loading: true
  19. });
  20. $.ajax({
  21. method: "get",
  22. dataType: "json",
  23. crossDomain: false,
  24. url: globalConfig.context + "/api/admin/financial/getRefundList",
  25. data: {
  26. pageNo: pageNo || 1,
  27. pageSize: this.state.pagination.pageSize,
  28. id:this.state.orderRefundSearch,
  29. buyName: this.state.nameSearch,//客户名称
  30. orderNo:this.state.orderNoSearch,
  31. refundStatus:this.state.refundStatus||0,
  32. startTime: this.state.releaseDate[0],
  33. endTime: this.state.releaseDate[1],
  34. },
  35. success: function (data) {
  36. let theArr = [];
  37. if (!data.data || !data.data.list) {
  38. if (data.error && data.error.length) {
  39. message.warning(data.error[0].message);
  40. };
  41. } else {
  42. for (let i = 0; i < data.data.list.length; i++) {
  43. let thisdata = data.data.list[i];
  44. theArr.push({
  45. key: i,
  46. id:thisdata.id,
  47. orderNo: thisdata.orderNo,
  48. orderType:thisdata.orderType,
  49. buyName:thisdata.buyName,
  50. companyName:thisdata.buyName,
  51. buyerName:thisdata.saleName,
  52. buyerId:thisdata.buyid,
  53. companyId:'0',
  54. orderStatus:thisdata.orderStatus,
  55. liquidationStatus:thisdata.liquidationStatus,
  56. refundStatus:thisdata.refundStatus,
  57. saleName:thisdata.saleName,
  58. createTime:thisdata.createTime?(new Date(thisdata.createTime)).toLocaleString():'',
  59. });
  60. };
  61. }
  62. this.state.pagination.current = data.data.pageNo;
  63. this.state.pagination.total = data.data.totalCount;
  64. if(data.data&&data.data.list&&!data.data.list.length){
  65. this.state.pagination.current=0
  66. this.state.pagination.total=0
  67. }
  68. this.setState({
  69. dataSource: theArr,
  70. pagination: this.state.pagination
  71. });
  72. }.bind(this),
  73. }).always(function () {
  74. this.setState({
  75. loading: false
  76. });
  77. }.bind(this));
  78. },
  79. getInitialState() {
  80. return {
  81. searchMore: true,
  82. assignVisible:false,
  83. releaseDate: [],
  84. assignData:[],
  85. boHuivisible:false,
  86. selectedRowKeys: [],
  87. selectedRows: [],
  88. loading: false,
  89. pagination: {
  90. defaultCurrent: 1,
  91. defaultPageSize: 10,
  92. showQuickJumper: true,
  93. pageSize: 10,
  94. onChange: function (page) {
  95. this.loadData(page);
  96. }.bind(this),
  97. showTotal: function (total) {
  98. return '共' + total + '条数据';
  99. }
  100. },
  101. columns: [
  102. {
  103. title: '退单编号',
  104. dataIndex: 'id',
  105. key: 'id',
  106. },
  107. {
  108. title: '申请退单时间',
  109. dataIndex: 'createTime',
  110. key: 'createTime',
  111. },
  112. {
  113. title: '订单编号',
  114. dataIndex: 'orderNo',
  115. key: 'orderNo',
  116. },
  117. {
  118. title: '客户名称',
  119. dataIndex: 'buyName',
  120. key: 'buyName',
  121. },
  122. {
  123. title: '订单状态',
  124. dataIndex: 'orderStatus',
  125. key: 'orderStatus',
  126. render: text => { return getNewOrderStatus(text)}
  127. },
  128. {
  129. title: '订单负责人',
  130. dataIndex: 'saleName',
  131. key: 'saleName'
  132. },
  133. {
  134. title: '结算状态',
  135. dataIndex: 'liquidationStatus',
  136. key: 'liquidationStatus',
  137. render: text => { return getLiquidationStatus(text)}
  138. },
  139. {
  140. title: '审批状态',
  141. dataIndex: 'refundStatus',
  142. key: 'refundStatus',
  143. render: text => { return getRefundStatus(text)}
  144. },
  145. {
  146. title:'操作',
  147. dataIndex: 'caozuo',
  148. key: 'caouzo',
  149. render:(text,recard)=>{
  150. return <div>
  151. {recard.refundStatus==1&&<Button type="primary" onClick={(e)=>{e.stopPropagation(),this.evaluate(recard)}}>添加退款记录</Button>}
  152. {recard.refundStatus==0&&<Button type="primary" onClick={(e)=>{e.stopPropagation(),this.reject(recard)}}>审批</Button>}
  153. </div>
  154. }
  155. }
  156. ],
  157. dataSource: [],
  158. examineData:{},
  159. searchTime: [,]
  160. }
  161. },
  162. /* 添加收款记录 */
  163. evaluate(recard){
  164. this.state.assignData=recard;
  165. this.setState({
  166. assignVisible:true
  167. })
  168. },
  169. /* 驳回 */
  170. reject(recard){
  171. this.setState({
  172. examineData:recard,
  173. examineVisible:true,
  174. })
  175. },
  176. componentWillMount() {
  177. this.loadData();
  178. },
  179. tableRowClick(record, index) {
  180. this.state.RowData = record;
  181. this.setState({
  182. showDesc: true,
  183. });
  184. },
  185. closeExamine(e, s) {
  186. this.state.examineData={};
  187. this.state.examineVisible = e;
  188. if (s) {
  189. this.loadData(this.state.page);
  190. };
  191. },
  192. closeDesc(e, s) {
  193. this.state.RowData={};
  194. this.state.showDesc = e;
  195. if (s) {
  196. this.loadData(this.state.page);
  197. };
  198. },
  199. closeAssign(e, s) {
  200. this.state.assignData={};
  201. this.state.assignVisible = e;
  202. if (s) {
  203. this.loadData(this.state.page);
  204. };
  205. },
  206. search() {
  207. this.loadData();
  208. },
  209. reset() {
  210. this.state.nameSearch = '';
  211. this.state.orderRefundSearch='';
  212. this.state.releaseDate = [];
  213. this.state.orderNoSearch='';
  214. this.state.refundStatus=undefined;
  215. this.loadData();
  216. },
  217. searchSwitch() {
  218. this.setState({
  219. searchMore: !this.state.searchMore
  220. });
  221. },
  222. render() {
  223. const rowSelection = {
  224. selectedRowKeys: this.state.selectedRowKeys,
  225. onChange: (selectedRowKeys, selectedRows) => {
  226. this.setState({
  227. selectedRows: selectedRows.slice(-1),
  228. selectedRowKeys: selectedRowKeys.slice(-1)
  229. });
  230. }
  231. };
  232. const hasSelected = this.state.selectedRowKeys.length > 0;
  233. const { RangePicker } = DatePicker;
  234. return ( <div className="user-content">
  235. <div className="content-title">
  236. <span>退单管理</span>
  237. </div>
  238. <div className="user-search">
  239. <Input placeholder="退单编号"
  240. value={this.state.orderRefundSearch}
  241. onChange={(e) => { this.setState({ orderRefundSearch: e.target.value }); }} />
  242. <Input placeholder="订单编号"
  243. value={this.state.orderNoSearch}
  244. onChange={(e) => { this.setState({ orderNoSearch: e.target.value }); }} />
  245. <Input placeholder="客户名称"
  246. value={this.state.nameSearch}
  247. onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
  248. <Select
  249. onChange={(e)=>{this.setState({refundStatus:e})}}
  250. style={{width:160,marginRight:5}}
  251. placeholder="审核状态"
  252. value={this.state.refundStatus}>
  253. <Option value="0">未审核</Option>
  254. <Option value="1">审核通过</Option>
  255. <Option value="2">审核拒绝</Option>
  256. </Select>
  257. <Button type="primary" onClick={this.search}>搜索</Button>
  258. <Button onClick={this.reset}>重置</Button>
  259. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch.bind(this)} /></span>
  260. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  261. <span>退单时间 :</span>
  262. <RangePicker
  263. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  264. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  265. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  266. </div>
  267. </div>
  268. <div className="patent-table">
  269. <Spin spinning={this.state.loading}>
  270. <Table columns={this.state.columns}
  271. dataSource={this.state.dataSource}
  272. rowSelection={false}
  273. pagination={this.state.pagination}
  274. onRowClick={this.tableRowClick.bind(this)}
  275. />
  276. </Spin>
  277. </div>
  278. <Receivable
  279. title='退款记录'
  280. api='/api/admin/financial/addRefundFlow'
  281. data={this.state.assignData}
  282. showDesc={this.state.assignVisible}
  283. closeDesc={this.closeAssign.bind(this)}
  284. />
  285. <Examine
  286. data={this.state.examineData}
  287. showDesc={this.state.examineVisible}
  288. closeDesc={this.closeExamine.bind(this)}
  289. />
  290. <OrderDesc
  291. data={this.state.RowData}
  292. showDesc={this.state.showDesc}
  293. closeDesc={this.closeDesc.bind(this)}
  294. />
  295. </div> )
  296. }
  297. })
  298. export default TuiDan;