index.jsx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. import React, { Component } from 'react';
  2. import $ from "jquery/src/ajax";
  3. import {
  4. Spin,
  5. Table,
  6. message,
  7. Tooltip, Tabs, Button, Modal
  8. } from "antd";
  9. import { ShowModal, getProjectStatus } from "@/tools";
  10. import FilterColumn from './filterColumn';
  11. import DetailsModal from './detailsModal/index';
  12. import OrderPaymentModal from './component/orderPaymentModal';
  13. import './index.less';
  14. import CheckProject from "../../../components/checkProject";
  15. import PayRecord from "../../../components/checkProject/payRecord";
  16. import { ChooseList } from "../../../order/orderNew/chooseList";
  17. import { getProjectName } from "../../../../tools";
  18. const { TabPane } = Tabs;
  19. class PayApplyReject extends Component {
  20. constructor(props) {
  21. super(props);
  22. this.state = {
  23. loading: true,
  24. columns: [
  25. {
  26. title: "支付编号",
  27. dataIndex: "key",
  28. key: "key",
  29. },
  30. {
  31. title: "项目编号",
  32. dataIndex: "tid",
  33. key: "tid",
  34. },
  35. {
  36. title: "项目名称",
  37. dataIndex: "pname",
  38. key: "pname",
  39. },
  40. {
  41. title: "项目状态",
  42. dataIndex: "projectStatus",
  43. key: "projectStatus",
  44. render: (text) => {
  45. return getProjectName(text);
  46. },
  47. },
  48. {
  49. title: "分类名称",
  50. dataIndex: "cname",
  51. key: "cname",
  52. },
  53. {
  54. title: "合同编号",
  55. dataIndex: "contractNo",
  56. key: "contractNo",
  57. },
  58. {
  59. title: "订单编号",
  60. dataIndex: "orderNo",
  61. key: "orderNo",
  62. },
  63. {
  64. title: "客户名称",
  65. dataIndex: "userName",
  66. key: "userName",
  67. width: 150,
  68. render: (text) => {
  69. return (
  70. <Tooltip title={text}>
  71. <div
  72. // style={{
  73. // maxWidth: '150px',
  74. // overflow: 'hidden',
  75. // textOverflow: "ellipsis",
  76. // whiteSpace: 'nowrap',
  77. // }}
  78. >{text}</div>
  79. </Tooltip>
  80. )
  81. },
  82. },
  83. {
  84. title: "部门名称",
  85. dataIndex: "depName",
  86. key: "depName",
  87. render: (text) => {
  88. return (
  89. <Tooltip placement="bottom" title={text && text.length > 9 ? text : ''}>
  90. {text && text.length > 9 ? text.substr(0, 9) + "..." : text}
  91. </Tooltip>
  92. )
  93. },
  94. },
  95. // {
  96. // title: "实际总付款",
  97. // dataIndex: "costAmount",
  98. // key: "costAmount",
  99. // },
  100. {
  101. title: "付款类型",
  102. dataIndex: "chooseType",
  103. key: "chooseType",
  104. render: (text) => {
  105. return text == 0 ? '第三方成本' :
  106. text == 1 ? '催款节点' : '官费';
  107. },
  108. },
  109. {
  110. title: "本次申请金额",
  111. dataIndex: "applicationAmount",
  112. key: "applicationAmount",
  113. render: (text) => {
  114. return isNaN(parseFloat(text)) ? text : parseFloat(text);
  115. }
  116. },
  117. {
  118. title: "已支付",
  119. dataIndex: "paymentAmount",
  120. key: "paymentAmount",
  121. render: (text) => {
  122. return isNaN(parseFloat(text)) ? text : parseFloat(text);
  123. },
  124. },
  125. {
  126. title: "供应商",
  127. dataIndex: "companyName",
  128. key: "companyName",
  129. },
  130. {
  131. title: "申请人",
  132. dataIndex: "aname",
  133. key: "aname",
  134. },
  135. {
  136. title: "财务名称",
  137. dataIndex: "financeName",
  138. key: "financeName",
  139. },
  140. {
  141. title: "状态",
  142. dataIndex: "status",
  143. key: "status",
  144. render: (text) => {
  145. return text === 0 ? '审核' :
  146. text === 1 ? '待支付' :
  147. text === 2 ? '驳回' :
  148. text === 3 ? '已支付' :
  149. text === 4 ? '已取消' : '';
  150. },
  151. },
  152. {
  153. title: "创建时间",
  154. dataIndex: "createTime",
  155. key: "createTime",
  156. },
  157. {
  158. title: '操作',
  159. dataIndex: 'action',
  160. key: 'action',
  161. render: (text, record) => {
  162. return (
  163. <div style={{
  164. display: 'flex',
  165. alignItems: 'center',
  166. }}>
  167. <Button type="primary" size="small" onClick={(e) => {
  168. e.stopPropagation();
  169. this.setState({
  170. payRecordVisible: true,
  171. orderPaymentsId: record.id,
  172. tid: record.tid,
  173. projectType: record.projectType,
  174. })
  175. }}>
  176. {
  177. record.status === 0 ? '待审核' :
  178. record.status === 1 ? '待支付' :
  179. record.status === 2 ? '查看详情' : '查看详情'
  180. }
  181. </Button>
  182. <Button
  183. type="primary"
  184. style={{
  185. marginLeft: "10px",
  186. background: "orangered",
  187. border: "none"
  188. }}
  189. size="small"
  190. onClick={(e) => {
  191. e.stopPropagation();
  192. this.setState({
  193. paymentVisible: true,
  194. tid: record.tid,
  195. projectType: record.projectType,
  196. })
  197. }}>
  198. 付款记录
  199. </Button>
  200. </div>
  201. )
  202. }
  203. }
  204. ],
  205. dataSource: [],
  206. selectedRowKeys: [],
  207. pagination: {
  208. defaultCurrent: 1,
  209. defaultPageSize: 10,
  210. showQuickJumper: true,
  211. pageSize: 10,
  212. onChange: function (page) {
  213. this.loadData(page, this.state.searchInfor);
  214. }.bind(this),
  215. showTotal: function (total) {
  216. return "共" + total + "条数据";
  217. },
  218. },
  219. page: 1,
  220. selectInfor: {},
  221. visible: false,
  222. paymentVisible: false,
  223. tid: 0,
  224. projectType: 0,
  225. payRecordVisible: false,
  226. orderPaymentsId: 0,
  227. }
  228. this.changeList = this.changeList.bind(this);
  229. }
  230. componentDidMount() {
  231. this.loadData()
  232. }
  233. loadData(pageNo, data = {}) {
  234. this.setState({
  235. loading: true,
  236. });
  237. data.pageNo = pageNo || 1;
  238. data.pageSize = this.state.pagination.pageSize;
  239. data.status = 2; //驳回状态
  240. data.permissionsGrade = 3;
  241. $.ajax({
  242. method: "get",
  243. dataType: "json",
  244. crossDomain: false,
  245. url: globalConfig.context + "/api/admin/company/selectPaymentList",
  246. data: data,
  247. success: function (data) {
  248. ShowModal(this);
  249. let theArr = [];
  250. if (data.error.length || data.data.list == "") {
  251. if (data.error && data.error.length) {
  252. message.warning(data.error[0].message);
  253. }
  254. } else {
  255. this.setState({
  256. page: data.data.pageNo
  257. });
  258. for (let i = 0; i < data.data.list.length; i++) {
  259. let thisdata = data.data.list[i];
  260. let obj = thisdata;
  261. obj.key = thisdata.id;
  262. theArr.push(obj);
  263. }
  264. this.state.pagination.total = data.data.totalCount;
  265. }
  266. if (data.data && data.data.list && !data.data.list.length) {
  267. this.state.pagination.total = 0;
  268. }
  269. this.setState({
  270. dataSource: theArr,
  271. pageNo: pageNo,
  272. pagination: this.state.pagination,
  273. });
  274. }.bind(this),
  275. }).always(
  276. function () {
  277. this.setState({
  278. loading: false,
  279. });
  280. }.bind(this)
  281. );
  282. }
  283. tableRowClick(record) {
  284. this.setState({
  285. visible: true,
  286. selectInfor: record,
  287. })
  288. }
  289. changeList(arr) {
  290. const newArr = [];
  291. this.state.columns.forEach(item => {
  292. arr.forEach(val => {
  293. if (val === item.title) {
  294. newArr.push(item);
  295. }
  296. });
  297. });
  298. this.setState({
  299. changeList: newArr
  300. });
  301. }
  302. render() {
  303. return (
  304. <div className="user-content">
  305. <div className="content-title" style={{ marginBottom: 10 }}>
  306. <span style={{ fontWeight: 900, fontSize: 16 }}>付款驳回列表</span>
  307. </div>
  308. <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
  309. <TabPane tab="搜索" key="1">
  310. <div style={{ paddingTop: '10px' }}>
  311. <FilterColumn
  312. {...this.props}
  313. onSearch={(data) => {
  314. this.setState({
  315. searchInfor: data
  316. });
  317. this.loadData(1, data);
  318. }}
  319. onResetSearch={() => {
  320. this.setState({
  321. searchInfor: {}
  322. });
  323. this.loadData();
  324. }}
  325. />
  326. </div>
  327. </TabPane>
  328. <TabPane tab="更改表格显示数据" key="2">
  329. <div style={{ marginLeft: 10 }}>
  330. <ChooseList
  331. columns={this.state.columns}
  332. changeFn={this.changeList}
  333. changeList={this.state.changeList}
  334. top={55}
  335. margin={11}
  336. />
  337. </div>
  338. </TabPane>
  339. </Tabs>
  340. <div className="patent-table">
  341. <Spin spinning={this.state.loading}>
  342. <Table
  343. columns={
  344. this.state.changeList
  345. ? this.state.changeList
  346. : this.state.columns
  347. }
  348. dataSource={this.state.dataSource}
  349. pagination={this.state.pagination}
  350. onRowClick={(record) => {
  351. this.tableRowClick(record)
  352. }}
  353. style={{
  354. cursor: 'pointer',
  355. }}
  356. scroll={{ x: "max-content", y: 0 }}
  357. bordered
  358. size="small"
  359. />
  360. </Spin>
  361. </div>
  362. {
  363. this.state.visible ?
  364. <DetailsModal
  365. tid={this.state.selectInfor.tid}
  366. orderNo={this.state.selectInfor.orderNo}
  367. projectType={this.state.selectInfor.projectType}
  368. projectStatus={this.state.selectInfor.projectStatus}
  369. taskName={this.state.selectInfor.pname}
  370. taskID={this.state.selectInfor.tid}
  371. visible={this.state.visible}
  372. refreshList={() => {
  373. this.loadData(this.state.page, this.state.searchInfor);
  374. }}
  375. visitCancel={() => {
  376. this.setState({
  377. visible: false
  378. })
  379. this.loadData(this.state.page, this.state.searchInfor);
  380. }} /> : <div />
  381. }
  382. {this.state.paymentVisible ?
  383. <OrderPaymentModal
  384. tid={this.state.tid}
  385. visible={this.state.paymentVisible}
  386. projectType={this.state.projectType}
  387. onCancer={() => {
  388. this.setState({
  389. paymentVisible: false,
  390. tid: 0,
  391. projectType: 0,
  392. });
  393. this.loadData(this.state.page, this.state.searchInfor);
  394. }}
  395. onSuccess={() => {
  396. this.setState({
  397. paymentVisible: false,
  398. tid: 0,
  399. projectType: 0,
  400. });
  401. this.loadData(this.state.page, this.state.searchInfor);
  402. }} /> :
  403. <div />
  404. }
  405. {this.state.payRecordVisible ? <PayRecord
  406. {...this.props}
  407. payId={this.state.orderPaymentsId}
  408. visible={this.state.payRecordVisible}
  409. tid={this.state.tid}
  410. projectType={this.state.projectType}
  411. changeVisible={() => {
  412. this.loadData(this.state.page, this.state.searchInfor);
  413. this.setState({
  414. payRecordVisible: false,
  415. orderPaymentsId: 0,
  416. tid: 0,
  417. projectType: 0,
  418. })
  419. }}
  420. /> : <div />}
  421. </div>
  422. );
  423. }
  424. }
  425. export default PayApplyReject