contractCwzj.js 37 KB

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