contractYxgly.js 42 KB

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