contractYxy.js 38 KB

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