contractYxgly.js 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530
  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. import Cascaders from "../../../common/cascaders";
  27. const contractChange = Form.create()(
  28. React.createClass({
  29. loadData(pageNo) {
  30. this.setState({
  31. loading: true
  32. });
  33. $.ajax({
  34. method: "get",
  35. dataType: "json",
  36. crossDomain: false,
  37. url: globalConfig.context + "/api/admin/orderChange/orderChangeList",
  38. data: {
  39. pageNo: pageNo || 1,
  40. pageSize: this.state.pagination.pageSize,
  41. userName: this.state.searchData.userNameSearch,
  42. orderNo: this.state.searchData.orderNoSearch,
  43. contractNo: this.state.searchData.contractNoSearch,
  44. processState: this.props.processState,
  45. timeType: this.state.searchData.timeTypeSearch,
  46. startTime: this.state.searchData.releaseDate[0],
  47. endTime: this.state.searchData.releaseDate[1],
  48. salesmanName: this.state.searchData.salesmanNameSearch,
  49. complete: this.state.searchData.completeSearch || 1,
  50. deps: this.state.searchData.deps,
  51. type: this.state.searchData.changeSearch
  52. },
  53. success: function (data) {
  54. ShowModal(this);
  55. let theArr = [];
  56. if (data.error.length || data.data.list == "") {
  57. if (data.error && data.error.length) {
  58. message.warning(data.error[0].message);
  59. }
  60. } else {
  61. for (let i = 0; i < data.data.list.length; i++) {
  62. let thisdata = data.data.list[i];
  63. theArr.push({
  64. key: i,
  65. orderNo: thisdata.orderNo,
  66. createTimes: thisdata.createTimes,
  67. nickname: thisdata.nickname,
  68. orderType: thisdata.orderType,
  69. establishTimes: thisdata.establishTimes,
  70. orderStatus: thisdata.orderStatus,
  71. totalAmount: thisdata.totalAmount,
  72. settlementAmount: thisdata.settlementAmount,
  73. arrears: thisdata.arrears,
  74. salesmanName: thisdata.salesmanName,
  75. depName: thisdata.depName,
  76. processState: thisdata.processState,
  77. type: thisdata.type,
  78. status: thisdata.status,
  79. id: thisdata.id,
  80. contractNo: thisdata.contractNo,
  81. processStateText: getProcessStatusNew(
  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. if (obj.reset) {
  641. this.state.searchData.deps = [];
  642. this.Cascaders.empty();
  643. this.loadData(1);
  644. } else {
  645. this.setState(
  646. {
  647. searchData: Object.assign(this.state.searchData, obj)
  648. },
  649. () => {
  650. this.loadData(1);
  651. }
  652. );
  653. }
  654. },
  655. rizhi(orderNo) {
  656. $.ajax({
  657. method: "get",
  658. dataType: "json",
  659. crossDomain: false,
  660. url: "/api/admin/newOrder/selectOrderLog",
  661. data: {
  662. orderNo: orderNo
  663. },
  664. success: function (data) {
  665. let theArr = [];
  666. let thisData = data.data;
  667. if (!thisData.length) {
  668. if (data.error && data.error.length) {
  669. message.warning(data.error[0].message);
  670. }
  671. thisData = {};
  672. } else {
  673. for (let i = 0; i < data.data.length; i++) {
  674. let thisdata = data.data[i];
  675. theArr.push({
  676. processName: thisdata.processName,
  677. adminName: thisdata.adminName,
  678. createDate: thisdata.createDate,
  679. remarks: thisdata.remarks
  680. });
  681. }
  682. }
  683. this.setState({
  684. dataSourcerizhi: theArr
  685. });
  686. }.bind(this)
  687. });
  688. },
  689. getOrderLog(orderNo) {
  690. this.setState({
  691. rizhivisible: true
  692. });
  693. this.rizhi(orderNo);
  694. },
  695. closeOrderLog() {
  696. this.setState({
  697. rizhivisible: false
  698. });
  699. },
  700. //节点列表
  701. jiedian(orderNos) {
  702. $.ajax({
  703. method: "get",
  704. dataType: "json",
  705. crossDomain: false,
  706. url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",
  707. data: {
  708. orderNo: orderNos
  709. },
  710. success: function (data) {
  711. let theArr = [];
  712. let thisData = [];
  713. if (data.error.length || data.data.list == "") {
  714. if (data.error && data.error.length) {
  715. message.warning(data.error[0].message);
  716. }
  717. } else {
  718. for (let i = 0; i < data.data.length; i++) {
  719. thisData = data.data[i];
  720. theArr.push({
  721. key: i,
  722. dunSubject: thisData.dunSubject
  723. ? thisData.dunSubject.toString()
  724. : "", //催款科目
  725. id: thisData.id, //节点Id
  726. money: thisData.money, //催款金额
  727. dunStatus: thisData.dunStatus //催款状态
  728. });
  729. }
  730. this.setState({
  731. contactList: theArr
  732. });
  733. }
  734. }.bind(this)
  735. });
  736. },
  737. jiedianNew(orderNos) {
  738. $.ajax({
  739. method: "get",
  740. dataType: "json",
  741. crossDomain: false,
  742. url:
  743. globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
  744. data: {
  745. orderNo: orderNos
  746. },
  747. success: function (data) {
  748. if (data.error && data.error.length) {
  749. message.warning(data.error[0].message);
  750. } else {
  751. let theArr = [];
  752. let thisData = [];
  753. let arr = data.data || [];
  754. let totalCui = 0;
  755. for (let i = 0; i < arr.length; i++) {
  756. thisData = arr[i];
  757. totalCui += +thisData.money;
  758. theArr.push({
  759. key: i,
  760. dunSubject: thisData.dunSubject
  761. ? thisData.dunSubject.toString()
  762. : "", //催款科目
  763. id: thisData.id, //节点Id
  764. money: thisData.money, //催款金额
  765. // orderNo: record ? record.orderNo : this.props.datauser.orderNo,
  766. commodityName: thisData.commodityName,
  767. projectType: thisData.projectType,
  768. dunTypeName: thisData.dunTypeName,
  769. status: thisData.status,
  770. waitDay: thisData.waitDay,
  771. effectiveCount: thisData.effectiveCount,
  772. startDate: thisData.startDate,
  773. dunType: thisData.dunType,
  774. appropriationRatio: thisData.appropriationRatio,
  775. customizeName: thisData.customizeName,
  776. customizeTimes: thisData.customizeTimes,
  777. tid: thisData.tid,
  778. });
  779. }
  780. if (!totalCui) {
  781. totalCui = 0;
  782. }
  783. totalCui = (Math.round(totalCui * 10000) / 10000).toFixed(4);
  784. this.setState({
  785. contactListNew: theArr,
  786. totalCui
  787. });
  788. }
  789. }.bind(this)
  790. }).always(
  791. function () {
  792. this.setState({
  793. loading: false
  794. });
  795. }.bind(this)
  796. );
  797. },
  798. //审核通过
  799. examOk() {
  800. $.ajax({
  801. method: "post",
  802. dataType: "json",
  803. crossDomain: false,
  804. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  805. data: {
  806. orderNo: this.state.orderNo,
  807. orderStatus: 2
  808. },
  809. success: function (data) {
  810. if (data.error.length || data.data.list == "") {
  811. if (data.error && data.error.length) {
  812. message.warning(data.error[0].message);
  813. }
  814. } else {
  815. message.success("该订单已通过审核~");
  816. this.setState({
  817. visible: false
  818. });
  819. this.reset();
  820. }
  821. }.bind(this)
  822. }).always(
  823. function () {
  824. this.setState({
  825. loading: false
  826. });
  827. }.bind(this)
  828. );
  829. },
  830. //通过发给外包
  831. outsourcing() {
  832. $.ajax({
  833. method: "post",
  834. dataType: "json",
  835. crossDomain: false,
  836. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  837. data: {
  838. orderNo: this.state.orderNo,
  839. orderStatus: 2,
  840. outsource: 1
  841. },
  842. success: function (data) {
  843. if (data.error.length || data.data.list == "") {
  844. if (data.error && data.error.length) {
  845. message.warning(data.error[0].message);
  846. }
  847. } else {
  848. message.success("该订单已通过审核~");
  849. this.setState({
  850. visible: false
  851. });
  852. this.reset();
  853. }
  854. }.bind(this)
  855. }).always(
  856. function () {
  857. this.setState({
  858. loading: false
  859. });
  860. }.bind(this)
  861. );
  862. },
  863. //审核不通过
  864. examOks() {
  865. this.setState({
  866. aloading: true
  867. });
  868. $.ajax({
  869. method: "post",
  870. dataType: "json",
  871. crossDomain: false,
  872. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  873. data: {
  874. orderNo: this.state.orderNo,
  875. orderStatus: 3,
  876. reason: this.state.reason
  877. },
  878. success: function (data) {
  879. if (data.error.length || data.data.list == "") {
  880. if (data.error && data.error.length) {
  881. message.warning(data.error[0].message);
  882. this.setState({
  883. aloading: true
  884. });
  885. }
  886. } else {
  887. message.success("该订单已被拒绝~");
  888. this.setState({
  889. visible: false,
  890. aloading: false,
  891. noVisible: false,
  892. reason: ""
  893. });
  894. this.reset();
  895. }
  896. }.bind(this)
  897. }).always(
  898. function () {
  899. this.setState({
  900. loading: false
  901. });
  902. }.bind(this)
  903. );
  904. },
  905. //点击拒绝
  906. examNo() {
  907. this.setState({
  908. noVisible: true
  909. });
  910. },
  911. // componentDidMount(){
  912. // window.setTimeout(() => {
  913. // console.log(this.state.dataProps);
  914. // },100)
  915. // },
  916. loadDataChange(key) {
  917. $.ajax({
  918. method: "get",
  919. dataType: "json",
  920. async: false,
  921. crossDomain: false,
  922. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  923. data: {
  924. changeId: key
  925. },
  926. success: function (data) {
  927. if (data.error.length || data.data.list == "") {
  928. if (data.error && data.error.length) {
  929. message.warning(data.error[0].message);
  930. }
  931. } else {
  932. // console.log("拿到历史", data.data);
  933. this.setState({
  934. dataProps: data.data
  935. });
  936. }
  937. }.bind(this)
  938. });
  939. },
  940. callback(key) {
  941. this.setState(
  942. {
  943. activeKey: key
  944. },
  945. () => {
  946. if (key != "a" && key != "c" && key.length < 10) {
  947. this.ChangeDetail(key);
  948. this.loadDataChange(key);
  949. } else if (key != "a" && key != "c" && key.length > 10) {
  950. this.primaryOrder(key);
  951. this.xiangmu(key);
  952. this.jiedian(key);
  953. this.jiedianNew(key);
  954. this.loadDataChange(key);
  955. }
  956. }
  957. );
  958. if (key === "a") {
  959. this.xiangmu(this.state.orderNo);
  960. this.jiedian(this.state.orderNo);
  961. this.jiedianNew(this.state.orderNo);
  962. }
  963. // if (key === "2") {
  964. // this.ChangeDetail(this.state.orderNo);
  965. // this.loadDataChange();
  966. // }
  967. // if (key === "3") {
  968. // this.primaryOrder(this.state.primaryOrderNo);
  969. // this.xiangmu(this.state.primaryOrderNo);
  970. // this.jiedian(this.state.primaryOrderNo);
  971. // this.jiedianNew(this.state.primaryOrderNo);
  972. // }
  973. if (key === "c") {
  974. this.additionalOrder(this.state.additionalOrder);
  975. this.xiangmu(this.state.additionalOrder);
  976. this.jiedian(this.state.additionalOrder);
  977. this.jiedianNew(this.state.additionalOrder);
  978. this.setState({
  979. buttonStatusA: false
  980. });
  981. } else {
  982. this.setState({
  983. buttonStatusA: true
  984. });
  985. }
  986. },
  987. closeDesc(e, s) {
  988. this.state.activeKey = "a";
  989. this.state.userDetaile = false;
  990. this.state.signBillVisible = false;
  991. this.state.visible = e;
  992. if (s) {
  993. this.loadData(this.state.pageNo);
  994. }
  995. },
  996. // 获取原订单编号
  997. getPrimaryOrder(value) {
  998. this.setState({
  999. primaryOrder: value
  1000. });
  1001. },
  1002. getAdditionalOrder(value) {
  1003. this.setState({
  1004. additionalOrder: value
  1005. });
  1006. },
  1007. getUrl(url) {
  1008. let theorgCodeUrl = [];
  1009. if (url.length) {
  1010. let picArr = [];
  1011. url.map(function (item) {
  1012. if (
  1013. item.response &&
  1014. item.response.data &&
  1015. item.response.data.length
  1016. ) {
  1017. picArr.push(item.response.data);
  1018. }
  1019. });
  1020. theorgCodeUrl = picArr.join(",");
  1021. }
  1022. return theorgCodeUrl;
  1023. },
  1024. sureOut() {
  1025. if (!this.state.companyName) {
  1026. message.warning("公司名称不能为空");
  1027. return;
  1028. }
  1029. if (!this.state.unitPrice) {
  1030. message.warning("单价不能为空");
  1031. return;
  1032. }
  1033. if (!this.state.unitNumber) {
  1034. message.warning("数量不能为空");
  1035. return;
  1036. }
  1037. if (!this.state.amount) {
  1038. message.warning("总金额不能为空");
  1039. return;
  1040. }
  1041. if (!this.state.outsourceRemarks) {
  1042. message.warning("备注不能为空");
  1043. return;
  1044. }
  1045. if (this.state.pictureUrl.length === 0) {
  1046. message.warning("合同扫描件不能为空");
  1047. return;
  1048. }
  1049. $.ajax({
  1050. method: "POST",
  1051. dataType: "json",
  1052. crossDomain: false,
  1053. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  1054. data: {
  1055. id: this.state.id,
  1056. orderNo: this.state.orderNo,
  1057. companyName: this.state.companyName,
  1058. amount: this.state.amount,
  1059. outsourceRemarks: this.state.outsourceRemarks,
  1060. unitNumber: this.state.unitNumber,
  1061. unitPrice: this.state.unitPrice,
  1062. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  1063. ? this.getUrl(this.state.attachmentUrl)
  1064. : "",
  1065. orderStatus: 2,
  1066. pictureUrl: this.getUrl(this.state.pictureUrl).length
  1067. ? this.getUrl(this.state.pictureUrl)
  1068. : ""
  1069. }
  1070. }).done(
  1071. function (data) {
  1072. this.setState({
  1073. loading: false
  1074. });
  1075. if (!data.error.length) {
  1076. message.success("发起成功!");
  1077. this.outReset();
  1078. this.visitCancel();
  1079. } else {
  1080. message.warning(data.error[0].message);
  1081. }
  1082. }.bind(this)
  1083. );
  1084. },
  1085. //关闭输入理由框
  1086. noCancel() {
  1087. this.setState({
  1088. noVisible: false,
  1089. aloading: false,
  1090. reason: ""
  1091. });
  1092. },
  1093. //重置
  1094. reset() {
  1095. this.setState({
  1096. signBillVisible: false
  1097. });
  1098. this.state.orderNo = "";
  1099. this.state.customerName = "";
  1100. this.state.releaseDate[0] = undefined;
  1101. this.state.releaseDate[1] = undefined;
  1102. this.state.approval = undefined;
  1103. // this.state.searchData.completeSearch = 0;
  1104. this.state.searchData = {
  1105. completeSearch: 0
  1106. };
  1107. this.loadData(1);
  1108. },
  1109. outReset() {
  1110. this.setState({
  1111. companyName: "",
  1112. amount: "",
  1113. unitPrice: "",
  1114. unitNumber: "",
  1115. outsourceRemarks: "",
  1116. attachmentUrl: [],
  1117. pictureUrl: []
  1118. });
  1119. },
  1120. getOrgCodeUrl(e) {
  1121. this.setState({ pictureUrl: e });
  1122. },
  1123. //关闭详情
  1124. visitCancel() {
  1125. this.setState(
  1126. {
  1127. visible: false,
  1128. activeKey: "a"
  1129. },
  1130. () => {
  1131. this.setState({
  1132. activeKey: "a"
  1133. });
  1134. }
  1135. );
  1136. this.loadData(this.state.pageNo);
  1137. },
  1138. visitOk() {
  1139. this.setState({
  1140. visible: false
  1141. });
  1142. },
  1143. createTabs() {
  1144. $.ajax({
  1145. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  1146. method: "get",
  1147. data: {
  1148. orderNo: this.state.orderNo
  1149. },
  1150. success: data => {
  1151. if (data.error && data.error.length) {
  1152. message.warning(data.error[0].message);
  1153. } else {
  1154. this.setState({
  1155. tabList: data.data
  1156. });
  1157. }
  1158. }
  1159. });
  1160. },
  1161. changeList(arr) {
  1162. const newArr = [];
  1163. this.state.columns.forEach(item => {
  1164. arr.forEach(val => {
  1165. if (val === item.title) {
  1166. newArr.push(item);
  1167. }
  1168. });
  1169. });
  1170. this.setState({
  1171. changeList: newArr
  1172. });
  1173. },
  1174. render() {
  1175. const tabList = this.state.tabList || [];
  1176. const formItemLayout = {
  1177. labelCol: { span: 8 },
  1178. wrapperCol: { span: 14 }
  1179. };
  1180. const FormItem = Form.Item;
  1181. const { TabPane } = Tabs;
  1182. return (
  1183. <div className="user-content">
  1184. <ShowModalDiv ShowModal={this.state.showModal} />
  1185. <div className="content-title" style={{ marginBottom: 10 }}>
  1186. <span style={{ fontWeight: 900, fontSize: 16 }}>
  1187. 合同变更审核订单
  1188. </span>
  1189. </div>
  1190. <div className="user-search">
  1191. <Tabs
  1192. defaultActiveKey="1"
  1193. onChange={this.callback}
  1194. className="test">
  1195. <TabPane tab="搜索" key="1">
  1196. <div style={{ marginLeft: 10 }}>
  1197. <Cascaders
  1198. ref={node => this.Cascaders = node}
  1199. placeholder="订单部门"
  1200. id="id"
  1201. name="name"
  1202. children="list"
  1203. height={28}
  1204. onSel={(e) => {
  1205. const { searchData } = this.state
  1206. searchData["deps"] = JSON.stringify(e);
  1207. this.setState({
  1208. searchData: searchData
  1209. })
  1210. }}
  1211. />
  1212. <SearchInput search={this.search} />
  1213. </div>
  1214. </TabPane>
  1215. <TabPane tab="更改表格显示数据" key="2">
  1216. <div style={{ marginLeft: 10 }}>
  1217. <ChooseList
  1218. columns={this.state.columns}
  1219. changeFn={this.changeList}
  1220. changeList={this.state.changeList}
  1221. top={55}
  1222. margin={11}
  1223. />
  1224. </div>
  1225. </TabPane>
  1226. </Tabs>
  1227. <div className="patent-table">
  1228. <Spin spinning={this.state.loading}>
  1229. <Table
  1230. size="small"
  1231. bordered
  1232. columns={
  1233. this.state.changeList
  1234. ? this.state.changeList
  1235. : this.state.columns
  1236. }
  1237. dataSource={this.state.dataSource}
  1238. pagination={this.state.pagination}
  1239. onRowClick={this.tableRowClick}
  1240. />
  1241. </Spin>
  1242. </div>
  1243. {this.state.visible ? <Modal
  1244. className="customeDetails"
  1245. footer=""
  1246. maskClosable={false}
  1247. width="1200px"
  1248. visible={this.state.visible}
  1249. onOk={this.visitOk}
  1250. onCancel={this.visitCancel}
  1251. >
  1252. <Tabs
  1253. activeKey={this.state.activeKey}
  1254. onChange={this.callback}
  1255. type="card"
  1256. tabBarExtraContent={
  1257. <div style={{ fontWeight: 'bold', paddingRight: '15px' }}>
  1258. <OrderItemStatus deleteSign={this.state.deleteSign} />
  1259. </div>
  1260. }
  1261. >
  1262. <TabPane tab="订单详情" key="a">
  1263. <Form
  1264. layout="horizontal"
  1265. onSubmit={this.handleSubmit}
  1266. id="demand-form"
  1267. style={{ paddingBottom: "40px" }}
  1268. >
  1269. <Spin spinning={this.state.loading}>
  1270. {this.state.activeKey === 'a' ? <OrderDetail
  1271. orderData={this.state.orderData}
  1272. orderUid={this.state.orderUid}
  1273. getOrderLog={this.getOrderLog}
  1274. totalCui={this.state.totalCui}
  1275. dataSourceX={this.state.dataSourceX}
  1276. contactList={this.state.contactList}
  1277. contactListNew={this.state.contactListNew}
  1278. orderNo={this.state.orderNo}
  1279. /> : <div />}
  1280. </Spin>
  1281. </Form>
  1282. </TabPane>
  1283. {/* <TabPane tab="合同变更记录" key="2">
  1284. <ChangeDetail
  1285. data={this.state.contractData}
  1286. pictureUrl={this.state.voucherUrl}
  1287. processState={this.props.processState}
  1288. dataSource={this.state.dataProps}
  1289. proceedsData={this.state.proceedsData}
  1290. proceedsTotal={this.state.proTotal}
  1291. invoiceTotal={this.state.invTotal}
  1292. contactList={this.state.refundInvoice}
  1293. onCancel={this.visitCancel}
  1294. />
  1295. </TabPane> */}
  1296. {tabList.map((item, index, arr) => {
  1297. return (
  1298. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1299. {
  1300. this.state.activeKey === String(item.id) ?
  1301. <ChangeDetail
  1302. id={item.id}
  1303. orderNo={this.state.orderNo}
  1304. orderUid={this.state.orderUid}
  1305. money={index == arr.length - 1 ? this.state.orderData.totalAmount + "" : undefined}
  1306. data={this.state.contractData}
  1307. pictureUrl={this.state.voucherUrl}
  1308. contractPictureUrl={this.state.contractPictureUrl}
  1309. attachment={this.state.attachment}
  1310. processState={this.props.processState}
  1311. dataSource={this.state.dataProps}
  1312. proceedsData={this.state.proceedsData}
  1313. proceedsTotal={this.state.proTotal}
  1314. invoiceTotal={this.state.invTotal}
  1315. contactList={this.state.refundInvoice}
  1316. onCancel={this.visitCancel}
  1317. /> : <div />
  1318. }
  1319. </TabPane>
  1320. );
  1321. })}
  1322. {/* {this.state.status === 4 ? (
  1323. <TabPane tab="原订单" key="3">
  1324. <Form
  1325. layout="horizontal"
  1326. onSubmit={this.handleSubmit}
  1327. id="demand-form"
  1328. style={{ paddingBottom: "40px" }}
  1329. >
  1330. <Spin spinning={this.state.loading}>
  1331. <OrderDetail
  1332. orderData={this.state.primaryOrderData}
  1333. getOrderLog={this.getOrderLog}
  1334. dataSourceX={this.state.dataSourceX}
  1335. contactList={this.state.contactList}
  1336. totalCui={this.state.totalCui}
  1337. contactListNew={this.state.contactListNew}
  1338. orderNo={this.state.primaryOrderNo}
  1339. />
  1340. </Spin>
  1341. </Form>
  1342. </TabPane>
  1343. ) : (
  1344. ""
  1345. )} */}
  1346. {tabList.map((item, index) => {
  1347. if (item.usedOrder) {
  1348. return (
  1349. <TabPane
  1350. tab={"原订单" + (index + 1)}
  1351. key={item.usedOrder}
  1352. >
  1353. <Form
  1354. layout="horizontal"
  1355. onSubmit={this.handleSubmit}
  1356. id="demand-form"
  1357. style={{ paddingBottom: "40px" }}
  1358. >
  1359. <Spin spinning={this.state.loading}>
  1360. {
  1361. this.state.activeKey === String(item.usedOrder) ?
  1362. <OrderDetail
  1363. orderData={this.state.primaryOrderData}
  1364. getOrderLog={this.getOrderLog}
  1365. dataSourceX={this.state.dataSourceX}
  1366. contactList={this.state.contactList}
  1367. orderNo={this.state.primaryOrderNo}
  1368. totalCui={this.state.totalCui}
  1369. contactListNew={this.state.contactListNew}
  1370. /> : <div />
  1371. }
  1372. </Spin>
  1373. </Form>
  1374. </TabPane>
  1375. );
  1376. } else {
  1377. return "";
  1378. }
  1379. })}
  1380. {this.state.status === 4 && this.state.isAddition ? (
  1381. this.state.type === 4 || this.state.type === 5 ? (
  1382. <TabPane tab="附加订单" key="c">
  1383. {
  1384. this.state.activeKey === "c" ?
  1385. <OrderDetail
  1386. orderData={this.state.additionalOrderData}
  1387. getOrderLog={this.getOrderLog}
  1388. dataSourceX={this.state.dataSourceX}
  1389. totalCui={this.state.totalCui}
  1390. contactListNew={this.state.contactListNew}
  1391. contactList={this.state.contactList}
  1392. orderNo={this.state.additionalOrder}
  1393. /> : <div />
  1394. }
  1395. </TabPane>
  1396. ) : (
  1397. ""
  1398. )
  1399. ) : (
  1400. ""
  1401. )}
  1402. </Tabs>
  1403. </Modal> : <div />}
  1404. <Modal
  1405. maskClosable={false}
  1406. visible={this.state.noVisible}
  1407. onOk={this.handleOk}
  1408. onCancel={this.noCancel}
  1409. width="400px"
  1410. title={"拒绝理由"}
  1411. footer=""
  1412. className="admin-desc-content"
  1413. confirmLoading={this.state.confirmLoading}
  1414. >
  1415. <Form layout="horizontal" id="demand-form">
  1416. <Spin spinning={this.state.loading}>
  1417. <div className="clearfix">
  1418. <FormItem
  1419. labelCol={{ span: 4 }}
  1420. wrapperCol={{ span: 16 }}
  1421. label="拒绝理由"
  1422. >
  1423. <Input
  1424. type="textarea"
  1425. placeholder="请输入拒绝理由"
  1426. rows={4}
  1427. value={this.state.reason}
  1428. onChange={e => {
  1429. this.setState({ reason: e.target.value });
  1430. }}
  1431. />
  1432. </FormItem>
  1433. </div>
  1434. <div className="clearfix">
  1435. <Button
  1436. className="cancel"
  1437. type="primary"
  1438. onClick={this.examOks}
  1439. style={{ marginLeft: "50px" }}
  1440. htmlType="submit"
  1441. loading={this.state.aloading}
  1442. >
  1443. 确定
  1444. </Button>
  1445. <Button
  1446. className="cancel"
  1447. type="ghost"
  1448. onClick={this.noCancel}
  1449. style={{ marginLeft: "50px" }}
  1450. >
  1451. 取消
  1452. </Button>
  1453. </div>
  1454. </Spin>
  1455. </Form>
  1456. </Modal>
  1457. {/* <Modal
  1458. visible={this.state.rizhivisible}
  1459. className="admin-desc-content"
  1460. width="800px"
  1461. maskClosable={false}
  1462. title="订单日志"
  1463. footer={null}
  1464. onCancel={this.closeOrderLog}
  1465. >
  1466. <div className="patent-table">
  1467. <Spin spinning={this.state.loading}>
  1468. <Table
  1469. bordered
  1470. columns={this.state.columnsrizhi}
  1471. dataSource={this.state.dataSourcerizhi}
  1472. pagination={false}
  1473. />
  1474. </Spin>
  1475. </div>
  1476. </Modal> */}
  1477. <OrderRiZi
  1478. dataSourcerizhi={this.state.dataSourcerizhi}
  1479. closeOrderLog={this.closeOrderLog}
  1480. visible={this.state.rizhivisible}
  1481. loading={this.state.loading}
  1482. />
  1483. </div>
  1484. {/* {this.state.addnextVisible && <ProjectDetailsReadOnly
  1485. infor={this.state.dataInfor}
  1486. visible={this.state.addnextVisible}
  1487. onCancel={this.nextCancel}
  1488. />} */}
  1489. {
  1490. // 项目业务详情
  1491. this.state.addnextVisible &&
  1492. <NewEditProject
  1493. readOnly={true}
  1494. visible={this.state.addnextVisible}
  1495. dataInfor={this.state.dataInfor}
  1496. onCancel={this.nextCancel}
  1497. />
  1498. }
  1499. </div>
  1500. );
  1501. }
  1502. })
  1503. );
  1504. export default contractChange;