contractYxy.js 44 KB

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