contractYxy.js 45 KB

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