contractYxgly.js 39 KB

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