contractJsjl.js 43 KB

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