contractCwzj.js 36 KB

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