contractJsy.js 37 KB

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