contractYxy.js 41 KB

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