contractJsjl.js 42 KB

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