contractYxy.js 47 KB

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