contractYxgly.js 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512
  1. import React from "react";
  2. import { Button, Input, Spin, Table, message, Form, Modal, Tabs, Tooltip } from "antd";
  3. import $ from "jquery/src/ajax";
  4. import {
  5. getNewOrderStatus,
  6. getProcessStatusNew,
  7. splitUrl,
  8. getjiedian,
  9. getboutique,
  10. getCuikuan,
  11. getProjectStatus,
  12. ShowModal,
  13. getType
  14. } from "@/tools.js";
  15. import "./customer.less";
  16. import { ChangeDetail } from "./changeComponent/changeDetailYxgly.js";
  17. import { SearchInput } from "./changeComponent/searchInput.js";
  18. import OrderDetail from "./changeComponent/orderDetail";
  19. import ShowModalDiv from "@/showModal.jsx";
  20. import OrderRiZi from "@/orderRiZi.jsx";
  21. import { ChooseList } from "./chooseList";
  22. import { getProjectName } from "../../../tools";
  23. import ProjectDetailsReadOnly from "../../../common/projectDetailsReadOnly";
  24. import NewEditProject from "../../../common/projectOperation/newEditProject";
  25. import OrderItemStatus from "../../../common/orderItemStatus";
  26. const contractChange = Form.create()(
  27. React.createClass({
  28. loadData(pageNo) {
  29. this.setState({
  30. loading: true
  31. });
  32. $.ajax({
  33. method: "get",
  34. dataType: "json",
  35. crossDomain: false,
  36. url: globalConfig.context + "/api/admin/orderChange/orderChangeList",
  37. data: {
  38. pageNo: pageNo || 1,
  39. pageSize: this.state.pagination.pageSize,
  40. userName: this.state.searchData.userNameSearch,
  41. orderNo: this.state.searchData.orderNoSearch,
  42. contractNo: this.state.searchData.contractNoSearch,
  43. processState: this.props.processState,
  44. timeType: this.state.searchData.timeTypeSearch,
  45. startTime: this.state.searchData.releaseDate[0],
  46. endTime: this.state.searchData.releaseDate[1],
  47. salesmanName: this.state.searchData.salesmanNameSearch,
  48. complete: this.state.searchData.completeSearch || 1,
  49. deps: this.state.searchData.deps,
  50. type: this.state.searchData.changeSearch
  51. },
  52. success: function (data) {
  53. ShowModal(this);
  54. let theArr = [];
  55. if (data.error.length || data.data.list == "") {
  56. if (data.error && data.error.length) {
  57. message.warning(data.error[0].message);
  58. }
  59. } else {
  60. for (let i = 0; i < data.data.list.length; i++) {
  61. let thisdata = data.data.list[i];
  62. theArr.push({
  63. key: i,
  64. orderNo: thisdata.orderNo,
  65. createTimes: thisdata.createTimes,
  66. nickname: thisdata.nickname,
  67. orderType: thisdata.orderType,
  68. establishTimes: thisdata.establishTimes,
  69. orderStatus: thisdata.orderStatus,
  70. totalAmount: thisdata.totalAmount,
  71. settlementAmount: thisdata.settlementAmount,
  72. arrears: thisdata.arrears,
  73. salesmanName: thisdata.salesmanName,
  74. depName: thisdata.depName,
  75. processState: thisdata.processState,
  76. type: thisdata.type,
  77. status: thisdata.status,
  78. id: thisdata.id,
  79. contractNo: thisdata.contractNo,
  80. processStateText: getProcessStatusNew(
  81. thisdata.examineName,
  82. thisdata.processState,
  83. thisdata.status
  84. )
  85. });
  86. }
  87. this.state.pagination.total = data.data.totalCount;
  88. this.state.pagination.current = data.data.pageNo;
  89. }
  90. if (data.data && data.data.list && !data.data.list.length) {
  91. this.state.pagination.total = 0;
  92. }
  93. this.setState({
  94. dataSource: theArr,
  95. pageNo: pageNo,
  96. pagination: this.state.pagination
  97. });
  98. }.bind(this)
  99. }).always(
  100. function () {
  101. this.setState({
  102. loading: false
  103. });
  104. }.bind(this)
  105. );
  106. },
  107. getInitialState() {
  108. return {
  109. pageNo: 1,
  110. searchData: {
  111. releaseDate: []
  112. },
  113. declarationBatch: 1,
  114. dataInfor: {},
  115. primaryOrderData: {}, //原订单数据
  116. orderData: {}, //现订单数据
  117. pictureUrl: [],
  118. voucherUrl: [],
  119. attachment: [],
  120. attachmentUrl: [],
  121. contractData: {},
  122. additionalOrderData: {},
  123. proceedsData: [],
  124. orderNos: '',
  125. paginations: false,
  126. activeKey: "a",
  127. confirmLoading: false,
  128. aloading: false,
  129. pagination: {
  130. defaultCurrent: 1,
  131. defaultPageSize: 10,
  132. showQuickJumper: true,
  133. pageSize: 10,
  134. onChange: function (pageNo) {
  135. this.loadData(pageNo);
  136. }.bind(this),
  137. showTotal: function (total) {
  138. return "共" + total + "条数据";
  139. }
  140. },
  141. columns: [
  142. {
  143. title: "合同编号",
  144. dataIndex: "contractNo",
  145. key: "contractNo"
  146. },
  147. {
  148. title: "订单编号",
  149. dataIndex: "orderNo",
  150. key: "orderNo"
  151. },
  152. {
  153. title: "客户名称",
  154. dataIndex: "nickname",
  155. key: "nickname",
  156. render: text => {
  157. return (
  158. <Tooltip title={text}>
  159. <div
  160. // style={{
  161. // maxWidth: '150px',
  162. // overflow: 'hidden',
  163. // textOverflow: "ellipsis",
  164. // whiteSpace: 'nowrap',
  165. // }}
  166. >{text}</div>
  167. </Tooltip>
  168. )
  169. }
  170. },
  171. {
  172. title: "订单部门",
  173. dataIndex: "depName",
  174. key: "depName"
  175. },
  176. {
  177. title: "订单类型",
  178. dataIndex: "orderType",
  179. key: "orderType",
  180. render: text => {
  181. return text ? "科技项目" : "认证项目";
  182. }
  183. },
  184. {
  185. title: "下单时间",
  186. dataIndex: "establishTimes",
  187. key: "establishTimes"
  188. },
  189. {
  190. title: "订单状态",
  191. dataIndex: "orderStatus",
  192. key: "orderStatus",
  193. render: text => {
  194. return getNewOrderStatus(text);
  195. }
  196. },
  197. {
  198. title: "合同额(万元)",
  199. dataIndex: "totalAmount",
  200. key: "totalAmount"
  201. },
  202. {
  203. title: "已付额(万元)",
  204. dataIndex: "settlementAmount",
  205. key: "settlementAmount"
  206. },
  207. {
  208. title: "欠款(万元)",
  209. dataIndex: "arrears",
  210. key: "arrears"
  211. },
  212. {
  213. title: "订单负责人",
  214. dataIndex: "salesmanName",
  215. key: "salesmanName"
  216. },
  217. {
  218. title: "变更类型",
  219. dataIndex: "type",
  220. key: "type",
  221. render: text => {
  222. return getType(text);
  223. }
  224. },
  225. {
  226. title: "审核状态",
  227. dataIndex: "processStateText",
  228. key: "processStateText"
  229. },
  230. {
  231. title: "提交时间",
  232. dataIndex: "createTimes",
  233. key: "createTimes"
  234. }
  235. ],
  236. dataSource: [],
  237. // 传递给子组件的
  238. dataProps: [],
  239. columnsX: [
  240. {
  241. title: "业务项目名称",
  242. dataIndex: "commodityName",
  243. key: "commodityName",
  244. render: (text, record) => {
  245. return (
  246. <span>{text}<span style={{ color: "red" }}>{record.patentTypeName}</span></span>
  247. )
  248. }
  249. },
  250. {
  251. title: "项目类别",
  252. dataIndex: "cname",
  253. key: "cname"
  254. },
  255. {
  256. title: "项目数量",
  257. dataIndex: "commodityQuantity",
  258. key: "commodityQuantity"
  259. },
  260. {
  261. title: "金额(万元)",
  262. dataIndex: "commodityPrice",
  263. key: "commodityPrice"
  264. },
  265. {
  266. title: "负责人",
  267. dataIndex: "contacts",
  268. key: "contacts"
  269. },
  270. {
  271. title: "负责人电话",
  272. dataIndex: "contactsMobile",
  273. key: "contactsMobile"
  274. },
  275. {
  276. title: "项目状态",
  277. dataIndex: "projectStatus",
  278. key: "projectStatus",
  279. render: text => {
  280. return getProjectName(text);
  281. }
  282. },
  283. {
  284. title: "主要项目",
  285. dataIndex: "main",
  286. key: "main",
  287. render: text => {
  288. return text ? "是" : "否";
  289. }
  290. },
  291. {
  292. title: "总年限",
  293. dataIndex: "yearSum",
  294. key: "yearSum",
  295. render: (text, record) => {
  296. return (
  297. <div>{["", "一年", "二年", "三年", "四年", "五年"][text]}</div>
  298. );
  299. }
  300. },
  301. {
  302. title: "年限",
  303. dataIndex: "serviceLife",
  304. key: "serviceLife",
  305. render: (text, record) => {
  306. return (
  307. <div>{!!text && JSON.parse(text).toString()}</div>
  308. );
  309. }
  310. },
  311. {
  312. title: "本次派单",
  313. dataIndex: "serviceYear",
  314. key: "serviceYear",
  315. render: (text, record) => {
  316. return (
  317. <div>{!text ? "" : text}</div>
  318. );
  319. }
  320. },
  321. {
  322. title: "项目说明",
  323. dataIndex: "taskComment",
  324. key: "taskComment",
  325. render: text => {
  326. return (
  327. <Tooltip title={text}>
  328. <div
  329. style={{
  330. width: 100,
  331. overflow: "hidden",
  332. whiteSpace: "nowrap",
  333. textOverflow: "ellipsis",
  334. }}
  335. >{text}</div>
  336. </Tooltip>
  337. )
  338. }
  339. }
  340. ],
  341. columnsrizhi: [
  342. {
  343. title: "流程",
  344. dataIndex: "processName",
  345. key: "processName"
  346. },
  347. {
  348. title: "操作人",
  349. dataIndex: "adminName",
  350. key: "adminName"
  351. },
  352. {
  353. title: "时间",
  354. dataIndex: "createDate",
  355. key: "createDate"
  356. }
  357. ],
  358. dataSourceX: [],
  359. ContactsLists: [
  360. {
  361. title: "催款科目",
  362. dataIndex: "dunSubject",
  363. key: "dunSubject",
  364. render: text => {
  365. return getjiedian(text);
  366. }
  367. },
  368. {
  369. title: "金额(万元)",
  370. dataIndex: "money",
  371. key: "money"
  372. },
  373. {
  374. title: "催款状态",
  375. dataIndex: "dunStatus",
  376. key: "dunStatus",
  377. render: text => {
  378. return getCuikuan(text);
  379. }
  380. }
  381. ]
  382. };
  383. },
  384. //页面加载函数
  385. componentWillMount() {
  386. this.loadData();
  387. },
  388. //整行点击
  389. tableRowClick(record) {
  390. this.setState(
  391. {
  392. visible: true,
  393. type: record.type,
  394. status: record.status,
  395. buttonStatus: true,
  396. orderStatus: record.orderStatus,
  397. processStateText: record.processStateText,
  398. id: record.id,
  399. orderNo: record.orderNo
  400. },
  401. () => {
  402. this.xiangqing(record.orderNo);
  403. this.xiangmu(record.orderNo);
  404. this.jiedian(record.orderNo);
  405. this.jiedianNew(record.orderNo);
  406. this.createTabs();
  407. }
  408. );
  409. },
  410. //点击打卡项目详情
  411. tableRowClickX(record) {
  412. this.setState({
  413. jid: record.id, //项目ID
  414. kid: record.commodityId, //商品ID
  415. commodityName: record.commodityName, //金额
  416. commodityPrice: record.commodityPrice, //金额
  417. commodityQuantity: record.commodityQuantity, //数量
  418. taskComment: record.taskComment, //备注
  419. main: record.main.toString(), //是否为主要
  420. addnextVisible: true,
  421. dataInfor: record,
  422. addState: 0
  423. });
  424. },
  425. //项目详情关闭
  426. nextCancel() {
  427. this.setState({
  428. addnextVisible: false
  429. });
  430. },
  431. // 合同变更详情
  432. ChangeDetail(key) {
  433. let url = window.location.href.substring(7);
  434. $.ajax({
  435. method: "get",
  436. dataType: "json",
  437. crossDomain: false,
  438. url:
  439. globalConfig.context +
  440. "/api/admin/orderChange/orderChangeDetailsById",
  441. data: {
  442. id: key
  443. },
  444. success: function (data) {
  445. if (data.data) {
  446. let thisdata = data.data;
  447. Object.assign(thisdata, {
  448. processStateText: this.state.processStateText,
  449. userName: this.state.userName,
  450. contractNo: this.state.contractNo
  451. });
  452. this.setState({
  453. contractData: thisdata,
  454. voucherUrl: thisdata.voucherUrl
  455. ? splitUrl(
  456. thisdata.voucherUrl,
  457. ",",
  458. globalConfig.avatarHost + "/upload",
  459. url
  460. )
  461. : [],
  462. attachment: thisdata.attachmentUrl
  463. ? splitUrl(
  464. thisdata.attachmentUrl,
  465. ",",
  466. globalConfig.avatarHost + "/upload",
  467. url
  468. )
  469. : [],
  470. contractPictureUrl: thisdata.contractPictureUrl
  471. ? splitUrl(
  472. thisdata.contractPictureUrl,
  473. ",",
  474. globalConfig.avatarHost + "/upload",
  475. url
  476. )
  477. : []
  478. });
  479. }
  480. }.bind(this)
  481. });
  482. $.ajax({
  483. method: "get",
  484. dataType: "json",
  485. crossDomain: false,
  486. url:
  487. globalConfig.context +
  488. "/api/admin/orderChange/listOrderInvoiceAndBill",
  489. data: {
  490. orderNo: this.state.orderNo
  491. },
  492. success: function (data) {
  493. if (!data.data) return;
  494. let proTotal = 0;
  495. let invTotal = 0;
  496. data.data.bill.forEach(item => {
  497. proTotal += item.transactionAmount;
  498. });
  499. data.data.invoice.forEach(item => {
  500. invTotal += item.amount;
  501. });
  502. this.setState({
  503. proceedsData: data.data,
  504. // orderNos:this.state.orderNo,
  505. proTotal: (Math.round(proTotal * 10000) / 10000).toFixed(4),
  506. invTotal: (Math.round(invTotal * 10000) / 10000).toFixed(4),
  507. });
  508. }.bind(this)
  509. });
  510. $.ajax({
  511. method: "get",
  512. dataType: "json",
  513. crossDomain: false,
  514. url:
  515. globalConfig.context +
  516. "/api/admin/orderChange/listOrderRefundInvoice",
  517. data: {
  518. orderNo: this.state.orderNo
  519. },
  520. success: data => {
  521. if (!data) return;
  522. data.data.forEach(item => {
  523. item.load = true;
  524. });
  525. this.setState({
  526. refundInvoice: data.data
  527. });
  528. }
  529. });
  530. },
  531. //订单详情
  532. xiangqing(orderNos) {
  533. $.ajax({
  534. method: "get",
  535. dataType: "json",
  536. crossDomain: false,
  537. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  538. data: {
  539. orderNo: orderNos
  540. },
  541. success: function (data) {
  542. if (data.error.length || data.data.list == "") {
  543. if (data.error && data.error.length) {
  544. message.warning(data.error[0].message);
  545. }
  546. } else {
  547. let thisdata = data.data;
  548. this.setState({
  549. orderUid: thisdata.uid,
  550. userName: thisdata.userName,
  551. primaryOrderNo: thisdata.primaryOrder,
  552. additionalOrder: thisdata.additionalOrder,
  553. contractNo: thisdata.contractNo,
  554. // arrears: thisdata.arrears,
  555. orderData: thisdata,
  556. isAddition: thisdata.additionalOrder ? true : false,
  557. deleteSign: thisdata.deleteSign,
  558. });
  559. }
  560. }.bind(this)
  561. });
  562. },
  563. // 原订单数据
  564. primaryOrder(primaryOrder) {
  565. $.ajax({
  566. method: "get",
  567. dataType: "json",
  568. crossDomain: false,
  569. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  570. data: {
  571. orderNo: primaryOrder
  572. },
  573. success: function (data) {
  574. if (data.error.length || data.data.list == "") {
  575. if (data.error && data.error.length) {
  576. message.warning(data.error[0].message);
  577. }
  578. } else {
  579. let thisdata = data.data;
  580. this.setState({
  581. primaryOrderData: thisdata
  582. });
  583. }
  584. }.bind(this)
  585. });
  586. },
  587. // 附加订单数据
  588. additionalOrder(additionalOrder) {
  589. $.ajax({
  590. method: "get",
  591. dataType: "json",
  592. crossDomain: false,
  593. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  594. data: {
  595. orderNo: additionalOrder
  596. },
  597. success: function (data) {
  598. if (data.error.length || data.data.list == "") {
  599. if (data.error && data.error.length) {
  600. message.warning(data.error[0].message);
  601. }
  602. } else {
  603. let thisdata = data.data;
  604. this.setState({
  605. additionalOrderData: thisdata
  606. });
  607. }
  608. }.bind(this)
  609. });
  610. },
  611. //项目列表
  612. xiangmu(orderNos) {
  613. $.ajax({
  614. method: "get",
  615. dataType: "json",
  616. crossDomain: false,
  617. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  618. data: {
  619. orderNo: orderNos
  620. },
  621. success: function (data) {
  622. let theArr = [];
  623. if (data.error.length || data.data.list == "") {
  624. if (data.error && data.error.length) {
  625. message.warning(data.error[0].message);
  626. }
  627. } else {
  628. for (let i = 0; i < data.data.length; i++) {
  629. let thisdata = data.data[i];
  630. thisdata.key = i;
  631. thisdata.sort = thisdata.cSort;
  632. theArr.push(thisdata);
  633. }
  634. }
  635. this.setState({
  636. dataSourceX: theArr
  637. });
  638. }.bind(this)
  639. });
  640. },
  641. search(obj) {
  642. this.setState({
  643. searchData: obj
  644. }, () => {
  645. this.loadData(1);
  646. })
  647. },
  648. rizhi(orderNo) {
  649. $.ajax({
  650. method: "get",
  651. dataType: "json",
  652. crossDomain: false,
  653. url: "/api/admin/newOrder/selectOrderLog",
  654. data: {
  655. orderNo: orderNo
  656. },
  657. success: function (data) {
  658. let theArr = [];
  659. let thisData = data.data;
  660. if (!thisData.length) {
  661. if (data.error && data.error.length) {
  662. message.warning(data.error[0].message);
  663. }
  664. thisData = {};
  665. } else {
  666. for (let i = 0; i < data.data.length; i++) {
  667. let thisdata = data.data[i];
  668. theArr.push({
  669. processName: thisdata.processName,
  670. adminName: thisdata.adminName,
  671. createDate: thisdata.createDate,
  672. remarks: thisdata.remarks
  673. });
  674. }
  675. }
  676. this.setState({
  677. dataSourcerizhi: theArr
  678. });
  679. }.bind(this)
  680. });
  681. },
  682. getOrderLog(orderNo) {
  683. this.setState({
  684. rizhivisible: true
  685. });
  686. this.rizhi(orderNo);
  687. },
  688. closeOrderLog() {
  689. this.setState({
  690. rizhivisible: false
  691. });
  692. },
  693. //节点列表
  694. jiedian(orderNos) {
  695. $.ajax({
  696. method: "get",
  697. dataType: "json",
  698. crossDomain: false,
  699. url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",
  700. data: {
  701. orderNo: orderNos
  702. },
  703. success: function (data) {
  704. let theArr = [];
  705. let thisData = [];
  706. if (data.error.length || data.data.list == "") {
  707. if (data.error && data.error.length) {
  708. message.warning(data.error[0].message);
  709. }
  710. } else {
  711. for (let i = 0; i < data.data.length; i++) {
  712. thisData = data.data[i];
  713. theArr.push({
  714. key: i,
  715. dunSubject: thisData.dunSubject
  716. ? thisData.dunSubject.toString()
  717. : "", //催款科目
  718. id: thisData.id, //节点Id
  719. money: thisData.money, //催款金额
  720. dunStatus: thisData.dunStatus //催款状态
  721. });
  722. }
  723. this.setState({
  724. contactList: theArr
  725. });
  726. }
  727. }.bind(this)
  728. });
  729. },
  730. jiedianNew(orderNos) {
  731. $.ajax({
  732. method: "get",
  733. dataType: "json",
  734. crossDomain: false,
  735. url:
  736. globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
  737. data: {
  738. orderNo: orderNos
  739. },
  740. success: function (data) {
  741. if (data.error && data.error.length) {
  742. message.warning(data.error[0].message);
  743. } else {
  744. let theArr = [];
  745. let thisData = [];
  746. let arr = data.data || [];
  747. let totalCui = 0;
  748. for (let i = 0; i < arr.length; i++) {
  749. thisData = arr[i];
  750. totalCui += +thisData.money;
  751. theArr.push({
  752. key: i,
  753. dunSubject: thisData.dunSubject
  754. ? thisData.dunSubject.toString()
  755. : "", //催款科目
  756. id: thisData.id, //节点Id
  757. money: thisData.money, //催款金额
  758. // orderNo: record ? record.orderNo : this.props.datauser.orderNo,
  759. commodityName: thisData.commodityName,
  760. projectType: thisData.projectType,
  761. dunTypeName: thisData.dunTypeName,
  762. status: thisData.status,
  763. waitDay: thisData.waitDay,
  764. effectiveCount: thisData.effectiveCount,
  765. startDate: thisData.startDate,
  766. dunType: thisData.dunType,
  767. appropriationRatio: thisData.appropriationRatio,
  768. customizeName: thisData.customizeName,
  769. customizeTimes: thisData.customizeTimes,
  770. tid: thisData.tid,
  771. });
  772. }
  773. if (!totalCui) {
  774. totalCui = 0;
  775. }
  776. totalCui = (Math.round(totalCui * 10000) / 10000).toFixed(4);
  777. this.setState({
  778. contactListNew: theArr,
  779. totalCui
  780. });
  781. }
  782. }.bind(this)
  783. }).always(
  784. function () {
  785. this.setState({
  786. loading: false
  787. });
  788. }.bind(this)
  789. );
  790. },
  791. //审核通过
  792. examOk() {
  793. $.ajax({
  794. method: "post",
  795. dataType: "json",
  796. crossDomain: false,
  797. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  798. data: {
  799. orderNo: this.state.orderNo,
  800. orderStatus: 2
  801. },
  802. success: function (data) {
  803. if (data.error.length || data.data.list == "") {
  804. if (data.error && data.error.length) {
  805. message.warning(data.error[0].message);
  806. }
  807. } else {
  808. message.success("该订单已通过审核~");
  809. this.setState({
  810. visible: false
  811. });
  812. this.reset();
  813. }
  814. }.bind(this)
  815. }).always(
  816. function () {
  817. this.setState({
  818. loading: false
  819. });
  820. }.bind(this)
  821. );
  822. },
  823. //通过发给外包
  824. outsourcing() {
  825. $.ajax({
  826. method: "post",
  827. dataType: "json",
  828. crossDomain: false,
  829. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  830. data: {
  831. orderNo: this.state.orderNo,
  832. orderStatus: 2,
  833. outsource: 1
  834. },
  835. success: function (data) {
  836. if (data.error.length || data.data.list == "") {
  837. if (data.error && data.error.length) {
  838. message.warning(data.error[0].message);
  839. }
  840. } else {
  841. message.success("该订单已通过审核~");
  842. this.setState({
  843. visible: false
  844. });
  845. this.reset();
  846. }
  847. }.bind(this)
  848. }).always(
  849. function () {
  850. this.setState({
  851. loading: false
  852. });
  853. }.bind(this)
  854. );
  855. },
  856. //审核不通过
  857. examOks() {
  858. this.setState({
  859. aloading: true
  860. });
  861. $.ajax({
  862. method: "post",
  863. dataType: "json",
  864. crossDomain: false,
  865. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  866. data: {
  867. orderNo: this.state.orderNo,
  868. orderStatus: 3,
  869. reason: this.state.reason
  870. },
  871. success: function (data) {
  872. if (data.error.length || data.data.list == "") {
  873. if (data.error && data.error.length) {
  874. message.warning(data.error[0].message);
  875. this.setState({
  876. aloading: true
  877. });
  878. }
  879. } else {
  880. message.success("该订单已被拒绝~");
  881. this.setState({
  882. visible: false,
  883. aloading: false,
  884. noVisible: false,
  885. reason: ""
  886. });
  887. this.reset();
  888. }
  889. }.bind(this)
  890. }).always(
  891. function () {
  892. this.setState({
  893. loading: false
  894. });
  895. }.bind(this)
  896. );
  897. },
  898. //点击拒绝
  899. examNo() {
  900. this.setState({
  901. noVisible: true
  902. });
  903. },
  904. // componentDidMount(){
  905. // window.setTimeout(() => {
  906. // console.log(this.state.dataProps);
  907. // },100)
  908. // },
  909. loadDataChange(key) {
  910. $.ajax({
  911. method: "get",
  912. dataType: "json",
  913. async: false,
  914. crossDomain: false,
  915. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  916. data: {
  917. changeId: key
  918. },
  919. success: function (data) {
  920. if (data.error.length || data.data.list == "") {
  921. if (data.error && data.error.length) {
  922. message.warning(data.error[0].message);
  923. }
  924. } else {
  925. // console.log("拿到历史", data.data);
  926. this.setState({
  927. dataProps: data.data
  928. });
  929. }
  930. }.bind(this)
  931. });
  932. },
  933. callback(key) {
  934. this.setState(
  935. {
  936. activeKey: key
  937. },
  938. () => {
  939. if (key != "a" && key != "c" && key.length < 10) {
  940. this.ChangeDetail(key);
  941. this.loadDataChange(key);
  942. } else if (key != "a" && key != "c" && key.length > 10) {
  943. this.primaryOrder(key);
  944. this.xiangmu(key);
  945. this.jiedian(key);
  946. this.jiedianNew(key);
  947. this.loadDataChange(key);
  948. }
  949. }
  950. );
  951. if (key === "a") {
  952. this.xiangmu(this.state.orderNo);
  953. this.jiedian(this.state.orderNo);
  954. this.jiedianNew(this.state.orderNo);
  955. }
  956. // if (key === "2") {
  957. // this.ChangeDetail(this.state.orderNo);
  958. // this.loadDataChange();
  959. // }
  960. // if (key === "3") {
  961. // this.primaryOrder(this.state.primaryOrderNo);
  962. // this.xiangmu(this.state.primaryOrderNo);
  963. // this.jiedian(this.state.primaryOrderNo);
  964. // this.jiedianNew(this.state.primaryOrderNo);
  965. // }
  966. if (key === "c") {
  967. this.additionalOrder(this.state.additionalOrder);
  968. this.xiangmu(this.state.additionalOrder);
  969. this.jiedian(this.state.additionalOrder);
  970. this.jiedianNew(this.state.additionalOrder);
  971. this.setState({
  972. buttonStatusA: false
  973. });
  974. } else {
  975. this.setState({
  976. buttonStatusA: true
  977. });
  978. }
  979. },
  980. closeDesc(e, s) {
  981. this.state.activeKey = "a";
  982. this.state.userDetaile = false;
  983. this.state.signBillVisible = false;
  984. this.state.visible = e;
  985. if (s) {
  986. this.loadData(this.state.pageNo);
  987. }
  988. },
  989. // 获取原订单编号
  990. getPrimaryOrder(value) {
  991. this.setState({
  992. primaryOrder: value
  993. });
  994. },
  995. getAdditionalOrder(value) {
  996. this.setState({
  997. additionalOrder: value
  998. });
  999. },
  1000. getUrl(url) {
  1001. let theorgCodeUrl = [];
  1002. if (url.length) {
  1003. let picArr = [];
  1004. url.map(function (item) {
  1005. if (
  1006. item.response &&
  1007. item.response.data &&
  1008. item.response.data.length
  1009. ) {
  1010. picArr.push(item.response.data);
  1011. }
  1012. });
  1013. theorgCodeUrl = picArr.join(",");
  1014. }
  1015. return theorgCodeUrl;
  1016. },
  1017. sureOut() {
  1018. if (!this.state.companyName) {
  1019. message.warning("公司名称不能为空");
  1020. return;
  1021. }
  1022. if (!this.state.unitPrice) {
  1023. message.warning("单价不能为空");
  1024. return;
  1025. }
  1026. if (!this.state.unitNumber) {
  1027. message.warning("数量不能为空");
  1028. return;
  1029. }
  1030. if (!this.state.amount) {
  1031. message.warning("总金额不能为空");
  1032. return;
  1033. }
  1034. if (!this.state.outsourceRemarks) {
  1035. message.warning("备注不能为空");
  1036. return;
  1037. }
  1038. if (this.state.pictureUrl.length === 0) {
  1039. message.warning("合同扫描件不能为空");
  1040. return;
  1041. }
  1042. $.ajax({
  1043. method: "POST",
  1044. dataType: "json",
  1045. crossDomain: false,
  1046. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  1047. data: {
  1048. id: this.state.id,
  1049. orderNo: this.state.orderNo,
  1050. companyName: this.state.companyName,
  1051. amount: this.state.amount,
  1052. outsourceRemarks: this.state.outsourceRemarks,
  1053. unitNumber: this.state.unitNumber,
  1054. unitPrice: this.state.unitPrice,
  1055. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  1056. ? this.getUrl(this.state.attachmentUrl)
  1057. : "",
  1058. orderStatus: 2,
  1059. pictureUrl: this.getUrl(this.state.pictureUrl).length
  1060. ? this.getUrl(this.state.pictureUrl)
  1061. : ""
  1062. }
  1063. }).done(
  1064. function (data) {
  1065. this.setState({
  1066. loading: false
  1067. });
  1068. if (!data.error.length) {
  1069. message.success("发起成功!");
  1070. this.outReset();
  1071. this.visitCancel();
  1072. } else {
  1073. message.warning(data.error[0].message);
  1074. }
  1075. }.bind(this)
  1076. );
  1077. },
  1078. //关闭输入理由框
  1079. noCancel() {
  1080. this.setState({
  1081. noVisible: false,
  1082. aloading: false,
  1083. reason: ""
  1084. });
  1085. },
  1086. //重置
  1087. reset() {
  1088. this.setState({
  1089. signBillVisible: false
  1090. });
  1091. this.state.orderNo = "";
  1092. this.state.customerName = "";
  1093. this.state.releaseDate[0] = undefined;
  1094. this.state.releaseDate[1] = undefined;
  1095. this.state.approval = undefined;
  1096. // this.state.searchData.completeSearch = 0;
  1097. this.state.searchData = {
  1098. completeSearch: 0
  1099. };
  1100. this.loadData(1);
  1101. },
  1102. outReset() {
  1103. this.setState({
  1104. companyName: "",
  1105. amount: "",
  1106. unitPrice: "",
  1107. unitNumber: "",
  1108. outsourceRemarks: "",
  1109. attachmentUrl: [],
  1110. pictureUrl: []
  1111. });
  1112. },
  1113. getOrgCodeUrl(e) {
  1114. this.setState({ pictureUrl: e });
  1115. },
  1116. //关闭详情
  1117. visitCancel() {
  1118. this.setState(
  1119. {
  1120. visible: false,
  1121. activeKey: "a"
  1122. },
  1123. () => {
  1124. this.setState({
  1125. activeKey: "a"
  1126. });
  1127. }
  1128. );
  1129. this.loadData(this.state.pageNo);
  1130. },
  1131. visitOk() {
  1132. this.setState({
  1133. visible: false
  1134. });
  1135. },
  1136. createTabs() {
  1137. $.ajax({
  1138. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  1139. method: "get",
  1140. data: {
  1141. orderNo: this.state.orderNo
  1142. },
  1143. success: data => {
  1144. if (data.error && data.error.length) {
  1145. message.warning(data.error[0].message);
  1146. } else {
  1147. this.setState({
  1148. tabList: data.data
  1149. });
  1150. }
  1151. }
  1152. });
  1153. },
  1154. changeList(arr) {
  1155. const newArr = [];
  1156. this.state.columns.forEach(item => {
  1157. arr.forEach(val => {
  1158. if (val === item.title) {
  1159. newArr.push(item);
  1160. }
  1161. });
  1162. });
  1163. this.setState({
  1164. changeList: newArr
  1165. });
  1166. },
  1167. render() {
  1168. const tabList = this.state.tabList || [];
  1169. const formItemLayout = {
  1170. labelCol: { span: 8 },
  1171. wrapperCol: { span: 14 }
  1172. };
  1173. const FormItem = Form.Item;
  1174. const { TabPane } = Tabs;
  1175. return (
  1176. <div className="user-content">
  1177. <ShowModalDiv ShowModal={this.state.showModal} onClose={() => { this.setState({ showModal: false }) }} />
  1178. <div className="content-title" style={{ marginBottom: 10 }}>
  1179. <span style={{ fontWeight: 900, fontSize: 16 }}>
  1180. 合同变更审核订单
  1181. </span>
  1182. </div>
  1183. <div className="user-search">
  1184. <Tabs
  1185. defaultActiveKey="1"
  1186. onChange={this.callback}
  1187. className="test">
  1188. <TabPane tab="搜索" key="1">
  1189. <div style={{ marginLeft: 10 }}>
  1190. <SearchInput search={this.search} shiroList="yxgly"/>
  1191. </div>
  1192. </TabPane>
  1193. <TabPane tab="更改表格显示数据" key="2">
  1194. <div style={{ marginLeft: 10 }}>
  1195. <ChooseList
  1196. columns={this.state.columns}
  1197. changeFn={this.changeList}
  1198. changeList={this.state.changeList}
  1199. top={55}
  1200. margin={11}
  1201. />
  1202. </div>
  1203. </TabPane>
  1204. </Tabs>
  1205. <div className="patent-table">
  1206. <Spin spinning={this.state.loading}>
  1207. <Table
  1208. size="small"
  1209. bordered
  1210. columns={
  1211. this.state.changeList
  1212. ? this.state.changeList
  1213. : this.state.columns
  1214. }
  1215. dataSource={this.state.dataSource}
  1216. pagination={this.state.pagination}
  1217. onRowClick={this.tableRowClick}
  1218. />
  1219. </Spin>
  1220. </div>
  1221. {this.state.visible ? <Modal
  1222. className="customeDetails"
  1223. footer=""
  1224. maskClosable={false}
  1225. width="1200px"
  1226. visible={this.state.visible}
  1227. onOk={this.visitOk}
  1228. onCancel={this.visitCancel}
  1229. >
  1230. <Tabs
  1231. activeKey={this.state.activeKey}
  1232. onChange={this.callback}
  1233. type="card"
  1234. tabBarExtraContent={
  1235. <div style={{ fontWeight: 'bold', paddingRight: '15px' }}>
  1236. <OrderItemStatus deleteSign={this.state.deleteSign} />
  1237. </div>
  1238. }
  1239. >
  1240. <TabPane tab="订单详情" key="a">
  1241. <Form
  1242. layout="horizontal"
  1243. onSubmit={this.handleSubmit}
  1244. id="demand-form"
  1245. style={{ paddingBottom: "40px" }}
  1246. >
  1247. <Spin spinning={this.state.loading}>
  1248. {this.state.activeKey === 'a' ?
  1249. <OrderDetail
  1250. orderData={this.state.orderData}
  1251. orderUid={this.state.orderUid}
  1252. getOrderLog={this.getOrderLog}
  1253. totalCui={this.state.totalCui}
  1254. dataSourceX={this.state.dataSourceX}
  1255. contactList={this.state.contactList}
  1256. contactListNew={this.state.contactListNew}
  1257. orderNo={this.state.orderNo}
  1258. /> : <div />}
  1259. </Spin>
  1260. </Form>
  1261. </TabPane>
  1262. {/* <TabPane tab="合同变更记录" key="2">
  1263. <ChangeDetail
  1264. data={this.state.contractData}
  1265. pictureUrl={this.state.voucherUrl}
  1266. processState={this.props.processState}
  1267. dataSource={this.state.dataProps}
  1268. proceedsData={this.state.proceedsData}
  1269. proceedsTotal={this.state.proTotal}
  1270. invoiceTotal={this.state.invTotal}
  1271. contactList={this.state.refundInvoice}
  1272. onCancel={this.visitCancel}
  1273. />
  1274. </TabPane> */}
  1275. {tabList.map((item, index, arr) => {
  1276. return (
  1277. <TabPane tab={"合同变更记录" + (tabList.length - index)} key={item.id}>
  1278. {
  1279. this.state.activeKey === String(item.id) ?
  1280. <ChangeDetail
  1281. id={item.id}
  1282. orderNo={this.state.orderNo}
  1283. orderUid={this.state.orderUid}
  1284. money={index == arr.length - 1 ? this.state.orderData.totalAmount + "" : undefined}
  1285. data={this.state.contractData}
  1286. pictureUrl={this.state.voucherUrl}
  1287. contractPictureUrl={this.state.contractPictureUrl}
  1288. attachment={this.state.attachment}
  1289. processState={this.props.processState}
  1290. dataSource={this.state.dataProps}
  1291. proceedsData={this.state.proceedsData}
  1292. proceedsTotal={this.state.proTotal}
  1293. invoiceTotal={this.state.invTotal}
  1294. contactList={this.state.refundInvoice}
  1295. onCancel={this.visitCancel}
  1296. /> : <div />
  1297. }
  1298. </TabPane>
  1299. );
  1300. })}
  1301. {/* {this.state.status === 4 ? (
  1302. <TabPane tab="原订单" key="3">
  1303. <Form
  1304. layout="horizontal"
  1305. onSubmit={this.handleSubmit}
  1306. id="demand-form"
  1307. style={{ paddingBottom: "40px" }}
  1308. >
  1309. <Spin spinning={this.state.loading}>
  1310. <OrderDetail
  1311. orderData={this.state.primaryOrderData}
  1312. getOrderLog={this.getOrderLog}
  1313. dataSourceX={this.state.dataSourceX}
  1314. contactList={this.state.contactList}
  1315. totalCui={this.state.totalCui}
  1316. contactListNew={this.state.contactListNew}
  1317. orderNo={this.state.primaryOrderNo}
  1318. />
  1319. </Spin>
  1320. </Form>
  1321. </TabPane>
  1322. ) : (
  1323. ""
  1324. )} */}
  1325. {tabList.map((item, index) => {
  1326. if (item.usedOrder) {
  1327. return (
  1328. <TabPane
  1329. tab={"原订单" + (tabList.length - index)}
  1330. key={item.usedOrder}
  1331. >
  1332. {
  1333. this.state.activeKey == item.usedOrder &&
  1334. <Form
  1335. layout="horizontal"
  1336. onSubmit={this.handleSubmit}
  1337. id="demand-form"
  1338. style={{ paddingBottom: "40px" }}
  1339. >
  1340. <Spin spinning={this.state.loading}>
  1341. {
  1342. this.state.activeKey === String(item.usedOrder) ?
  1343. <OrderDetail
  1344. orderData={this.state.primaryOrderData}
  1345. getOrderLog={this.getOrderLog}
  1346. dataSourceX={this.state.dataSourceX}
  1347. contactList={this.state.contactList}
  1348. orderNo={this.state.primaryOrderNo}
  1349. totalCui={this.state.totalCui}
  1350. contactListNew={this.state.contactListNew}
  1351. /> : <div />
  1352. }
  1353. </Spin>
  1354. </Form>
  1355. }
  1356. </TabPane>
  1357. );
  1358. } else {
  1359. return "";
  1360. }
  1361. })}
  1362. {this.state.status === 4 && this.state.isAddition ? (
  1363. this.state.type === 4 || this.state.type === 5 ? (
  1364. <TabPane tab="附加订单" key="c">
  1365. {
  1366. this.state.activeKey === "c" ?
  1367. <OrderDetail
  1368. orderData={this.state.additionalOrderData}
  1369. getOrderLog={this.getOrderLog}
  1370. dataSourceX={this.state.dataSourceX}
  1371. totalCui={this.state.totalCui}
  1372. contactListNew={this.state.contactListNew}
  1373. contactList={this.state.contactList}
  1374. orderNo={this.state.additionalOrder}
  1375. /> : <div />
  1376. }
  1377. </TabPane>
  1378. ) : (
  1379. ""
  1380. )
  1381. ) : (
  1382. ""
  1383. )}
  1384. </Tabs>
  1385. </Modal> : <div />}
  1386. <Modal
  1387. maskClosable={false}
  1388. visible={this.state.noVisible}
  1389. onOk={this.handleOk}
  1390. onCancel={this.noCancel}
  1391. width="400px"
  1392. title={"拒绝理由"}
  1393. footer=""
  1394. className="admin-desc-content"
  1395. confirmLoading={this.state.confirmLoading}
  1396. >
  1397. <Form layout="horizontal" id="demand-form">
  1398. <Spin spinning={this.state.loading}>
  1399. <div className="clearfix">
  1400. <FormItem
  1401. labelCol={{ span: 4 }}
  1402. wrapperCol={{ span: 16 }}
  1403. label="拒绝理由"
  1404. >
  1405. <Input
  1406. type="textarea"
  1407. placeholder="请输入拒绝理由"
  1408. rows={4}
  1409. value={this.state.reason}
  1410. onChange={e => {
  1411. this.setState({ reason: e.target.value });
  1412. }}
  1413. />
  1414. </FormItem>
  1415. </div>
  1416. <div className="clearfix">
  1417. <Button
  1418. className="cancel"
  1419. type="primary"
  1420. onClick={this.examOks}
  1421. style={{ marginLeft: "50px" }}
  1422. htmlType="submit"
  1423. loading={this.state.aloading}
  1424. >
  1425. 确定
  1426. </Button>
  1427. <Button
  1428. className="cancel"
  1429. type="ghost"
  1430. onClick={this.noCancel}
  1431. style={{ marginLeft: "50px" }}
  1432. >
  1433. 取消
  1434. </Button>
  1435. </div>
  1436. </Spin>
  1437. </Form>
  1438. </Modal>
  1439. {/* <Modal
  1440. visible={this.state.rizhivisible}
  1441. className="admin-desc-content"
  1442. width="800px"
  1443. maskClosable={false}
  1444. title="订单日志"
  1445. footer={null}
  1446. onCancel={this.closeOrderLog}
  1447. >
  1448. <div className="patent-table">
  1449. <Spin spinning={this.state.loading}>
  1450. <Table
  1451. bordered
  1452. columns={this.state.columnsrizhi}
  1453. dataSource={this.state.dataSourcerizhi}
  1454. pagination={false}
  1455. />
  1456. </Spin>
  1457. </div>
  1458. </Modal> */}
  1459. <OrderRiZi
  1460. dataSourcerizhi={this.state.dataSourcerizhi}
  1461. closeOrderLog={this.closeOrderLog}
  1462. visible={this.state.rizhivisible}
  1463. loading={this.state.loading}
  1464. />
  1465. </div>
  1466. {/* {this.state.addnextVisible && <ProjectDetailsReadOnly
  1467. infor={this.state.dataInfor}
  1468. visible={this.state.addnextVisible}
  1469. onCancel={this.nextCancel}
  1470. />} */}
  1471. {
  1472. // 项目业务详情
  1473. this.state.addnextVisible &&
  1474. <NewEditProject
  1475. readOnly={true}
  1476. visible={this.state.addnextVisible}
  1477. dataInfor={this.state.dataInfor}
  1478. onCancel={this.nextCancel}
  1479. />
  1480. }
  1481. </div>
  1482. );
  1483. }
  1484. })
  1485. );
  1486. export default contractChange;