contractYxgly.js 44 KB

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