contractYxy.js 45 KB

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