contractCwzj.js 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407
  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/changeDetailCwzj.js";
  17. import { SearchInput } from "./changeComponent/searchInput.js";
  18. import OrderDetail from "./changeComponent/orderDetail";
  19. import { ChooseList } from "./chooseList.jsx";
  20. import ShowModalDiv from "@/showModal.jsx";
  21. import OrderRiZi from "@/orderRiZi.jsx";
  22. import {getProjectName} from "../../../tools";
  23. import ProjectDetailsReadOnly from "../../../common/projectDetailsReadOnly";
  24. import OrderItemStatus from "../../../common/orderItemStatus";
  25. const contractChange = Form.create()(
  26. React.createClass({
  27. loadData(pageNo) {
  28. this.setState({
  29. loading: true
  30. });
  31. $.ajax({
  32. method: "get",
  33. dataType: "json",
  34. crossDomain: false,
  35. url: globalConfig.context + "/api/admin/orderChange/orderChangeList",
  36. data: {
  37. pageNo: pageNo || 1,
  38. pageSize: this.state.pagination.pageSize,
  39. userName: this.state.searchData.userNameSearch,
  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. orderNo: this.state.searchData.orderNoSearch,
  46. contractNo: this.state.searchData.contractNoSearch,
  47. complete: this.state.searchData.completeSearch || 1,
  48. depId: this.state.searchData.depIdSearch,
  49. type: this.state.searchData.changeSearch
  50. },
  51. success: function (data) {
  52. ShowModal(this);
  53. let theArr = [];
  54. if (data.error.length || data.data.list == "") {
  55. if (data.error && data.error.length) {
  56. message.warning(data.error[0].message);
  57. }
  58. } else {
  59. for (let i = 0; i < data.data.list.length; i++) {
  60. let thisdata = data.data.list[i];
  61. theArr.push({
  62. key: i,
  63. orderNo: thisdata.orderNo,
  64. createTimes: thisdata.createTimes,
  65. nickname: thisdata.nickname,
  66. orderType: thisdata.orderType,
  67. establishTimes: thisdata.establishTimes,
  68. orderStatus: thisdata.orderStatus,
  69. totalAmount: thisdata.totalAmount,
  70. settlementAmount: thisdata.settlementAmount,
  71. arrears: thisdata.arrears,
  72. salesmanName: thisdata.salesmanName,
  73. depName: thisdata.depName,
  74. processState: thisdata.processState,
  75. type: thisdata.type,
  76. status: thisdata.status,
  77. id: thisdata.id,
  78. contractNo: thisdata.contractNo,
  79. processStateText: getProcessStatusNew(
  80. thisdata.processState,
  81. thisdata.status
  82. )
  83. });
  84. }
  85. this.state.pagination.total = data.data.totalCount;
  86. this.state.pagination.current = data.data.pageNo;
  87. }
  88. if (data.data && data.data.list && !data.data.list.length) {
  89. this.state.pagination.total = 0;
  90. }
  91. this.setState({
  92. dataSource: theArr,
  93. pageNo: pageNo,
  94. pagination: this.state.pagination
  95. });
  96. }.bind(this)
  97. }).always(
  98. function () {
  99. this.setState({
  100. loading: false
  101. });
  102. }.bind(this)
  103. );
  104. },
  105. getInitialState() {
  106. return {
  107. page: 1,
  108. searchData: {
  109. releaseDate: []
  110. },
  111. declarationBatch: 1,
  112. dataInfor: {},
  113. primaryOrderData: {}, //原订单数据
  114. orderData: {}, //现订单数据
  115. pictureUrl: [],
  116. voucherUrl: [],
  117. attachmentUrl: [],
  118. //收款数据
  119. proceedsData: {},
  120. proTotal: 0,
  121. invTotal: 0,
  122. contractData: {},
  123. // 回收退票数据
  124. refundInvoice: [],
  125. RefundInvoice: [],
  126. additionalOrderData: {},
  127. paginations: false,
  128. activeKey: "a",
  129. confirmLoading: false,
  130. aloading: false,
  131. pagination: {
  132. defaultCurrent: 1,
  133. defaultPageSize: 10,
  134. showQuickJumper: true,
  135. pageSize: 10,
  136. onChange: function (page) {
  137. this.loadData(page);
  138. }.bind(this),
  139. showTotal: function (total) {
  140. return "共" + total + "条数据";
  141. }
  142. },
  143. columns: [
  144. {
  145. title: "合同编号",
  146. dataIndex: "contractNo",
  147. key: "contractNo"
  148. },
  149. {
  150. title: "订单编号",
  151. dataIndex: "orderNo",
  152. key: "orderNo"
  153. },
  154. {
  155. title: "客户名称",
  156. dataIndex: "nickname",
  157. key: "nickname"
  158. },
  159. {
  160. title: "订单部门",
  161. dataIndex: "depName",
  162. key: "depName"
  163. },
  164. {
  165. title: "订单类型",
  166. dataIndex: "orderType",
  167. key: "orderType",
  168. render: text => {
  169. return text ? "科技项目" : "认证项目";
  170. }
  171. },
  172. {
  173. title: "下单时间",
  174. dataIndex: "establishTimes",
  175. key: "establishTimes"
  176. },
  177. {
  178. title: "订单状态",
  179. dataIndex: "orderStatus",
  180. key: "orderStatus",
  181. render: text => {
  182. return getNewOrderStatus(text);
  183. }
  184. },
  185. {
  186. title: "合同额(万元)",
  187. dataIndex: "totalAmount",
  188. key: "totalAmount"
  189. },
  190. {
  191. title: "已付额(万元)",
  192. dataIndex: "settlementAmount",
  193. key: "settlementAmount"
  194. },
  195. {
  196. title: "欠款(万元)",
  197. dataIndex: "arrears",
  198. key: "arrears"
  199. },
  200. {
  201. title: "订单负责人",
  202. dataIndex: "salesmanName",
  203. key: "salesmanName"
  204. },
  205. {
  206. title: "变更类型",
  207. dataIndex: "type",
  208. key: "type",
  209. render: text => {
  210. return getType(text);
  211. }
  212. },
  213. {
  214. title: "审核状态",
  215. dataIndex: "processStateText",
  216. key: "processStateText"
  217. },
  218. {
  219. title: "提交时间",
  220. dataIndex: "createTimes",
  221. key: "createTimes"
  222. }
  223. ],
  224. dataSource: [],
  225. // 传递给子组件的
  226. dataProps: [],
  227. columnsX: [
  228. {
  229. title: "业务项目名称",
  230. dataIndex: "commodityName",
  231. key: "commodityName"
  232. },
  233. {
  234. title: "项目类别",
  235. dataIndex: "cname",
  236. key: "cname"
  237. },
  238. {
  239. title: "项目数量",
  240. dataIndex: "commodityQuantity",
  241. key: "commodityQuantity"
  242. },
  243. {
  244. title: "金额(万元)",
  245. dataIndex: "commodityPrice",
  246. key: "commodityPrice"
  247. },
  248. {
  249. title: "负责人",
  250. dataIndex: "contacts",
  251. key: "contacts"
  252. },
  253. {
  254. title: "负责人电话",
  255. dataIndex: "contactsMobile",
  256. key: "contactsMobile"
  257. },
  258. {
  259. title: "项目状态",
  260. dataIndex: "projectStatus",
  261. key: "projectStatus",
  262. render: text => {
  263. return getProjectName(text);
  264. }
  265. },
  266. {
  267. title: "主要项目",
  268. dataIndex: "main",
  269. key: "main",
  270. render: text => {
  271. return text ? "是" : "否";
  272. }
  273. },
  274. {
  275. title: "项目说明",
  276. dataIndex: "taskComment",
  277. key: "taskComment",
  278. render: text => {
  279. return text && text.length > 8 ? text.substr(0, 8) + "…" : text;
  280. }
  281. }
  282. ],
  283. // 子组件改变的表格title数组
  284. changeList: undefined,
  285. columnsrizhi: [
  286. {
  287. title: "流程",
  288. dataIndex: "processName",
  289. key: "processName"
  290. },
  291. {
  292. title: "操作人",
  293. dataIndex: "adminName",
  294. key: "adminName"
  295. },
  296. {
  297. title: "时间",
  298. dataIndex: "createDate",
  299. key: "createDate"
  300. }
  301. ],
  302. dataSourceX: [],
  303. ContactsLists: [
  304. {
  305. title: "催款科目",
  306. dataIndex: "dunSubject",
  307. key: "dunSubject",
  308. render: text => {
  309. return getjiedian(text);
  310. }
  311. },
  312. {
  313. title: "金额(万元)",
  314. dataIndex: "money",
  315. key: "money"
  316. },
  317. {
  318. title: "催款状态",
  319. dataIndex: "dunStatus",
  320. key: "dunStatus",
  321. render: text => {
  322. return getCuikuan(text);
  323. }
  324. }
  325. ]
  326. };
  327. },
  328. //页面加载函数
  329. componentWillMount() {
  330. this.loadData();
  331. },
  332. //整行点击
  333. tableRowClick(record) {
  334. this.setState(
  335. {
  336. visible: true,
  337. type: record.type,
  338. status: record.status,
  339. buttonStatus: true,
  340. orderStatus: record.orderStatus,
  341. processStateText: record.processStateText,
  342. id: record.id,
  343. orderNo: record.orderNo
  344. },
  345. () => {
  346. this.xiangqing(record.orderNo);
  347. this.xiangmu(record.orderNo);
  348. this.jiedian(record.orderNo);
  349. this.jiedianNew(record.orderNo);
  350. this.createTabs();
  351. }
  352. );
  353. },
  354. //点击打卡项目详情
  355. tableRowClickX(record) {
  356. this.setState({
  357. jid: record.id, //项目ID
  358. kid: record.commodityId, //商品ID
  359. commodityName: record.commodityName, //金额
  360. commodityPrice: record.commodityPrice, //金额
  361. commodityQuantity: record.commodityQuantity, //数量
  362. taskComment: record.taskComment, //备注
  363. main: record.main.toString(), //是否为主要
  364. addnextVisible: true,
  365. dataInfor:record,
  366. addState: 0
  367. });
  368. },
  369. //项目详情关闭
  370. nextCancel() {
  371. this.setState({
  372. addnextVisible: false
  373. });
  374. },
  375. // 合同变更详情
  376. ChangeDetail(id) {
  377. let url = window.location.href.substring(7);
  378. $.ajax({
  379. method: "get",
  380. dataType: "json",
  381. crossDomain: false,
  382. url:
  383. globalConfig.context +
  384. "/api/admin/orderChange/orderChangeDetailsById",
  385. data: {
  386. id: id
  387. },
  388. success: function (data) {
  389. if (data.data) {
  390. let thisdata = data.data;
  391. Object.assign(thisdata, {
  392. processStateText: this.state.processStateText,
  393. userName: this.state.userName,
  394. contractNo: this.state.contractNo
  395. });
  396. this.setState({
  397. contractData: thisdata,
  398. voucherUrl: thisdata.voucherUrl
  399. ? splitUrl(
  400. thisdata.voucherUrl,
  401. ",",
  402. globalConfig.avatarHost + "/upload",
  403. url
  404. )
  405. : []
  406. });
  407. }
  408. }.bind(this)
  409. });
  410. $.ajax({
  411. method: "get",
  412. dataType: "json",
  413. crossDomain: false,
  414. url:
  415. globalConfig.context +
  416. "/api/admin/orderChange/listOrderInvoiceAndBill",
  417. data: {
  418. orderNo: this.state.orderNo
  419. },
  420. success: function (data) {
  421. if (!data.data) return;
  422. let proTotal = 0;
  423. let invTotal = 0;
  424. data.data.bill.forEach(item => {
  425. proTotal += item.transactionAmount;
  426. });
  427. data.data.invoice.forEach(item => {
  428. invTotal += item.amount;
  429. });
  430. this.setState({
  431. proceedsData: data.data,
  432. proTotal: (Math.round(proTotal * 1000000) / 1000000).toFixed(6),
  433. invTotal: (Math.round(invTotal * 1000000) / 1000000).toFixed(6),
  434. });
  435. }.bind(this)
  436. });
  437. $.ajax({
  438. method: "get",
  439. dataType: "json",
  440. crossDomain: false,
  441. url:
  442. globalConfig.context +
  443. "/api/admin/orderChange/listOrderRefundInvoice",
  444. data: {
  445. orderNo: this.state.orderNo
  446. },
  447. success: data => {
  448. if (!data) return;
  449. data.data.forEach(item => {
  450. item.load = true;
  451. });
  452. this.setState({
  453. refundInvoice: data.data
  454. });
  455. }
  456. });
  457. },
  458. //订单详情
  459. xiangqing(orderNos) {
  460. this.setState({
  461. orderData: {}
  462. },()=>{
  463. $.ajax({
  464. method: "get",
  465. dataType: "json",
  466. crossDomain: false,
  467. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  468. data: {
  469. orderNo: orderNos
  470. },
  471. success: function (data) {
  472. if (data.error.length || data.data.list == "") {
  473. if (data.error && data.error.length) {
  474. message.warning(data.error[0].message);
  475. }
  476. } else {
  477. let thisdata = data.data;
  478. this.setState({
  479. userName: thisdata.userName,
  480. primaryOrderNo: thisdata.primaryOrder,
  481. additionalOrder: thisdata.additionalOrder,
  482. contractNo: thisdata.contractNo,
  483. // arrears: thisdata.arrears,
  484. orderData: thisdata,
  485. isAddition: thisdata.additionalOrder ? true : false,
  486. deleteSign:thisdata.deleteSign,
  487. });
  488. }
  489. }.bind(this)
  490. });
  491. });
  492. },
  493. // 原订单数据
  494. primaryOrder(primaryOrder) {
  495. $.ajax({
  496. method: "get",
  497. dataType: "json",
  498. crossDomain: false,
  499. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  500. data: {
  501. orderNo: primaryOrder
  502. },
  503. success: function (data) {
  504. if (data.error.length || data.data.list == "") {
  505. if (data.error && data.error.length) {
  506. message.warning(data.error[0].message);
  507. }
  508. } else {
  509. let thisdata = data.data;
  510. this.setState({
  511. primaryOrderData: thisdata
  512. });
  513. }
  514. }.bind(this)
  515. });
  516. },
  517. // 附加订单数据
  518. additionalOrder(additionalOrder) {
  519. $.ajax({
  520. method: "get",
  521. dataType: "json",
  522. crossDomain: false,
  523. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  524. data: {
  525. orderNo: additionalOrder
  526. },
  527. success: function (data) {
  528. if (data.error.length || data.data.list == "") {
  529. if (data.error && data.error.length) {
  530. message.warning(data.error[0].message);
  531. }
  532. } else {
  533. let thisdata = data.data;
  534. this.setState({
  535. additionalOrderData: thisdata
  536. });
  537. }
  538. }.bind(this)
  539. });
  540. },
  541. //项目列表
  542. xiangmu(orderNos) {
  543. $.ajax({
  544. method: "get",
  545. dataType: "json",
  546. crossDomain: false,
  547. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  548. data: {
  549. orderNo: orderNos
  550. },
  551. success: function (data) {
  552. let theArr = [];
  553. if (data.error.length || data.data.list == "") {
  554. if (data.error && data.error.length) {
  555. message.warning(data.error[0].message);
  556. }
  557. } else {
  558. for (let i = 0; i < data.data.length; i++) {
  559. let thisdata = data.data[i];
  560. thisdata.key = i;
  561. thisdata.sort = thisdata.cSort;
  562. theArr.push(thisdata);
  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. // window.location.reload()
  822. }
  823. }.bind(this)
  824. }).always(
  825. function () {
  826. this.setState({
  827. loading: false
  828. });
  829. }.bind(this)
  830. );
  831. },
  832. //点击拒绝
  833. examNo() {
  834. this.setState({
  835. noVisible: true
  836. });
  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.id);
  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.loadData(1);
  1026. // window.location.reload();
  1027. },
  1028. outReset() {
  1029. this.setState({
  1030. companyName: "",
  1031. amount: "",
  1032. unitPrice: "",
  1033. unitNumber: "",
  1034. outsourceRemarks: "",
  1035. attachmentUrl: [],
  1036. pictureUrl: []
  1037. });
  1038. },
  1039. getOrgCodeUrl(e) {
  1040. this.setState({ pictureUrl: e });
  1041. },
  1042. //关闭详情
  1043. visitCancel() {
  1044. this.setState(
  1045. {
  1046. activeKey: "a",
  1047. visible: false
  1048. });
  1049. this.loadData(this.state.pageNo);
  1050. },
  1051. visitOk() {
  1052. this.setState({
  1053. visible: false
  1054. });
  1055. },
  1056. changeList(arr) {
  1057. const newArr = [];
  1058. this.state.columns.forEach(item => {
  1059. arr.forEach(val => {
  1060. if (val === item.title) {
  1061. newArr.push(item);
  1062. }
  1063. });
  1064. });
  1065. this.setState({
  1066. changeList: newArr
  1067. });
  1068. },
  1069. createTabs() {
  1070. $.ajax({
  1071. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  1072. method: "get",
  1073. data: {
  1074. orderNo: this.state.orderNo
  1075. },
  1076. success: data => {
  1077. if (data.error && data.error.length) {
  1078. message.warning(data.error[0].message);
  1079. } else {
  1080. this.setState({
  1081. tabList: data.data
  1082. });
  1083. }
  1084. }
  1085. });
  1086. },
  1087. render() {
  1088. const tabList = this.state.tabList || [];
  1089. const formItemLayout = {
  1090. labelCol: { span: 8 },
  1091. wrapperCol: { span: 14 }
  1092. };
  1093. const FormItem = Form.Item;
  1094. const { TabPane } = Tabs;
  1095. return (
  1096. <div className="user-content">
  1097. <ShowModalDiv ShowModal={this.state.showModal} />
  1098. <div className="content-title">
  1099. <span>合同变更审核订单</span>
  1100. </div>
  1101. <div className="user-search">
  1102. <Tabs
  1103. defaultActiveKey="1"
  1104. onChange={this.callback}
  1105. className="test">
  1106. <TabPane tab="搜索" key="1">
  1107. <div style={{ marginLeft: 10 }}>
  1108. <SearchInput search={this.search} />
  1109. </div>
  1110. </TabPane>
  1111. <TabPane tab="更改表格数据" key="2">
  1112. <div style={{ marginTop: 10, marginLeft: 10 }}>
  1113. <ChooseList
  1114. columns={this.state.columns}
  1115. changeFn={this.changeList}
  1116. changeList={this.state.changeList}
  1117. top={65}
  1118. />
  1119. </div>
  1120. </TabPane>
  1121. </Tabs>
  1122. <div className="patent-table">
  1123. <Spin spinning={this.state.loading}>
  1124. <Table
  1125. size="small"
  1126. bordered
  1127. columns={
  1128. this.state.changeList == undefined
  1129. ? this.state.columns
  1130. : this.state.changeList
  1131. }
  1132. dataSource={this.state.dataSource}
  1133. pagination={this.state.pagination}
  1134. onRowClick={this.tableRowClick}
  1135. />
  1136. </Spin>
  1137. </div>
  1138. <Modal
  1139. className="customeDetails"
  1140. footer=""
  1141. maskClosable={false}
  1142. width="900px"
  1143. visible={this.state.visible}
  1144. onOk={this.visitOk}
  1145. onCancel={this.visitCancel}
  1146. >
  1147. {this.state.visible ? <Tabs
  1148. activeKey={this.state.activeKey}
  1149. onChange={this.callback}
  1150. type="card"
  1151. tabBarExtraContent={
  1152. <div style={{fontWeight:'bold',paddingRight:'15px'}}>
  1153. <OrderItemStatus deleteSign={this.state.deleteSign}/>
  1154. </div>
  1155. }
  1156. >
  1157. <TabPane tab="订单详情" key="a">
  1158. <div style={{ paddingBottom: "40px" }}>
  1159. <Spin spinning={this.state.loading}>
  1160. {this.state.activeKey === 'a' && this.state.visible? <OrderDetail
  1161. orderData={this.state.orderData}
  1162. getOrderLog={this.getOrderLog}
  1163. dataSourceX={this.state.dataSourceX}
  1164. contactList={this.state.contactList}
  1165. orderNo={this.state.orderNo}
  1166. totalCui={this.state.totalCui}
  1167. contactListNew={this.state.contactListNew}
  1168. // isCaiWu={true}
  1169. />: <div/>}
  1170. </Spin>
  1171. </div>
  1172. </TabPane>
  1173. {/* <TabPane tab="合同变更记录" key="2">
  1174. <ChangeDetail
  1175. data={this.state.contractData}
  1176. txt={this.state.processStateText}
  1177. pictureUrl={this.state.voucherUrl}
  1178. processState={this.props.processState}
  1179. loadData={this.callback}
  1180. reset={this.state.visible}
  1181. dataSource={this.state.dataProps}
  1182. proceedsData={this.state.proceedsData}
  1183. proceedsTotal={this.state.proTotal}
  1184. invoiceTotal={this.state.invTotal}
  1185. contactList={this.state.refundInvoice}
  1186. onCancel={this.visitCancel}
  1187. />
  1188. </TabPane> */}
  1189. {tabList.map((item, index, arr) => {
  1190. return (
  1191. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1192. {this.state.activeKey === String(item.id) ? <ChangeDetail
  1193. id={item.id}
  1194. money={
  1195. index == arr.length - 1
  1196. ? this.state.orderData.totalAmount + ""
  1197. : undefined
  1198. }
  1199. data={this.state.contractData}
  1200. orderData={this.state.orderData}
  1201. txt={this.state.processStateText}
  1202. pictureUrl={this.state.voucherUrl}
  1203. processState={this.props.processState}
  1204. loadData={this.callback}
  1205. reset={this.state.visible}
  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. </TabPane>
  1214. );
  1215. })}
  1216. {/* {this.state.status === 4 ? (
  1217. <TabPane tab="原订单" key="3">
  1218. <Form
  1219. layout="horizontal"
  1220. onSubmit={this.handleSubmit}
  1221. id="demand-form"
  1222. style={{ paddingBottom: "40px" }}
  1223. >
  1224. <Spin spinning={this.state.loading}>
  1225. <OrderDetail
  1226. orderData={this.state.primaryOrderData}
  1227. getOrderLog={this.getOrderLog}
  1228. dataSourceX={this.state.dataSourceX}
  1229. contactList={this.state.contactList}
  1230. orderNo={this.state.primaryOrderNo}
  1231. isCaiWu={true}
  1232. totalCui={this.state.totalCui}
  1233. contactListNew={this.state.contactListNew}
  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. {this.state.activeKey === String(item.usedOrder)? <Form
  1249. layout="horizontal"
  1250. onSubmit={this.handleSubmit}
  1251. id="demand-form"
  1252. style={{ paddingBottom: "40px" }}
  1253. >
  1254. <Spin spinning={this.state.loading}>
  1255. {this.state.visible ? <OrderDetail
  1256. orderData={this.state.primaryOrderData}
  1257. getOrderLog={this.getOrderLog}
  1258. dataSourceX={this.state.dataSourceX}
  1259. contactList={this.state.contactList}
  1260. orderNo={this.state.primaryOrderNo}
  1261. isCaiWu={true}
  1262. totalCui={this.state.totalCui}
  1263. contactListNew={this.state.contactListNew}
  1264. /> : <div/>}
  1265. </Spin>
  1266. </Form> : <div/>}
  1267. </TabPane>
  1268. );
  1269. } else {
  1270. return "";
  1271. }
  1272. })}
  1273. {this.state.status === 4 && this.state.isAddition ? (
  1274. this.state.type === 4 || this.state.type === 5 ? (
  1275. <TabPane tab="附加订单" key="c">
  1276. {this.state.activeKey === "c" && this.state.visible ? <OrderDetail
  1277. orderData={this.state.additionalOrderData}
  1278. getOrderLog={this.getOrderLog}
  1279. dataSourceX={this.state.dataSourceX}
  1280. contactList={this.state.contactList}
  1281. orderNo={this.state.additionalOrder}
  1282. isCaiWu={true}
  1283. totalCui={this.state.totalCui}
  1284. contactListNew={this.state.contactListNew}
  1285. /> : <div/>}
  1286. </TabPane>
  1287. ) : (
  1288. ""
  1289. )
  1290. ) : (
  1291. ""
  1292. )}
  1293. </Tabs> : <div/>}
  1294. </Modal>
  1295. <Modal
  1296. maskClosable={false}
  1297. visible={this.state.noVisible}
  1298. onOk={this.handleOk}
  1299. onCancel={this.noCancel}
  1300. width="400px"
  1301. title={"拒绝理由"}
  1302. footer=""
  1303. className="admin-desc-content"
  1304. confirmLoading={this.state.confirmLoading}
  1305. >
  1306. <Form layout="horizontal" id="demand-form">
  1307. <Spin spinning={this.state.loading}>
  1308. <div className="clearfix">
  1309. <FormItem
  1310. labelCol={{ span: 4 }}
  1311. wrapperCol={{ span: 16 }}
  1312. label="拒绝理由"
  1313. >
  1314. <Input
  1315. type="textarea"
  1316. placeholder="请输入拒绝理由"
  1317. rows={4}
  1318. value={this.state.reason}
  1319. onChange={e => {
  1320. this.setState({ reason: e.target.value });
  1321. }}
  1322. />
  1323. </FormItem>
  1324. </div>
  1325. <div className="clearfix">
  1326. <Button
  1327. className="cancel"
  1328. type="primary"
  1329. onClick={this.examOks}
  1330. style={{ marginLeft: "50px" }}
  1331. htmlType="submit"
  1332. loading={this.state.aloading}
  1333. >
  1334. 确定
  1335. </Button>
  1336. <Button
  1337. className="cancel"
  1338. type="ghost"
  1339. onClick={this.noCancel}
  1340. style={{ marginLeft: "50px" }}
  1341. >
  1342. 取消
  1343. </Button>
  1344. </div>
  1345. </Spin>
  1346. </Form>
  1347. </Modal>
  1348. {/* <Modal
  1349. visible={this.state.rizhivisible}
  1350. className="admin-desc-content"
  1351. width="800px"
  1352. maskClosable={false}
  1353. title="订单日志"
  1354. footer={null}
  1355. onCancel={this.closeOrderLog}
  1356. >
  1357. <div className="patent-table">
  1358. <Spin spinning={this.state.loading}>
  1359. <Table
  1360. bordered
  1361. columns={this.state.columnsrizhi}
  1362. dataSource={this.state.dataSourcerizhi}
  1363. pagination={false}
  1364. />
  1365. </Spin>
  1366. </div>
  1367. </Modal> */}
  1368. <OrderRiZi
  1369. dataSourcerizhi={this.state.dataSourcerizhi}
  1370. closeOrderLog={this.closeOrderLog}
  1371. visible={this.state.rizhivisible}
  1372. loading={this.state.loading}
  1373. />
  1374. </div>
  1375. {this.state.addnextVisible && <ProjectDetailsReadOnly
  1376. infor={this.state.dataInfor}
  1377. visible={this.state.addnextVisible}
  1378. onCancel={this.nextCancel}
  1379. />}
  1380. </div>
  1381. );
  1382. }
  1383. })
  1384. );
  1385. export default contractChange;