index.jsx 16 KB

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