contractJsy.js 41 KB

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