contractYxy.js 45 KB

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