myWater.jsx 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. import React from 'react';
  2. import ajax from 'jquery/src/ajax/xhr.js';
  3. import $ from 'jquery/src/ajax';
  4. import moment from 'moment';
  5. import '../distribute/public.less';
  6. import { Button, Input, Spin, Table, Switch,Select, message, DatePicker } from 'antd';
  7. import {getTransactionProject} from '@/tools';
  8. import WaterDesc from './waterDetail';
  9. import { ChooseList } from "../../order/orderNew/chooseList";
  10. const MyWater = React.createClass({
  11. departmentList() {
  12. this.setState({
  13. loading: true
  14. });
  15. $.ajax({
  16. method: "get",
  17. dataType: "json",
  18. crossDomain: false,
  19. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  20. data: {},
  21. success: function(data) {
  22. let thedata = data.data;
  23. let theArr = [];
  24. if (!thedata) {
  25. if (data.error && data.error.length) {
  26. message.warning(data.error[0].message);
  27. }
  28. thedata = {};
  29. } else {
  30. thedata.map(function(item, index) {
  31. theArr.push({
  32. key: index,
  33. name: item.name,
  34. id: item.id
  35. });
  36. });
  37. }
  38. this.setState({
  39. departmentArr: theArr
  40. });
  41. }.bind(this)
  42. }).always(
  43. function() {
  44. this.setState({
  45. loading: false
  46. });
  47. }.bind(this)
  48. );
  49. },
  50. loadData(pageNo) {
  51. this.state.data = [];
  52. this.setState({
  53. selectedRowKeys: [],
  54. selectedRowKey: [],
  55. page: pageNo,
  56. loading: true
  57. });
  58. $.ajax({
  59. method: "get",
  60. dataType: "json",
  61. crossDomain: false,
  62. url: globalConfig.context + "/api/admin/financial/myBillList",
  63. data: {
  64. pageNo: pageNo || 1,
  65. pageSize: this.state.pagination.pageSize,
  66. payeeName: this.state.payeeNameSearch,
  67. payerName: this.state.payerNameSearch,
  68. startTime: this.state.releaseDate[0],
  69. endTime: this.state.releaseDate[1],
  70. orderNo: this.state.orderNo,
  71. departmentId: this.state.departmentId
  72. },
  73. success: function(data) {
  74. let theArr = [];
  75. if (!data.data || !data.data.list) {
  76. if (data.error && data.error.length) {
  77. message.warning(data.error[0].message);
  78. }
  79. } else {
  80. for (let i = 0; i < data.data.list.length; i++) {
  81. let thisdata = data.data.list[i];
  82. theArr.push({
  83. key: i,
  84. orderNo: thisdata.orderNo,
  85. billNo: thisdata.billNo,
  86. transactionAmount: thisdata.transactionAmount,
  87. payeeName: thisdata.payeeName,
  88. payerName: thisdata.payerName,
  89. transactionSubject: thisdata.transactionSubject,
  90. transactionChannel: thisdata.transactionChannel,
  91. financialPayTimes: thisdata.financialPayTimes
  92. ? new Date(thisdata.financialPayTimes).toLocaleDateString()
  93. : "",
  94. financialPayNo: thisdata.financialPayNo,
  95. createrName: thisdata.createrName,
  96. saleName: thisdata.saleName,
  97. createTimes: thisdata.createTimes,
  98. type: thisdata.type == 0 ? "手工" : "批量"
  99. });
  100. }
  101. }
  102. this.state.pagination.current = data.data.pageNo;
  103. this.state.pagination.total = data.data.totalCount;
  104. if (data.data && data.data.list && !data.data.list.length) {
  105. this.state.pagination.current = 0;
  106. this.state.pagination.total = 0;
  107. }
  108. this.setState({
  109. dataSource: theArr,
  110. pagination: this.state.pagination
  111. });
  112. }.bind(this)
  113. }).always(
  114. function() {
  115. this.setState({
  116. loading: false
  117. });
  118. }.bind(this)
  119. );
  120. },
  121. getInitialState() {
  122. return {
  123. searchMore: true,
  124. releaseDate: [],
  125. RowData: {},
  126. selectedRowKeys: [],
  127. selectedRows: [],
  128. loading: false,
  129. // 子组件改变的表格title数组
  130. changeList: undefined,
  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. // fixed: "left"
  149. },
  150. {
  151. title: "金额(万元)",
  152. dataIndex: "transactionAmount",
  153. key: "transactionAmount"
  154. },
  155. {
  156. title: "收款方",
  157. dataIndex: "payeeName",
  158. key: "payeeName"
  159. },
  160. {
  161. title: "付款方",
  162. dataIndex: "payerName",
  163. key: "payerName"
  164. },
  165. {
  166. title: "流水科目",
  167. dataIndex: "transactionSubject",
  168. key: "transactionSubject",
  169. render: text => {
  170. return getTransactionProject(text);
  171. }
  172. },
  173. {
  174. title: "收款类型",
  175. dataIndex: "type",
  176. key: "type"
  177. },
  178. {
  179. title: "财务流水时间",
  180. dataIndex: "financialPayTimes",
  181. key: "financialPayTimes"
  182. },
  183. {
  184. title: "财务流水号",
  185. dataIndex: "financialPayNo",
  186. key: "financialPayNo"
  187. },
  188. {
  189. title: "订单编号",
  190. dataIndex: "orderNo",
  191. key: "orderNo"
  192. },
  193. {
  194. title: "订单负责人",
  195. dataIndex: "saleName",
  196. key: "saleName"
  197. },
  198. {
  199. title: "创建时间",
  200. dataIndex: "createTimes",
  201. key: "createTimes"
  202. }
  203. ],
  204. dataSource: [],
  205. searchTime: [,]
  206. };
  207. },
  208. componentWillMount() {
  209. this.loadData();
  210. this.departmentList();
  211. },
  212. tableRowClick(record, index) {
  213. this.state.RowData = record;
  214. this.setState({
  215. showDesc: true
  216. });
  217. },
  218. closeDesc(e, s) {
  219. this.state.RowData = {};
  220. this.state.showDesc = e;
  221. if (s) {
  222. this.loadData(this.state.page);
  223. }
  224. },
  225. search() {
  226. this.loadData();
  227. },
  228. reset() {
  229. this.state.orderNo = "";
  230. this.state.payeeNameSearch = "";
  231. this.state.releaseDate = [];
  232. this.state.departmentId = undefined;
  233. this.state.payerNameSearch = "";
  234. this.loadData();
  235. },
  236. searchSwitch() {
  237. this.setState({
  238. searchMore: !this.state.searchMore
  239. });
  240. },
  241. changeList(arr) {
  242. const newArr = [];
  243. this.state.columns.forEach(item => {
  244. arr.forEach(val => {
  245. if (val === item.title) {
  246. newArr.push(item);
  247. }
  248. });
  249. });
  250. this.setState({
  251. changeList: newArr
  252. });
  253. },
  254. render() {
  255. const rowSelection = {
  256. selectedRowKeys: this.state.selectedRowKeys,
  257. onChange: (selectedRowKeys, selectedRows) => {
  258. this.setState({
  259. selectedRows: selectedRows.slice(-1),
  260. selectedRowKeys: selectedRowKeys.slice(-1)
  261. });
  262. }
  263. };
  264. const hasSelected = this.state.selectedRowKeys.length > 0;
  265. const { RangePicker } = DatePicker;
  266. var departmentArr = this.state.departmentArr || [];
  267. return (
  268. <div className="user-content">
  269. <div className="content-title">
  270. <span>我的流水订单</span>
  271. </div>
  272. <div className="user-search">
  273. <Input
  274. placeholder="订单编号"
  275. value={this.state.orderNo}
  276. onChange={e => {
  277. this.setState({ orderNo: e.target.value });
  278. }}
  279. />
  280. <Input
  281. placeholder="收款方"
  282. value={this.state.payeeNameSearch}
  283. onChange={e => {
  284. this.setState({ payeeNameSearch: e.target.value });
  285. }}
  286. />
  287. <Input
  288. placeholder="付款方"
  289. value={this.state.payerNameSearch}
  290. onChange={e => {
  291. this.setState({ payerNameSearch: e.target.value });
  292. }}
  293. />
  294. <Select
  295. placeholder="订单部门"
  296. style={{ width: 150, marginRight: 10 }}
  297. value={this.state.departmentId}
  298. onChange={e => {
  299. this.setState({ departmentId: e });
  300. }}
  301. >
  302. {departmentArr.map(function(item) {
  303. return <Select.Option key={item.id}>{item.name}</Select.Option>;
  304. })}
  305. </Select>
  306. <span style={{ marginRight: 10 }}>流水时间 :</span>
  307. <RangePicker
  308. value={[
  309. this.state.releaseDate[0]
  310. ? moment(this.state.releaseDate[0])
  311. : null,
  312. this.state.releaseDate[1]
  313. ? moment(this.state.releaseDate[1])
  314. : null
  315. ]}
  316. onChange={(data, dataString) => {
  317. this.setState({ releaseDate: dataString });
  318. }}
  319. />
  320. <Button
  321. type="primary"
  322. onClick={this.search}
  323. style={{ marginLeft: 10 }}
  324. >
  325. 搜索
  326. </Button>
  327. <Button onClick={this.reset}>重置</Button>
  328. </div>
  329. <ChooseList
  330. columns={this.state.columns}
  331. changeFn={this.changeList}
  332. changeList={this.state.changeList}
  333. top={55}
  334. />
  335. <div className="patent-table">
  336. <Spin spinning={this.state.loading}>
  337. <Table
  338. bordered
  339. columns={
  340. this.state.changeList == undefined
  341. ? this.state.columns
  342. : this.state.changeList
  343. }
  344. dataSource={this.state.dataSource}
  345. scroll={{ x: 1500, y: 0 }}
  346. rowSelection={false}
  347. pagination={this.state.pagination}
  348. onRowClick={this.tableRowClick}
  349. />
  350. </Spin>
  351. </div>
  352. <WaterDesc
  353. data={this.state.RowData}
  354. showDesc={this.state.showDesc}
  355. closeDesc={this.closeDesc.bind(this)}
  356. />
  357. </div>
  358. );
  359. }
  360. });
  361. export default MyWater;