contractJszj.js 43 KB

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