contractYxy.js 38 KB

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