index.jsx 16 KB

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