contractJsjl.js 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320
  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/changeDetailJsjl.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. orderNo: this.state.searchData.orderNoSearch,
  37. contractNo: this.state.searchData.contractNoSearch,
  38. processState: this.props.processState,
  39. timeType: this.state.searchData.timeTypeSearch,
  40. startTime: this.state.searchData.releaseDate[0],
  41. endTime: this.state.searchData.releaseDate[1],
  42. salesmanName: this.state.searchData.salesmanNameSearch,
  43. complete: this.state.searchData.completeSearch || 1,
  44. depId: this.state.searchData.depIdSearch
  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. // console.log("row",this.state.activeKey);
  343. },
  344. //点击打卡项目详情
  345. tableRowClickX(record) {
  346. this.setState({
  347. jid: record.id, //项目ID
  348. kid: record.commodityId, //商品ID
  349. commodityName: record.commodityName, //金额
  350. commodityPrice: record.commodityPrice, //金额
  351. commodityQuantity: record.commodityQuantity, //数量
  352. taskComment: record.taskComment, //备注
  353. main: record.main.toString(), //是否为主要
  354. addnextVisible: true,
  355. addState: 0
  356. });
  357. },
  358. //项目详情关闭
  359. nextCancel() {
  360. this.setState({
  361. addnextVisible: false
  362. });
  363. },
  364. // 合同变更详情
  365. ChangeDetail(id) {
  366. let url = window.location.href.substring(7);
  367. $.ajax({
  368. method: "get",
  369. dataType: "json",
  370. crossDomain: false,
  371. url:
  372. globalConfig.context +
  373. "/api/admin/orderChange/orderChangeDetailsById",
  374. data: {
  375. id: id
  376. },
  377. success: function(data) {
  378. if (data.data) {
  379. let thisdata = data.data;
  380. Object.assign(thisdata, {
  381. processStateText: this.state.processStateText,
  382. userName: this.state.userName,
  383. contractNo: this.state.contractNo
  384. });
  385. this.setState({
  386. contractData: thisdata,
  387. voucherUrl: thisdata.voucherUrl
  388. ? splitUrl(
  389. thisdata.voucherUrl,
  390. ",",
  391. globalConfig.avatarHost + "/upload",
  392. url
  393. )
  394. : []
  395. });
  396. }
  397. }.bind(this)
  398. });
  399. $.ajax({
  400. method: "get",
  401. dataType: "json",
  402. crossDomain: false,
  403. url:
  404. globalConfig.context +
  405. "/api/admin/orderChange/listOrderInvoiceAndBill",
  406. data: {
  407. orderNo: this.state.orderNo
  408. },
  409. success: function(data) {
  410. if (!data.data) return;
  411. let proTotal = 0;
  412. let invTotal = 0;
  413. data.data.bill.forEach(item => {
  414. proTotal += item.transactionAmount;
  415. });
  416. data.data.invoice.forEach(item => {
  417. invTotal += item.amount;
  418. });
  419. this.setState({
  420. proceedsData: data.data,
  421. proTotal,
  422. invTotal
  423. });
  424. }.bind(this)
  425. });
  426. $.ajax({
  427. method: "get",
  428. dataType: "json",
  429. crossDomain: false,
  430. url:
  431. globalConfig.context +
  432. "/api/admin/orderChange/listOrderRefundInvoice",
  433. data: {
  434. orderNo: this.state.orderNo
  435. },
  436. success: data => {
  437. if (!data) return;
  438. data.data.forEach(item => {
  439. item.load = true;
  440. });
  441. this.setState({
  442. refundInvoice: data.data
  443. });
  444. }
  445. });
  446. },
  447. //订单详情
  448. xiangqing(orderNos) {
  449. $.ajax({
  450. method: "get",
  451. dataType: "json",
  452. crossDomain: false,
  453. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  454. data: {
  455. orderNo: orderNos
  456. },
  457. success: function(data) {
  458. if (data.error.length || data.data.list == "") {
  459. if (data.error && data.error.length) {
  460. message.warning(data.error[0].message);
  461. }
  462. } else {
  463. let thisdata = data.data;
  464. this.setState({
  465. userName: thisdata.userName,
  466. primaryOrderNo: thisdata.primaryOrder,
  467. additionalOrder: thisdata.additionalOrder,
  468. contractNo: thisdata.contractNo,
  469. // arrears: thisdata.arrears,
  470. orderData: thisdata
  471. });
  472. }
  473. }.bind(this)
  474. });
  475. },
  476. // 原订单数据
  477. primaryOrder(primaryOrder) {
  478. $.ajax({
  479. method: "get",
  480. dataType: "json",
  481. crossDomain: false,
  482. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  483. data: {
  484. orderNo: primaryOrder
  485. },
  486. success: function(data) {
  487. if (data.error.length || data.data.list == "") {
  488. if (data.error && data.error.length) {
  489. message.warning(data.error[0].message);
  490. }
  491. } else {
  492. let thisdata = data.data;
  493. this.setState({
  494. primaryOrderData: thisdata
  495. });
  496. }
  497. }.bind(this)
  498. });
  499. },
  500. // 附加订单数据
  501. additionalOrder(additionalOrder) {
  502. $.ajax({
  503. method: "get",
  504. dataType: "json",
  505. crossDomain: false,
  506. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  507. data: {
  508. orderNo: additionalOrder
  509. },
  510. success: function(data) {
  511. if (data.error.length || data.data.list == "") {
  512. if (data.error && data.error.length) {
  513. message.warning(data.error[0].message);
  514. }
  515. } else {
  516. let thisdata = data.data;
  517. this.setState({
  518. additionalOrderData: thisdata
  519. });
  520. }
  521. }.bind(this)
  522. });
  523. },
  524. //项目列表
  525. xiangmu(orderNos) {
  526. $.ajax({
  527. method: "get",
  528. dataType: "json",
  529. crossDomain: false,
  530. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  531. data: {
  532. orderNo: orderNos
  533. },
  534. success: function(data) {
  535. let theArr = [];
  536. if (data.error.length || data.data.list == "") {
  537. if (data.error && data.error.length) {
  538. message.warning(data.error[0].message);
  539. }
  540. } else {
  541. for (let i = 0; i < data.data.length; i++) {
  542. let thisdata = data.data[i];
  543. theArr.push({
  544. key: i,
  545. id: thisdata.id,
  546. orderNo: thisdata.orderNo, //订单编号
  547. commodityId: thisdata.commodityId, //项目ID
  548. commodityName: thisdata.commodityName, //项目名称
  549. cname: thisdata.cname, //项目类别
  550. commodityPrice: thisdata.commodityPrice, //项目价格
  551. commodityQuantity: thisdata.commodityQuantity, //项目数量
  552. main: thisdata.main, //是否为主要任务
  553. taskComment: thisdata.taskComment, //任务说明
  554. contacts: thisdata.contacts, //联系人
  555. contactsMobile: thisdata.contactsMobile, //联系人电话
  556. projectStatus: thisdata.projectStatus, //项目状态
  557. sort: thisdata.cSort
  558. });
  559. }
  560. }
  561. this.setState({
  562. dataSourceX: theArr
  563. });
  564. }.bind(this)
  565. });
  566. },
  567. search(obj) {
  568. this.setState(
  569. {
  570. searchData: obj
  571. },
  572. () => {
  573. this.loadData(1);
  574. }
  575. );
  576. },
  577. rizhi(orderNo) {
  578. $.ajax({
  579. method: "get",
  580. dataType: "json",
  581. crossDomain: false,
  582. url: "/api/admin/newOrder/selectOrderLog",
  583. data: {
  584. orderNo: orderNo
  585. },
  586. success: function(data) {
  587. let theArr = [];
  588. let thisData = data.data;
  589. if (!thisData.length) {
  590. if (data.error && data.error.length) {
  591. message.warning(data.error[0].message);
  592. }
  593. thisData = {};
  594. } else {
  595. for (let i = 0; i < data.data.length; i++) {
  596. let thisdata = data.data[i];
  597. theArr.push({
  598. processName: thisdata.processName,
  599. adminName: thisdata.adminName,
  600. createDate: thisdata.createDate
  601. });
  602. }
  603. }
  604. this.setState({
  605. dataSourcerizhi: theArr
  606. });
  607. }.bind(this)
  608. });
  609. },
  610. getOrderLog(orderNo) {
  611. this.setState({
  612. rizhivisible: true
  613. });
  614. this.rizhi(orderNo);
  615. },
  616. closeOrderLog() {
  617. this.setState({
  618. rizhivisible: false
  619. });
  620. },
  621. //节点列表
  622. jiedian(orderNos) {
  623. $.ajax({
  624. method: "get",
  625. dataType: "json",
  626. crossDomain: false,
  627. url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",
  628. data: {
  629. orderNo: orderNos
  630. },
  631. success: function(data) {
  632. let theArr = [];
  633. let thisData = [];
  634. if (data.error.length || data.data.list == "") {
  635. if (data.error && data.error.length) {
  636. message.warning(data.error[0].message);
  637. }
  638. } else {
  639. for (let i = 0; i < data.data.length; i++) {
  640. thisData = data.data[i];
  641. theArr.push({
  642. key: i,
  643. dunSubject: thisData.dunSubject
  644. ? thisData.dunSubject.toString()
  645. : "", //催款科目
  646. id: thisData.id, //节点Id
  647. money: thisData.money, //催款金额
  648. dunStatus: thisData.dunStatus //催款状态
  649. });
  650. }
  651. this.setState({
  652. contactList: theArr
  653. });
  654. }
  655. }.bind(this)
  656. });
  657. },
  658. jiedianNew(orderNos) {
  659. $.ajax({
  660. method: "get",
  661. dataType: "json",
  662. crossDomain: false,
  663. url:
  664. globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
  665. data: {
  666. orderNo: orderNos
  667. },
  668. success: function(data) {
  669. if (data.error && data.error.length) {
  670. message.warning(data.error[0].message);
  671. } else {
  672. let theArr = [];
  673. let thisData = [];
  674. let arr = data.data || [];
  675. let totalCui = 0;
  676. for (let i = 0; i < arr.length; i++) {
  677. thisData = arr[i];
  678. totalCui += +thisData.money;
  679. theArr.push({
  680. key: i,
  681. dunSubject: thisData.dunSubject
  682. ? thisData.dunSubject.toString()
  683. : "", //催款科目
  684. id: thisData.id, //节点Id
  685. money: thisData.money, //催款金额
  686. // orderNo: record ? record.orderNo : this.props.datauser.orderNo,
  687. commodityName: thisData.commodityName,
  688. projectType: thisData.projectType,
  689. dunTypeName: thisData.dunTypeName,
  690. status: thisData.status,
  691. waitDay: thisData.waitDay,
  692. effectiveCount: thisData.effectiveCount,
  693. startDate: thisData.startDate,
  694. dunType: thisData.dunType,
  695. appropriationRatio: thisData.appropriationRatio
  696. });
  697. }
  698. if (!totalCui) {
  699. totalCui = 0;
  700. }
  701. totalCui = (Math.round(totalCui * 10000) / 10000).toFixed(4);
  702. this.setState({
  703. contactListNew: theArr,
  704. totalCui
  705. });
  706. }
  707. }.bind(this)
  708. }).always(
  709. function() {
  710. this.setState({
  711. loading: false
  712. });
  713. }.bind(this)
  714. );
  715. },
  716. //审核通过
  717. examOk() {
  718. $.ajax({
  719. method: "post",
  720. dataType: "json",
  721. crossDomain: false,
  722. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  723. data: {
  724. orderNo: this.state.orderNo,
  725. orderStatus: 2
  726. },
  727. success: function(data) {
  728. if (data.error.length || data.data.list == "") {
  729. if (data.error && data.error.length) {
  730. message.warning(data.error[0].message);
  731. }
  732. } else {
  733. message.success("该订单已通过审核~");
  734. this.setState({
  735. visible: false
  736. });
  737. this.reset();
  738. }
  739. }.bind(this)
  740. }).always(
  741. function() {
  742. this.setState({
  743. loading: false
  744. });
  745. }.bind(this)
  746. );
  747. },
  748. //通过发给外包
  749. outsourcing() {
  750. $.ajax({
  751. method: "post",
  752. dataType: "json",
  753. crossDomain: false,
  754. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  755. data: {
  756. orderNo: this.state.orderNo,
  757. orderStatus: 2,
  758. outsource: 1
  759. },
  760. success: function(data) {
  761. if (data.error.length || data.data.list == "") {
  762. if (data.error && data.error.length) {
  763. message.warning(data.error[0].message);
  764. }
  765. } else {
  766. message.success("该订单已通过审核~");
  767. this.setState({
  768. visible: false
  769. });
  770. this.reset();
  771. }
  772. }.bind(this)
  773. }).always(
  774. function() {
  775. this.setState({
  776. loading: false
  777. });
  778. }.bind(this)
  779. );
  780. },
  781. //审核不通过
  782. examOks() {
  783. this.setState({
  784. aloading: true
  785. });
  786. $.ajax({
  787. method: "post",
  788. dataType: "json",
  789. crossDomain: false,
  790. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  791. data: {
  792. orderNo: this.state.orderNo,
  793. orderStatus: 3,
  794. reason: this.state.reason
  795. },
  796. success: function(data) {
  797. if (data.error.length || data.data.list == "") {
  798. if (data.error && data.error.length) {
  799. message.warning(data.error[0].message);
  800. this.setState({
  801. aloading: true
  802. });
  803. }
  804. } else {
  805. message.success("该订单已被拒绝~");
  806. this.setState({
  807. visible: false,
  808. aloading: false,
  809. noVisible: false,
  810. reason: ""
  811. });
  812. this.reset();
  813. }
  814. }.bind(this)
  815. }).always(
  816. function() {
  817. this.setState({
  818. loading: false
  819. });
  820. }.bind(this)
  821. );
  822. },
  823. //点击拒绝
  824. examNo() {
  825. this.setState({
  826. noVisible: true
  827. });
  828. },
  829. loadDataChange() {
  830. $.ajax({
  831. method: "get",
  832. dataType: "json",
  833. async: false,
  834. crossDomain: false,
  835. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  836. data: {
  837. changeId: this.state.id
  838. },
  839. success: function(data) {
  840. if (data.error.length || data.data.list == "") {
  841. if (data.error && data.error.length) {
  842. message.warning(data.error[0].message);
  843. }
  844. } else {
  845. // console.log("拿到历史", data.data);
  846. this.setState({
  847. dataProps: data.data
  848. });
  849. }
  850. }.bind(this)
  851. });
  852. },
  853. callback(key) {
  854. this.setState({
  855. activeKey: key
  856. });
  857. // console.log("change",this.state.activeKey);
  858. if (key === "1") {
  859. this.xiangmu(this.state.orderNo);
  860. this.jiedian(this.state.orderNo);
  861. this.jiedianNew(this.state.orderNo);
  862. }
  863. if (key === "2") {
  864. this.ChangeDetail(this.state.id);
  865. this.loadDataChange();
  866. }
  867. if (key === "3") {
  868. this.primaryOrder(this.state.primaryOrderNo);
  869. this.xiangmu(this.state.primaryOrderNo);
  870. this.jiedian(this.state.primaryOrderNo);
  871. this.jiedianNew(this.state.primaryOrderNo);
  872. }
  873. if (key === "4") {
  874. this.additionalOrder(this.state.additionalOrder);
  875. this.xiangmu(this.state.additionalOrder);
  876. this.jiedian(this.state.additionalOrder);
  877. this.jiedianNew(this.state.additionalOrder);
  878. this.setState({
  879. buttonStatusA: false
  880. });
  881. } else {
  882. this.setState({
  883. buttonStatusA: true
  884. });
  885. }
  886. },
  887. closeDesc(e, s) {
  888. this.state.activeKey = "1";
  889. this.state.userDetaile = false;
  890. this.state.signBillVisible = false;
  891. this.state.visible = e;
  892. if (s) {
  893. this.loadData(this.state.pageNo);
  894. }
  895. },
  896. // 获取原订单编号
  897. getPrimaryOrder(value) {
  898. this.setState({
  899. primaryOrder: value
  900. });
  901. },
  902. getAdditionalOrder(value) {
  903. this.setState({
  904. additionalOrder: value
  905. });
  906. },
  907. getUrl(url) {
  908. let theorgCodeUrl = [];
  909. if (url.length) {
  910. let picArr = [];
  911. url.map(function(item) {
  912. if (
  913. item.response &&
  914. item.response.data &&
  915. item.response.data.length
  916. ) {
  917. picArr.push(item.response.data);
  918. }
  919. });
  920. theorgCodeUrl = picArr.join(",");
  921. }
  922. return theorgCodeUrl;
  923. },
  924. sureOut() {
  925. if (!this.state.companyName) {
  926. message.warning("公司名称不能为空");
  927. return;
  928. }
  929. if (!this.state.unitPrice) {
  930. message.warning("单价不能为空");
  931. return;
  932. }
  933. if (!this.state.unitNumber) {
  934. message.warning("数量不能为空");
  935. return;
  936. }
  937. if (!this.state.amount) {
  938. message.warning("总金额不能为空");
  939. return;
  940. }
  941. if (!this.state.outsourceRemarks) {
  942. message.warning("备注不能为空");
  943. return;
  944. }
  945. if (this.state.pictureUrl.length === 0) {
  946. message.warning("合同扫描件不能为空");
  947. return;
  948. }
  949. $.ajax({
  950. method: "POST",
  951. dataType: "json",
  952. crossDomain: false,
  953. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  954. data: {
  955. id: this.state.id,
  956. orderNo: this.state.orderNo,
  957. companyName: this.state.companyName,
  958. amount: this.state.amount,
  959. outsourceRemarks: this.state.outsourceRemarks,
  960. unitNumber: this.state.unitNumber,
  961. unitPrice: this.state.unitPrice,
  962. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  963. ? this.getUrl(this.state.attachmentUrl)
  964. : "",
  965. orderStatus: 2,
  966. pictureUrl: this.getUrl(this.state.pictureUrl).length
  967. ? this.getUrl(this.state.pictureUrl)
  968. : ""
  969. }
  970. }).done(
  971. function(data) {
  972. this.setState({
  973. loading: false
  974. });
  975. if (!data.error.length) {
  976. message.success("发起成功!");
  977. this.outReset();
  978. this.visitCancel();
  979. } else {
  980. message.warning(data.error[0].message);
  981. }
  982. }.bind(this)
  983. );
  984. },
  985. //关闭输入理由框
  986. noCancel() {
  987. this.setState({
  988. noVisible: false,
  989. aloading: false,
  990. reason: ""
  991. });
  992. },
  993. //重置
  994. reset() {
  995. this.setState({
  996. signBillVisible: false
  997. });
  998. this.state.orderNo = "";
  999. this.state.customerName = "";
  1000. this.state.releaseDate[0] = undefined;
  1001. this.state.releaseDate[1] = undefined;
  1002. this.state.approval = undefined;
  1003. this.loadData(1);
  1004. },
  1005. outReset() {
  1006. this.setState({
  1007. companyName: "",
  1008. amount: "",
  1009. unitPrice: "",
  1010. unitNumber: "",
  1011. outsourceRemarks: "",
  1012. attachmentUrl: [],
  1013. pictureUrl: []
  1014. });
  1015. },
  1016. getOrgCodeUrl(e) {
  1017. this.setState({ pictureUrl: e });
  1018. },
  1019. //关闭详情
  1020. visitCancel() {
  1021. this.setState(
  1022. {
  1023. visible: false,
  1024. activeKey: "1"
  1025. },
  1026. () => {
  1027. this.setState({
  1028. activeKey: "1"
  1029. });
  1030. }
  1031. );
  1032. this.loadData(this.state.page);
  1033. // console.log("table",this.state.activeKey);
  1034. },
  1035. visitOk() {
  1036. this.setState({
  1037. visible: false
  1038. });
  1039. },
  1040. render() {
  1041. const formItemLayout = {
  1042. labelCol: { span: 8 },
  1043. wrapperCol: { span: 14 }
  1044. };
  1045. const FormItem = Form.Item;
  1046. const { TabPane } = Tabs;
  1047. return (
  1048. <div className="user-content">
  1049. <ShowModalDiv ShowModal={this.state.showModal} />
  1050. <div className="content-title">
  1051. <span>合同变更审核订单</span>
  1052. </div>
  1053. <div className="user-search">
  1054. <SearchInput search={this.search} />
  1055. <div className="patent-table">
  1056. <Spin spinning={this.state.loading}>
  1057. <Table
  1058. size="small"
  1059. bordered
  1060. columns={this.state.columns}
  1061. dataSource={this.state.dataSource}
  1062. pagination={this.state.pagination}
  1063. onRowClick={this.tableRowClick}
  1064. />
  1065. </Spin>
  1066. </div>
  1067. <Modal
  1068. className="customeDetails"
  1069. footer=""
  1070. maskClosable={false}
  1071. width="900px"
  1072. visible={this.state.visible}
  1073. onOk={this.visitOk}
  1074. onCancel={this.visitCancel}
  1075. >
  1076. <Tabs activeKey={this.state.activeKey} onChange={this.callback}>
  1077. <TabPane tab="订单详情" key="1">
  1078. <Form
  1079. layout="horizontal"
  1080. onSubmit={this.handleSubmit}
  1081. id="demand-form"
  1082. style={{ paddingBottom: "40px" }}
  1083. >
  1084. <Spin spinning={this.state.loading}>
  1085. <OrderDetail
  1086. orderData={this.state.orderData}
  1087. getOrderLog={this.getOrderLog}
  1088. dataSourceX={this.state.dataSourceX}
  1089. contactList={this.state.contactList}
  1090. orderNo={this.state.orderNo}
  1091. totalCui={this.state.totalCui}
  1092. contactListNew={this.state.contactListNew}
  1093. />
  1094. </Spin>
  1095. </Form>
  1096. </TabPane>
  1097. <TabPane tab="合同变更记录" key="2">
  1098. <ChangeDetail
  1099. data={this.state.contractData}
  1100. pictureUrl={this.state.voucherUrl}
  1101. processState={this.props.processState}
  1102. // loadData={this.callback}
  1103. reset={this.state.visible}
  1104. dataSource={this.state.dataProps}
  1105. proceedsData={this.state.proceedsData}
  1106. proceedsTotal={this.state.proTotal}
  1107. invoiceTotal={this.state.invTotal}
  1108. contactList={this.state.refundInvoice}
  1109. onCancel={this.visitCancel}
  1110. />
  1111. </TabPane>
  1112. {this.state.status === 4 ? (
  1113. <TabPane tab="原订单" key="3">
  1114. <Form
  1115. layout="horizontal"
  1116. onSubmit={this.handleSubmit}
  1117. id="demand-form"
  1118. style={{ paddingBottom: "40px" }}
  1119. >
  1120. <Spin spinning={this.state.loading}>
  1121. <OrderDetail
  1122. orderData={this.state.primaryOrderData}
  1123. getOrderLog={this.getOrderLog}
  1124. dataSourceX={this.state.dataSourceX}
  1125. contactList={this.state.contactList}
  1126. orderNo={this.state.primaryOrderNo}
  1127. totalCui={this.state.totalCui}
  1128. contactListNew={this.state.contactListNew}
  1129. />
  1130. </Spin>
  1131. </Form>
  1132. </TabPane>
  1133. ) : (
  1134. ""
  1135. )}
  1136. {this.state.status === 4 ? (
  1137. this.state.type === 4 || this.state.type === 5 ? (
  1138. <TabPane tab="附加订单" key="4">
  1139. <OrderDetail
  1140. orderData={this.state.additionalOrderData}
  1141. getOrderLog={this.getOrderLog}
  1142. dataSourceX={this.state.dataSourceX}
  1143. contactList={this.state.contactList}
  1144. orderNo={this.state.additionalOrder}
  1145. totalCui={this.state.totalCui}
  1146. contactListNew={this.state.contactListNew}
  1147. />
  1148. </TabPane>
  1149. ) : (
  1150. ""
  1151. )
  1152. ) : (
  1153. ""
  1154. )}
  1155. </Tabs>
  1156. </Modal>
  1157. <Modal
  1158. maskClosable={false}
  1159. visible={this.state.addnextVisible}
  1160. onOk={this.nextCancel}
  1161. onCancel={this.nextCancel}
  1162. confirmLoading={this.state.confirmLoading}
  1163. width="800px"
  1164. title={"项目任务详情"}
  1165. footer=""
  1166. className="admin-desc-content"
  1167. >
  1168. <Form layout="horizontal" id="demand-form">
  1169. <Spin spinning={this.state.loading}>
  1170. <div className="clearfix">
  1171. <FormItem
  1172. className="half-item"
  1173. {...formItemLayout}
  1174. label="项目名称"
  1175. >
  1176. <span>{this.state.commodityName}</span>
  1177. </FormItem>
  1178. <FormItem
  1179. className="half-item"
  1180. {...formItemLayout}
  1181. label="项目数量"
  1182. >
  1183. <span>{this.state.commodityQuantity}</span>
  1184. </FormItem>
  1185. <FormItem
  1186. className="half-item"
  1187. {...formItemLayout}
  1188. label="金额(万元)"
  1189. >
  1190. <span>{this.state.commodityPrice}</span>
  1191. </FormItem>
  1192. <FormItem
  1193. className="half-item"
  1194. {...formItemLayout}
  1195. label="主要项目"
  1196. >
  1197. <span>{getboutique(this.state.main)}</span>
  1198. </FormItem>
  1199. <div className="clearfix">
  1200. <FormItem
  1201. labelCol={{ span: 4 }}
  1202. wrapperCol={{ span: 16 }}
  1203. label="服务说明"
  1204. >
  1205. <span>{this.state.taskComment}</span>
  1206. </FormItem>
  1207. </div>
  1208. </div>
  1209. </Spin>
  1210. </Form>
  1211. </Modal>
  1212. <Modal
  1213. maskClosable={false}
  1214. visible={this.state.noVisible}
  1215. onOk={this.handleOk}
  1216. onCancel={this.noCancel}
  1217. width="400px"
  1218. title={"拒绝理由"}
  1219. footer=""
  1220. className="admin-desc-content"
  1221. confirmLoading={this.state.confirmLoading}
  1222. >
  1223. <Form layout="horizontal" id="demand-form">
  1224. <Spin spinning={this.state.loading}>
  1225. <div className="clearfix">
  1226. <FormItem
  1227. labelCol={{ span: 4 }}
  1228. wrapperCol={{ span: 16 }}
  1229. label="拒绝理由"
  1230. >
  1231. <Input
  1232. type="textarea"
  1233. placeholder="请输入拒绝理由"
  1234. rows={4}
  1235. value={this.state.reason}
  1236. onChange={e => {
  1237. this.setState({ reason: e.target.value });
  1238. }}
  1239. />
  1240. </FormItem>
  1241. </div>
  1242. <div className="clearfix">
  1243. <Button
  1244. className="cancel"
  1245. type="primary"
  1246. onClick={this.examOks}
  1247. style={{ marginLeft: "50px" }}
  1248. htmlType="submit"
  1249. loading={this.state.aloading}
  1250. >
  1251. 确定
  1252. </Button>
  1253. <Button
  1254. className="cancel"
  1255. type="ghost"
  1256. onClick={this.noCancel}
  1257. style={{ marginLeft: "50px" }}
  1258. >
  1259. 取消
  1260. </Button>
  1261. </div>
  1262. </Spin>
  1263. </Form>
  1264. </Modal>
  1265. {/* <Modal
  1266. visible={this.state.rizhivisible}
  1267. className="admin-desc-content"
  1268. width="800px"
  1269. maskClosable={false}
  1270. title="订单日志"
  1271. footer={null}
  1272. onCancel={this.closeOrderLog}
  1273. >
  1274. <div className="patent-table">
  1275. <Spin spinning={this.state.loading}>
  1276. <Table
  1277. bordered
  1278. columns={this.state.columnsrizhi}
  1279. dataSource={this.state.dataSourcerizhi}
  1280. pagination={false}
  1281. />
  1282. </Spin>
  1283. </div>
  1284. </Modal> */}
  1285. <OrderRiZi
  1286. dataSourcerizhi={this.state.dataSourcerizhi}
  1287. closeOrderLog={this.closeOrderLog}
  1288. visible={this.state.rizhivisible}
  1289. loading={this.state.loading}
  1290. />
  1291. </div>
  1292. </div>
  1293. );
  1294. }
  1295. })
  1296. );
  1297. export default contractChange;