contractCwzj.js 40 KB

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