contractJszj.js 44 KB

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