index.jsx 16 KB

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