contractCwzj.js 46 KB

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