contractJszj.js 39 KB

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