contractCwzy.js 37 KB

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