contractYxgly.js 42 KB

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