contractJszj.js 44 KB

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