myWater.jsx 10 KB

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