contractCwzy.js 37 KB

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