contractCwzj.js 46 KB

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