myBill.jsx 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. import React from 'react';
  2. import ReactDom from 'react-dom';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import { Form,Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, Modal, Upload ,Popconfirm,Checkbox} from 'antd';
  6. import MyBillDetaile from "./myBillDetaile.jsx";
  7. import moment from 'moment';
  8. import '../../userMangagement.less';
  9. import {lvl,intentProgress,transactionProgress,contractProgress,projectProgress} from '../../../../dataDic.js';
  10. import {getIntentProgress,getTransactionProgress,getContractProgress,getProjectProgress,getTransactionChannel,getTransactionProject} from '../../../../tools.js';
  11. const MyBill=Form.create()(React.createClass({
  12. loadData(pageNo) {
  13. this.setState({
  14. loading: true
  15. });
  16. $.ajax({
  17. method: "post",
  18. dataType: "json",
  19. crossDomain: false,
  20. url: globalConfig.context + '/api/admin/order/listMyBill',
  21. data: {
  22. pageNo: pageNo || 1,
  23. pageSize: this.state.pagination.pageSize,
  24. payerName:this.state.draweeName,//付款人名称
  25. depId:this.state.departmenttSearch,//部门
  26. confirmSign:this.state.confirmSignSearch,//流水确认
  27. payeeName:this.state.payeeName,//收款人名称
  28. deleteSign:this.state.term,//是否有效
  29. orderNo:this.state.orderNumber,//订单编号
  30. salesmanName:this.state.orderLeader,//订单负责人
  31. },
  32. success: function (data) {
  33. let theArr = [];
  34. if (!data.data) {
  35. if (data.error && data.error.length) {
  36. message.warning(data.error[0].message);
  37. };
  38. } else {
  39. for (let i = 0; i < data.data.list.length; i++) {
  40. let thisdata = data.data.list[i];
  41. theArr.push({
  42. key: i,
  43. billNo: thisdata.billNo,
  44. transactionAmount:thisdata.transactionAmount,
  45. createTime:thisdata.createTime,
  46. transactionAmount:thisdata.transactionAmount,
  47. payerName:thisdata.payerName,
  48. payeeName:thisdata.payeeName,
  49. transactionSubject:thisdata.transactionSubject,
  50. transactionChannel:thisdata.transactionChannel,
  51. financialPayNo:thisdata.financialPayNo,
  52. financialPayTime:thisdata.financialPayTime,
  53. orderNo:thisdata.orderNo,
  54. departmentName:thisdata.departmentName,
  55. salesmanName:thisdata.salesmanName,
  56. financeName:thisdata.financeName,
  57. confirmSign:thisdata.confirmSign,
  58. deleteSign:thisdata.deleteSign,
  59. confirmTime:thisdata.confirmTime
  60. });
  61. };
  62. this.state.pagination.current = data.data.pageNo;
  63. this.state.pagination.total = data.data.totalCount;
  64. };
  65. if(!data.data.list.length){
  66. this.state.pagination.current=0
  67. this.state.pagination.total=0
  68. }
  69. this.setState({
  70. pageNo:pageNo,
  71. dataSource: theArr,
  72. pagination: this.state.pagination,
  73. selectedRowKeys:[]
  74. });
  75. }.bind(this),
  76. }).always(function () {
  77. this.setState({
  78. loading: false
  79. });
  80. }.bind(this));
  81. },
  82. //部门
  83. departmentList() {
  84. this.setState({
  85. loading: true
  86. });
  87. $.ajax({
  88. method: "get",
  89. dataType: "json",
  90. crossDomain: false,
  91. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  92. data: {
  93. },
  94. success: function(data) {
  95. let thedata = data.data;
  96. let theArr=[];
  97. if(!thedata) {
  98. if(data.error && data.error.length) {
  99. message.warning(data.error[0].message);
  100. };
  101. thedata = {};
  102. }else{
  103. thedata.map(function(item,index){
  104. theArr.push({
  105. key:index,
  106. name:item.name,
  107. id:item.id,
  108. })
  109. })
  110. }
  111. this.setState({
  112. departmentArr:theArr,
  113. })
  114. }.bind(this),
  115. }).always(function() {
  116. this.setState({
  117. loading: false
  118. });
  119. }.bind(this));
  120. },
  121. getInitialState() {
  122. return {
  123. datauser:{},
  124. selectedRowKeys: [],
  125. selectedRows: [],
  126. searchMore: true,
  127. departmentArr:[],
  128. loading: false,
  129. visible:false,
  130. showDesc:false,
  131. pagination: {
  132. defaultCurrent: 1,
  133. defaultPageSize: 10,
  134. showQuickJumper: true,
  135. pageSize: 10,
  136. onChange: function (page) {
  137. this.loadData(page);
  138. }.bind(this),
  139. showTotal: function (total) {
  140. return '共' + total + '条数据';
  141. }
  142. },
  143. columns: [
  144. {
  145. title: '平台流水号',
  146. dataIndex: 'billNo',
  147. key: 'billNo',
  148. render:(text)=>{
  149. return text&&text.substr(0,9)+'…'
  150. }
  151. }, {
  152. title: '平台流水时间',
  153. dataIndex: 'createTime',
  154. key: 'createTime'
  155. }, {
  156. title: '流水金额(万元)',
  157. dataIndex: 'transactionAmount',
  158. key: 'transactionAmount'
  159. },{
  160. title: '付款人名称',
  161. dataIndex: 'payerName',
  162. key: 'payerName'
  163. }, {
  164. title: '收款人名称',
  165. dataIndex: 'payeeName',
  166. key: 'payeeName'
  167. },
  168. {
  169. title: '流水科目',
  170. dataIndex: 'transactionSubject',
  171. key: 'transactionSubject',
  172. render:(text)=>{return getTransactionProject(text) }
  173. }, {
  174. title: '流水渠道',
  175. dataIndex: 'transactionChannel',
  176. key: 'transactionChannel',
  177. render:(text)=>{return getTransactionChannel(text) }
  178. },{
  179. title: '财务流水号',
  180. dataIndex: 'financialPayNo',
  181. key: 'financialPayNo',
  182. }, {
  183. title: '财务流水时间',
  184. dataIndex: 'financialPayTime',
  185. key: 'financialPayTime',
  186. }, {
  187. title: '流水确认',
  188. dataIndex: 'confirmSign',
  189. key: 'confirmSign',
  190. render:(text)=>{return text?'已确认':'待确认' }
  191. },{
  192. title: '确认时间',
  193. dataIndex: 'confirmTime',
  194. key: 'confirmTime',
  195. },{
  196. title: '订单编号',
  197. dataIndex: 'orderNo',
  198. key: 'orderNo',
  199. },{
  200. title: '订单负责人',
  201. dataIndex: 'salesmanName',
  202. key: 'salesmanName',
  203. },{
  204. title: '是否有效',
  205. dataIndex: 'deleteSign',
  206. key: 'deleteSign',
  207. render:(text)=>{return text==0?'有效':'作废' }
  208. },
  209. {
  210. title: '操作',
  211. dataIndex: 'operation',
  212. key: 'operation',
  213. render: (text, record, index) => {
  214. return <div>
  215. {!record.confirmSign&&<Button style={{marginRight:'5px'}} onClick={(e) =>{e.stopPropagation(),this.reject(record) }}>编辑</Button>}
  216. </div>
  217. }
  218. }
  219. ],
  220. dataSource: [],
  221. };
  222. },
  223. //驳回
  224. reject(record){
  225. this.state.userDetaile=true;
  226. this.state.datauser = record;
  227. this.setState({
  228. rowClick:false,
  229. showDesc: true
  230. });
  231. },
  232. componentWillMount() {
  233. this.loadData()
  234. this.departmentList();
  235. },
  236. closeDesc(e, s) {
  237. this.state.userDetaile=false;
  238. this.state.showDesc = e;
  239. if (s) {
  240. this.loadData(this.state.pageNo);
  241. };
  242. },
  243. searchSwitch() {
  244. this.setState({
  245. searchMore: !this.state.searchMore
  246. });
  247. },
  248. search() {
  249. this.loadData();
  250. },
  251. reset() {
  252. this.state.draweeName='';
  253. this.state.payeeName='';
  254. this.state.term = undefined;
  255. this.state.orderNumber = '';
  256. this.state.confirmSignSearch=undefined;
  257. this.state.departmenttSearch = undefined;
  258. this.state.orderLeader = '';
  259. this.loadData();
  260. },
  261. tableRowClick(record, index) {
  262. this.state.userDetaile=true;
  263. this.state.datauser = record;
  264. this.setState({
  265. rowClick:true,
  266. signBillState:true,
  267. showDesc: true
  268. });
  269. },
  270. render() {
  271. const rowSelection = {
  272. selectedRowKeys: this.state.selectedRowKeys,
  273. onChange: (selectedRowKeys, selectedRows) => {
  274. this.setState({
  275. selectedRows: selectedRows.slice(-1),
  276. selectedRowKeys: selectedRowKeys.slice(-1)
  277. });
  278. },
  279. onSelectAll: (selected, selectedRows, changeRows) => {
  280. this.setState({
  281. selectedRowKeys:[]
  282. })
  283. },
  284. };
  285. let departmentArr = this.state.departmentArr || [];
  286. const hasSelected = this.state.selectedRowKeys.length > 0;
  287. return (
  288. <div className="user-content" >
  289. <div className="content-title">
  290. <span style={{fontSize:'16px'}}>结算流水管理</span>
  291. <div className="user-search">
  292. <Input placeholder="付款人名称" style={{width:'150px'}}
  293. value={this.state.draweeName}
  294. onChange={(e) => { this.setState({ draweeName: e.target.value }); }} />
  295. <Input placeholder="收款人名称" style={{width:'150px'}}
  296. value={this.state.payeeName}
  297. onChange={(e) => { this.setState({ payeeName: e.target.value }); }} />
  298. <Select placeholder="流水确认"
  299. style={{ width: 150 ,marginRight:'10px'}}
  300. value={this.state.confirmSignSearch}
  301. onChange={(e) => { this.setState({ confirmSignSearch: e }) }}>
  302. <Select.Option value='0'>待确认</Select.Option>
  303. <Select.Option value='1'>已确认</Select.Option>
  304. </Select>
  305. <Select placeholder="是否有效"
  306. style={{ width: 150 ,marginRight:'10px'}}
  307. value={this.state.term}
  308. onChange={(e) => { this.setState({ term: e }) }}>
  309. <Select.Option value='0'>有效</Select.Option>
  310. <Select.Option value='1'>作废</Select.Option>
  311. </Select>
  312. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
  313. <Button onClick={this.reset}>重置</Button>
  314. <span style={{marginLeft:'10px',marginRight:'20px'}}>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  315. </div>
  316. <div className='clearfix' style={{marginTop:'5px'}}>
  317. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  318. <Input placeholder="订单编号" style={{width:'150px'}}
  319. value={this.state.orderNumber}
  320. onChange={(e) => { this.setState({ orderNumber: e.target.value }); }} />
  321. <Select placeholder="订单部门"
  322. style={{ width: 150 ,marginRight:'10px',marginLeft:'10px'}}
  323. value={this.state.departmenttSearch}
  324. onChange={(e) => { this.setState({ departmenttSearch: e }) }}>
  325. {
  326. departmentArr.map(function (item) {
  327. return <Select.Option key={item.id} >{item.name}</Select.Option>
  328. })
  329. }
  330. </Select>
  331. <Input placeholder="订单负责人" style={{width:'150px',marginBottom:'10px'}}
  332. value={this.state.orderLeader}
  333. onChange={(e) => { this.setState({ orderLeader: e.target.value }); }} />
  334. </div>
  335. </div>
  336. <div className="patent-table">
  337. <Spin spinning={this.state.loading}>
  338. <Table columns={this.state.columns}
  339. dataSource={this.state.dataSource}
  340. rowSelection={rowSelection}
  341. pagination={this.state.pagination}
  342. onRowClick={this.tableRowClick}
  343. />
  344. </Spin>
  345. </div>
  346. <MyBillDetaile
  347. rowClick={this.state.rowClick}
  348. userDetaile={this.state.userDetaile}
  349. datauser={this.state.datauser}
  350. showDesc={this.state.showDesc}
  351. closeDesc={this.closeDesc} />
  352. </div >
  353. </div>
  354. );
  355. }
  356. }));
  357. export default MyBill;