contractYxjl.js 45 KB

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