contractYxy.js 44 KB

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