contractJsy.js 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362
  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. splitStatus: thisdata.splitStatus
  529. });
  530. }
  531. }
  532. this.setState({
  533. dataSourceX: theArr
  534. });
  535. }.bind(this)
  536. });
  537. },
  538. search(obj) {
  539. this.setState(
  540. {
  541. searchData: obj
  542. },
  543. () => {
  544. this.loadData(1);
  545. }
  546. );
  547. },
  548. rizhi(orderNo) {
  549. $.ajax({
  550. method: "get",
  551. dataType: "json",
  552. crossDomain: false,
  553. url: "/api/admin/newOrder/selectOrderLog",
  554. data: {
  555. orderNo: orderNo
  556. },
  557. success: function (data) {
  558. let theArr = [];
  559. let thisData = data.data;
  560. if (!thisData.length) {
  561. if (data.error && data.error.length) {
  562. message.warning(data.error[0].message);
  563. }
  564. thisData = {};
  565. } else {
  566. for (let i = 0; i < data.data.length; i++) {
  567. let thisdata = data.data[i];
  568. theArr.push({
  569. processName: thisdata.processName,
  570. adminName: thisdata.adminName,
  571. createDate: thisdata.createDate,
  572. remarks: thisdata.remarks
  573. });
  574. }
  575. }
  576. this.setState({
  577. dataSourcerizhi: theArr
  578. });
  579. }.bind(this)
  580. });
  581. },
  582. getOrderLog(orderNo) {
  583. this.setState({
  584. rizhivisible: true
  585. });
  586. this.rizhi(orderNo);
  587. },
  588. closeOrderLog() {
  589. this.setState({
  590. rizhivisible: false
  591. });
  592. },
  593. //节点列表
  594. jiedian(orderNos) {
  595. $.ajax({
  596. method: "get",
  597. dataType: "json",
  598. crossDomain: false,
  599. url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",
  600. data: {
  601. orderNo: orderNos
  602. },
  603. success: function (data) {
  604. let theArr = [];
  605. let thisData = [];
  606. if (data.error.length || data.data.list == "") {
  607. if (data.error && data.error.length) {
  608. message.warning(data.error[0].message);
  609. }
  610. } else {
  611. for (let i = 0; i < data.data.length; i++) {
  612. thisData = data.data[i];
  613. theArr.push({
  614. key: i,
  615. dunSubject: thisData.dunSubject
  616. ? thisData.dunSubject.toString()
  617. : "", //催款科目
  618. id: thisData.id, //节点Id
  619. money: thisData.money, //催款金额
  620. dunStatus: thisData.dunStatus //催款状态
  621. });
  622. }
  623. this.setState({
  624. contactList: theArr
  625. });
  626. }
  627. }.bind(this)
  628. });
  629. },
  630. jiedianNew(orderNos) {
  631. $.ajax({
  632. method: "get",
  633. dataType: "json",
  634. crossDomain: false,
  635. url:
  636. globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
  637. data: {
  638. orderNo: orderNos
  639. },
  640. success: function (data) {
  641. if (data.error && data.error.length) {
  642. message.warning(data.error[0].message);
  643. } else {
  644. let theArr = [];
  645. let thisData = [];
  646. let arr = data.data || [];
  647. let totalCui = 0;
  648. for (let i = 0; i < arr.length; i++) {
  649. thisData = arr[i];
  650. totalCui += +thisData.money;
  651. theArr.push({
  652. key: i,
  653. dunSubject: thisData.dunSubject
  654. ? thisData.dunSubject.toString()
  655. : "", //催款科目
  656. id: thisData.id, //节点Id
  657. money: thisData.money, //催款金额
  658. // orderNo: record ? record.orderNo : this.props.datauser.orderNo,
  659. commodityName: thisData.commodityName,
  660. projectType: thisData.projectType,
  661. dunTypeName: thisData.dunTypeName,
  662. status: thisData.status,
  663. waitDay: thisData.waitDay,
  664. effectiveCount: thisData.effectiveCount,
  665. startDate: thisData.startDate,
  666. dunType: thisData.dunType,
  667. appropriationRatio: thisData.appropriationRatio
  668. });
  669. }
  670. if (!totalCui) {
  671. totalCui = 0;
  672. }
  673. totalCui = (Math.round(totalCui * 10000) / 10000).toFixed(4);
  674. this.setState({
  675. contactListNew: theArr,
  676. totalCui
  677. });
  678. }
  679. }.bind(this)
  680. }).always(
  681. function () {
  682. this.setState({
  683. loading: false
  684. });
  685. }.bind(this)
  686. );
  687. },
  688. //审核通过
  689. examOk() {
  690. $.ajax({
  691. method: "post",
  692. dataType: "json",
  693. crossDomain: false,
  694. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  695. data: {
  696. orderNo: this.state.orderNo,
  697. orderStatus: 2
  698. },
  699. success: function (data) {
  700. if (data.error.length || data.data.list == "") {
  701. if (data.error && data.error.length) {
  702. message.warning(data.error[0].message);
  703. }
  704. } else {
  705. message.success("该订单已通过审核~");
  706. this.setState({
  707. visible: false
  708. });
  709. this.reset();
  710. }
  711. }.bind(this)
  712. }).always(
  713. function () {
  714. this.setState({
  715. loading: false
  716. });
  717. }.bind(this)
  718. );
  719. },
  720. //通过发给外包
  721. outsourcing() {
  722. $.ajax({
  723. method: "post",
  724. dataType: "json",
  725. crossDomain: false,
  726. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  727. data: {
  728. orderNo: this.state.orderNo,
  729. orderStatus: 2,
  730. outsource: 1
  731. },
  732. success: function (data) {
  733. if (data.error.length || data.data.list == "") {
  734. if (data.error && data.error.length) {
  735. message.warning(data.error[0].message);
  736. }
  737. } else {
  738. message.success("该订单已通过审核~");
  739. this.setState({
  740. visible: false
  741. });
  742. this.reset();
  743. }
  744. }.bind(this)
  745. }).always(
  746. function () {
  747. this.setState({
  748. loading: false
  749. });
  750. }.bind(this)
  751. );
  752. },
  753. //审核不通过
  754. examOks() {
  755. this.setState({
  756. aloading: true
  757. });
  758. $.ajax({
  759. method: "post",
  760. dataType: "json",
  761. crossDomain: false,
  762. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  763. data: {
  764. orderNo: this.state.orderNo,
  765. orderStatus: 3,
  766. reason: this.state.reason
  767. },
  768. success: function (data) {
  769. if (data.error.length || data.data.list == "") {
  770. if (data.error && data.error.length) {
  771. message.warning(data.error[0].message);
  772. this.setState({
  773. aloading: true
  774. });
  775. }
  776. } else {
  777. message.success("该订单已被拒绝~");
  778. this.setState({
  779. visible: false,
  780. aloading: false,
  781. noVisible: false,
  782. reason: ""
  783. });
  784. this.reset();
  785. }
  786. }.bind(this)
  787. }).always(
  788. function () {
  789. this.setState({
  790. loading: false
  791. });
  792. }.bind(this)
  793. );
  794. },
  795. //点击拒绝
  796. examNo() {
  797. this.setState({
  798. noVisible: true
  799. });
  800. },
  801. loadDataChange(key) {
  802. $.ajax({
  803. method: "get",
  804. dataType: "json",
  805. async: false,
  806. crossDomain: false,
  807. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  808. data: {
  809. changeId: key
  810. },
  811. success: function (data) {
  812. if (data.error.length || data.data.list == "") {
  813. if (data.error && data.error.length) {
  814. message.warning(data.error[0].message);
  815. }
  816. } else {
  817. // console.log("拿到历史", data.data);
  818. this.setState({
  819. dataProps: data.data
  820. });
  821. }
  822. }.bind(this)
  823. });
  824. },
  825. callback(key) {
  826. this.setState(
  827. {
  828. activeKey: key
  829. },
  830. () => {
  831. if (key != "a" && key != "c" && key.length < 10) {
  832. this.ChangeDetail(key);
  833. this.loadDataChange(key);
  834. } else if (key != "a" && key != "c" && key.length > 10) {
  835. this.primaryOrder(key);
  836. this.xiangmu(key);
  837. this.jiedian(key);
  838. this.jiedianNew(key);
  839. this.loadDataChange(key);
  840. }
  841. }
  842. );
  843. if (key === "a") {
  844. this.xiangmu(this.state.orderNo);
  845. this.jiedian(this.state.orderNo);
  846. this.jiedianNew(this.state.orderNo);
  847. }
  848. // if (key === "2") {
  849. // this.ChangeDetail(this.state.orderNo);
  850. // this.loadDataChange();
  851. // }
  852. // if (key === "3") {
  853. // this.primaryOrder(this.state.primaryOrderNo);
  854. // this.xiangmu(this.state.primaryOrderNo);
  855. // this.jiedian(this.state.primaryOrderNo);
  856. // this.jiedianNew(this.state.primaryOrderNo);
  857. // }
  858. if (key === "c") {
  859. this.additionalOrder(this.state.additionalOrder);
  860. this.xiangmu(this.state.additionalOrder);
  861. this.jiedian(this.state.additionalOrder);
  862. this.jiedianNew(this.state.additionalOrder);
  863. this.setState({
  864. buttonStatusA: false
  865. });
  866. } else {
  867. this.setState({
  868. buttonStatusA: true
  869. });
  870. }
  871. },
  872. closeDesc(e, s) {
  873. this.state.activeKey = "a";
  874. this.state.userDetaile = false;
  875. this.state.signBillVisible = false;
  876. this.state.visible = e;
  877. if (s) {
  878. this.loadData(this.state.pageNo);
  879. }
  880. },
  881. // 获取原订单编号
  882. getPrimaryOrder(value) {
  883. this.setState({
  884. primaryOrder: value
  885. });
  886. },
  887. getAdditionalOrder(value) {
  888. this.setState({
  889. additionalOrder: value
  890. });
  891. },
  892. getUrl(url) {
  893. let theorgCodeUrl = [];
  894. if (url.length) {
  895. let picArr = [];
  896. url.map(function (item) {
  897. if (
  898. item.response &&
  899. item.response.data &&
  900. item.response.data.length
  901. ) {
  902. picArr.push(item.response.data);
  903. }
  904. });
  905. theorgCodeUrl = picArr.join(",");
  906. }
  907. return theorgCodeUrl;
  908. },
  909. sureOut() {
  910. if (!this.state.companyName) {
  911. message.warning("公司名称不能为空");
  912. return;
  913. }
  914. if (!this.state.unitPrice) {
  915. message.warning("单价不能为空");
  916. return;
  917. }
  918. if (!this.state.unitNumber) {
  919. message.warning("数量不能为空");
  920. return;
  921. }
  922. if (!this.state.amount) {
  923. message.warning("总金额不能为空");
  924. return;
  925. }
  926. if (!this.state.outsourceRemarks) {
  927. message.warning("备注不能为空");
  928. return;
  929. }
  930. if (this.state.pictureUrl.length === 0) {
  931. message.warning("合同扫描件不能为空");
  932. return;
  933. }
  934. $.ajax({
  935. method: "POST",
  936. dataType: "json",
  937. crossDomain: false,
  938. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  939. data: {
  940. id: this.state.id,
  941. orderNo: this.state.orderNo,
  942. companyName: this.state.companyName,
  943. amount: this.state.amount,
  944. outsourceRemarks: this.state.outsourceRemarks,
  945. unitNumber: this.state.unitNumber,
  946. unitPrice: this.state.unitPrice,
  947. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  948. ? this.getUrl(this.state.attachmentUrl)
  949. : "",
  950. orderStatus: 2,
  951. pictureUrl: this.getUrl(this.state.pictureUrl).length
  952. ? this.getUrl(this.state.pictureUrl)
  953. : ""
  954. }
  955. }).done(
  956. function (data) {
  957. this.setState({
  958. loading: false
  959. });
  960. if (!data.error.length) {
  961. message.success("发起成功!");
  962. this.outReset();
  963. this.visitCancel();
  964. } else {
  965. message.warning(data.error[0].message);
  966. }
  967. }.bind(this)
  968. );
  969. },
  970. //关闭输入理由框
  971. noCancel() {
  972. this.setState({
  973. noVisible: false,
  974. aloading: false,
  975. reason: ""
  976. });
  977. },
  978. //重置
  979. reset() {
  980. this.setState({
  981. signBillVisible: false
  982. });
  983. this.state.orderNo = "";
  984. this.state.customerName = "";
  985. this.state.releaseDate[0] = undefined;
  986. this.state.releaseDate[1] = undefined;
  987. this.state.approval = undefined;
  988. this.loadData(1);
  989. },
  990. outReset() {
  991. this.setState({
  992. companyName: "",
  993. amount: "",
  994. unitPrice: "",
  995. unitNumber: "",
  996. outsourceRemarks: "",
  997. attachmentUrl: [],
  998. pictureUrl: []
  999. });
  1000. },
  1001. getOrgCodeUrl(e) {
  1002. this.setState({ pictureUrl: e });
  1003. },
  1004. //关闭详情
  1005. visitCancel() {
  1006. this.setState(
  1007. {
  1008. visible: false,
  1009. activeKey: "a"
  1010. },
  1011. () => {
  1012. this.setState({
  1013. activeKey: "a"
  1014. });
  1015. }
  1016. );
  1017. this.loadData(this.state.pageNo);
  1018. },
  1019. visitOk() {
  1020. this.setState({
  1021. visible: false
  1022. });
  1023. },
  1024. render() {
  1025. const tabList = this.state.tabList || [];
  1026. const formItemLayout = {
  1027. labelCol: { span: 8 },
  1028. wrapperCol: { span: 14 }
  1029. };
  1030. const FormItem = Form.Item;
  1031. const { TabPane } = Tabs;
  1032. return (
  1033. <div className="user-content">
  1034. <ShowModalDiv ShowModal={this.state.showModal} />
  1035. <div className="content-title">
  1036. <span>合同变更审核订单</span>
  1037. </div>
  1038. <div className="user-search">
  1039. <Tabs
  1040. defaultActiveKey="1"
  1041. onChange={this.callback}
  1042. className="test">
  1043. <TabPane tab="搜索" key="1">
  1044. <div style={{ marginLeft: 10 }}>
  1045. <SearchInput search={this.search} />
  1046. </div>
  1047. </TabPane>
  1048. </Tabs>
  1049. <div className="patent-table">
  1050. <Spin spinning={this.state.loading}>
  1051. <Table
  1052. size="small"
  1053. bordered
  1054. columns={this.state.columns}
  1055. dataSource={this.state.dataSource}
  1056. pagination={this.state.pagination}
  1057. onRowClick={this.tableRowClick}
  1058. />
  1059. </Spin>
  1060. </div>
  1061. <Modal
  1062. className="customeDetails"
  1063. footer=""
  1064. maskClosable={false}
  1065. width="900px"
  1066. visible={this.state.visible}
  1067. onOk={this.visitOk}
  1068. onCancel={this.visitCancel}
  1069. >
  1070. <Tabs
  1071. activeKey={this.state.activeKey}
  1072. onChange={this.callback}
  1073. type="card"
  1074. >
  1075. <TabPane tab="订单详情" key="a">
  1076. <Form
  1077. layout="horizontal"
  1078. onSubmit={this.handleSubmit}
  1079. id="demand-form"
  1080. style={{ paddingBottom: "40px" }}
  1081. >
  1082. <Spin spinning={this.state.loading}>
  1083. <OrderDetail
  1084. processState={this.props.processState}
  1085. orderData={this.state.orderData}
  1086. getOrderLog={this.getOrderLog}
  1087. dataSourceX={this.state.dataSourceX}
  1088. contactList={this.state.contactList}
  1089. orderNo={this.state.orderNo}
  1090. totalCui={this.state.totalCui}
  1091. contactListNew={this.state.contactListNew}
  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. loadData={this.callback}
  1102. reset={this.state.visible}
  1103. dataSource={this.state.dataProps}
  1104. onCancel={this.visitCancel}
  1105. />
  1106. </TabPane> */}
  1107. {tabList.map((item, index) => {
  1108. return (
  1109. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1110. <ChangeDetail
  1111. id={item.id}
  1112. data={this.state.contractData}
  1113. pictureUrl={this.state.voucherUrl}
  1114. processState={this.props.processState}
  1115. loadData={this.callback}
  1116. reset={this.state.visible}
  1117. dataSource={this.state.dataProps}
  1118. onCancel={this.visitCancel}
  1119. />
  1120. </TabPane>
  1121. );
  1122. })}
  1123. {tabList.map((item, index) => {
  1124. if (item.usedOrder) {
  1125. return (
  1126. <TabPane
  1127. tab={"原订单" + (index + 1)}
  1128. key={item.usedOrder}
  1129. >
  1130. <Form
  1131. layout="horizontal"
  1132. onSubmit={this.handleSubmit}
  1133. id="demand-form"
  1134. style={{ paddingBottom: "40px" }}
  1135. >
  1136. <Spin spinning={this.state.loading}>
  1137. <OrderDetail
  1138. processState={this.props.processState}
  1139. orderData={this.state.primaryOrderData}
  1140. getOrderLog={this.getOrderLog}
  1141. dataSourceX={this.state.dataSourceX}
  1142. contactList={this.state.contactList}
  1143. orderNo={this.state.primaryOrderNo}
  1144. totalCui={this.state.totalCui}
  1145. contactListNew={this.state.contactListNew}
  1146. />
  1147. </Spin>
  1148. </Form>
  1149. </TabPane>
  1150. );
  1151. } else {
  1152. return "";
  1153. }
  1154. })}
  1155. {/* {this.state.status === 4 ? (
  1156. <TabPane tab="原订单" key="3">
  1157. <Form
  1158. layout="horizontal"
  1159. onSubmit={this.handleSubmit}
  1160. id="demand-form"
  1161. style={{ paddingBottom: "40px" }}
  1162. >
  1163. <Spin spinning={this.state.loading}>
  1164. <OrderDetail
  1165. processState={this.props.processState}
  1166. orderData={this.state.primaryOrderData}
  1167. getOrderLog={this.getOrderLog}
  1168. dataSourceX={this.state.dataSourceX}
  1169. contactList={this.state.contactList}
  1170. orderNo={this.state.primaryOrderNo}
  1171. totalCui={this.state.totalCui}
  1172. contactListNew={this.state.contactListNew}
  1173. />
  1174. </Spin>
  1175. </Form>
  1176. </TabPane>
  1177. ) : (
  1178. ""
  1179. )} */}
  1180. {this.state.status === 4 && this.state.isAddition ? (
  1181. this.state.type === 4 || this.state.type === 5 ? (
  1182. <TabPane tab="附加订单" key="c">
  1183. <OrderDetail
  1184. processState={this.props.processState}
  1185. orderData={this.state.additionalOrderData}
  1186. getOrderLog={this.getOrderLog}
  1187. dataSourceX={this.state.dataSourceX}
  1188. contactList={this.state.contactList}
  1189. orderNo={this.state.additionalOrder}
  1190. totalCui={this.state.totalCui}
  1191. contactListNew={this.state.contactListNew}
  1192. />
  1193. </TabPane>
  1194. ) : (
  1195. ""
  1196. )
  1197. ) : (
  1198. ""
  1199. )}
  1200. </Tabs>
  1201. </Modal>
  1202. <Modal
  1203. maskClosable={false}
  1204. visible={this.state.addnextVisible}
  1205. onOk={this.nextCancel}
  1206. onCancel={this.nextCancel}
  1207. confirmLoading={this.state.confirmLoading}
  1208. width="800px"
  1209. title={"项目任务详情"}
  1210. footer=""
  1211. className="admin-desc-content"
  1212. >
  1213. <Form layout="horizontal" id="demand-form">
  1214. <Spin spinning={this.state.loading}>
  1215. <div className="clearfix">
  1216. <FormItem
  1217. className="half-item"
  1218. {...formItemLayout}
  1219. label="项目名称"
  1220. >
  1221. <span>{this.state.commodityName}</span>
  1222. </FormItem>
  1223. <FormItem
  1224. className="half-item"
  1225. {...formItemLayout}
  1226. label="项目数量"
  1227. >
  1228. <span>{this.state.commodityQuantity}</span>
  1229. </FormItem>
  1230. <FormItem
  1231. className="half-item"
  1232. {...formItemLayout}
  1233. label="金额(万元)"
  1234. >
  1235. <span>{this.state.commodityPrice}</span>
  1236. </FormItem>
  1237. <FormItem
  1238. className="half-item"
  1239. {...formItemLayout}
  1240. label="主要项目"
  1241. >
  1242. <span>{getboutique(this.state.main)}</span>
  1243. </FormItem>
  1244. <div className="clearfix">
  1245. <FormItem
  1246. labelCol={{ span: 4 }}
  1247. wrapperCol={{ span: 16 }}
  1248. label="服务说明"
  1249. >
  1250. <span>{this.state.taskComment}</span>
  1251. </FormItem>
  1252. </div>
  1253. </div>
  1254. </Spin>
  1255. </Form>
  1256. </Modal>
  1257. <Modal
  1258. maskClosable={false}
  1259. visible={this.state.noVisible}
  1260. onOk={this.handleOk}
  1261. onCancel={this.noCancel}
  1262. width="400px"
  1263. title={"拒绝理由"}
  1264. footer=""
  1265. className="admin-desc-content"
  1266. confirmLoading={this.state.confirmLoading}
  1267. >
  1268. <Form layout="horizontal" id="demand-form">
  1269. <Spin spinning={this.state.loading}>
  1270. <div className="clearfix">
  1271. <FormItem
  1272. labelCol={{ span: 4 }}
  1273. wrapperCol={{ span: 16 }}
  1274. label="拒绝理由"
  1275. >
  1276. <Input
  1277. type="textarea"
  1278. placeholder="请输入拒绝理由"
  1279. rows={4}
  1280. value={this.state.reason}
  1281. onChange={e => {
  1282. this.setState({ reason: e.target.value });
  1283. }}
  1284. />
  1285. </FormItem>
  1286. </div>
  1287. <div className="clearfix">
  1288. <Button
  1289. className="cancel"
  1290. type="primary"
  1291. onClick={this.examOks}
  1292. style={{ marginLeft: "50px" }}
  1293. htmlType="submit"
  1294. loading={this.state.aloading}
  1295. >
  1296. 确定
  1297. </Button>
  1298. <Button
  1299. className="cancel"
  1300. type="ghost"
  1301. onClick={this.noCancel}
  1302. style={{ marginLeft: "50px" }}
  1303. >
  1304. 取消
  1305. </Button>
  1306. </div>
  1307. </Spin>
  1308. </Form>
  1309. </Modal>
  1310. {/* <Modal
  1311. visible={this.state.rizhivisible}
  1312. className="admin-desc-content"
  1313. width="800px"
  1314. maskClosable={false}
  1315. title="订单日志"
  1316. footer={null}
  1317. onCancel={this.closeOrderLog}
  1318. >
  1319. <div className="patent-table">
  1320. <Spin spinning={this.state.loading}>
  1321. <Table
  1322. bordered
  1323. columns={this.state.columnsrizhi}
  1324. dataSource={this.state.dataSourcerizhi}
  1325. pagination={false}
  1326. />
  1327. </Spin>
  1328. </div>
  1329. </Modal> */}
  1330. <OrderRiZi
  1331. dataSourcerizhi={this.state.dataSourcerizhi}
  1332. closeOrderLog={this.closeOrderLog}
  1333. visible={this.state.rizhivisible}
  1334. loading={this.state.loading}
  1335. />
  1336. </div>
  1337. </div>
  1338. );
  1339. }
  1340. })
  1341. );
  1342. export default contractChange;