contractJszj.js 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413
  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/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. 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. complete: this.state.searchData.completeSearch || 1,
  46. depId: this.state.searchData.depIdSearch,
  47. orderNo: this.state.searchData.orderNoSearch,
  48. contractNo: this.state.searchData.contractNoSearch,
  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:100,
  158. render: text => {
  159. return (
  160. <Tooltip title={text}>
  161. <div style={{
  162. maxWidth:'100px',
  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. },
  364. //点击打卡项目详情
  365. tableRowClickX(record) {
  366. this.setState({
  367. jid: record.id, //项目ID
  368. kid: record.commodityId, //商品ID
  369. commodityName: record.commodityName, //金额
  370. commodityPrice: record.commodityPrice, //金额
  371. commodityQuantity: record.commodityQuantity, //数量
  372. taskComment: record.taskComment, //备注
  373. main: record.main.toString(), //是否为主要
  374. addnextVisible: true,
  375. dataInfor:record,
  376. addState: 0
  377. });
  378. },
  379. //项目详情关闭
  380. nextCancel() {
  381. this.setState({
  382. addnextVisible: false
  383. });
  384. },
  385. // 合同变更详情
  386. ChangeDetail(id) {
  387. let url = window.location.href.substring(7);
  388. $.ajax({
  389. method: "get",
  390. dataType: "json",
  391. crossDomain: false,
  392. url:
  393. globalConfig.context +
  394. "/api/admin/orderChange/orderChangeDetailsById",
  395. data: {
  396. id: id
  397. },
  398. success: function (data) {
  399. if (data.data) {
  400. let thisdata = data.data;
  401. Object.assign(thisdata, {
  402. processStateText: this.state.processStateText,
  403. userName: this.state.userName,
  404. contractNo: this.state.contractNo
  405. });
  406. this.setState({
  407. contractData: thisdata,
  408. voucherUrl: thisdata.voucherUrl
  409. ? splitUrl(
  410. thisdata.voucherUrl,
  411. ",",
  412. globalConfig.avatarHost + "/upload",
  413. url
  414. )
  415. : []
  416. });
  417. }
  418. }.bind(this)
  419. });
  420. $.ajax({
  421. method: "get",
  422. dataType: "json",
  423. crossDomain: false,
  424. url:
  425. globalConfig.context +
  426. "/api/admin/orderChange/listOrderInvoiceAndBill",
  427. data: {
  428. orderNo: this.state.orderNo
  429. },
  430. success: function (data) {
  431. if (!data.data) return;
  432. let proTotal = 0;
  433. let invTotal = 0;
  434. data.data.bill.forEach(item => {
  435. proTotal += item.transactionAmount;
  436. });
  437. data.data.invoice.forEach(item => {
  438. invTotal += item.amount;
  439. });
  440. this.setState({
  441. proceedsData: data.data,
  442. proTotal: (Math.round(proTotal * 1000000) / 1000000).toFixed(6),
  443. invTotal: (Math.round(invTotal * 1000000) / 1000000).toFixed(6),
  444. });
  445. }.bind(this)
  446. });
  447. $.ajax({
  448. method: "get",
  449. dataType: "json",
  450. crossDomain: false,
  451. url:
  452. globalConfig.context +
  453. "/api/admin/orderChange/listOrderRefundInvoice",
  454. data: {
  455. orderNo: this.state.orderNo
  456. },
  457. success: data => {
  458. if (!data) return;
  459. data.data.forEach(item => {
  460. item.load = true;
  461. });
  462. this.setState({
  463. refundInvoice: data.data
  464. });
  465. }
  466. });
  467. },
  468. //订单详情
  469. xiangqing(orderNos) {
  470. $.ajax({
  471. method: "get",
  472. dataType: "json",
  473. crossDomain: false,
  474. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  475. data: {
  476. orderNo: orderNos
  477. },
  478. success: function (data) {
  479. if (data.error.length || data.data.list == "") {
  480. if (data.error && data.error.length) {
  481. message.warning(data.error[0].message);
  482. }
  483. } else {
  484. let thisdata = data.data;
  485. this.setState({
  486. orderUid: thisdata.uid,
  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. if (key === "a") {
  887. this.xiangmu(this.state.orderNo);
  888. this.jiedian(this.state.orderNo);
  889. this.jiedianNew(this.state.orderNo);
  890. }
  891. // if (key === "2") {
  892. // this.ChangeDetail(this.state.id);
  893. // this.loadDataChange();
  894. // }
  895. // if (key === "3") {
  896. // this.primaryOrder(this.state.primaryOrderNo);
  897. // this.xiangmu(this.state.primaryOrderNo);
  898. // this.jiedian(this.state.primaryOrderNo);
  899. // this.jiedianNew(this.state.primaryOrderNo);
  900. // }
  901. if (key === "c") {
  902. this.additionalOrder(this.state.additionalOrder);
  903. this.xiangmu(this.state.additionalOrder);
  904. this.jiedian(this.state.additionalOrder);
  905. this.jiedianNew(this.state.additionalOrder);
  906. this.setState({
  907. buttonStatusA: false
  908. });
  909. } else {
  910. this.setState({
  911. buttonStatusA: true
  912. });
  913. }
  914. },
  915. closeDesc(e, s) {
  916. this.state.activeKey = "a";
  917. this.state.userDetaile = false;
  918. this.state.signBillVisible = false;
  919. this.state.visible = e;
  920. if (s) {
  921. this.loadData(this.state.pageNo);
  922. }
  923. },
  924. // 获取原订单编号
  925. getPrimaryOrder(value) {
  926. this.setState({
  927. primaryOrder: value
  928. });
  929. },
  930. getAdditionalOrder(value) {
  931. this.setState({
  932. additionalOrder: value
  933. });
  934. },
  935. getUrl(url) {
  936. let theorgCodeUrl = [];
  937. if (url.length) {
  938. let picArr = [];
  939. url.map(function (item) {
  940. if (
  941. item.response &&
  942. item.response.data &&
  943. item.response.data.length
  944. ) {
  945. picArr.push(item.response.data);
  946. }
  947. });
  948. theorgCodeUrl = picArr.join(",");
  949. }
  950. return theorgCodeUrl;
  951. },
  952. sureOut() {
  953. if (!this.state.companyName) {
  954. message.warning("公司名称不能为空");
  955. return;
  956. }
  957. if (!this.state.unitPrice) {
  958. message.warning("单价不能为空");
  959. return;
  960. }
  961. if (!this.state.unitNumber) {
  962. message.warning("数量不能为空");
  963. return;
  964. }
  965. if (!this.state.amount) {
  966. message.warning("总金额不能为空");
  967. return;
  968. }
  969. if (!this.state.outsourceRemarks) {
  970. message.warning("备注不能为空");
  971. return;
  972. }
  973. if (this.state.pictureUrl.length === 0) {
  974. message.warning("合同扫描件不能为空");
  975. return;
  976. }
  977. $.ajax({
  978. method: "POST",
  979. dataType: "json",
  980. crossDomain: false,
  981. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  982. data: {
  983. id: this.state.id,
  984. orderNo: this.state.orderNo,
  985. companyName: this.state.companyName,
  986. amount: this.state.amount,
  987. outsourceRemarks: this.state.outsourceRemarks,
  988. unitNumber: this.state.unitNumber,
  989. unitPrice: this.state.unitPrice,
  990. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  991. ? this.getUrl(this.state.attachmentUrl)
  992. : "",
  993. orderStatus: 2,
  994. pictureUrl: this.getUrl(this.state.pictureUrl).length
  995. ? this.getUrl(this.state.pictureUrl)
  996. : ""
  997. }
  998. }).done(
  999. function (data) {
  1000. this.setState({
  1001. loading: false
  1002. });
  1003. if (!data.error.length) {
  1004. message.success("发起成功!");
  1005. this.outReset();
  1006. this.visitCancel();
  1007. } else {
  1008. message.warning(data.error[0].message);
  1009. }
  1010. }.bind(this)
  1011. );
  1012. },
  1013. //关闭输入理由框
  1014. noCancel() {
  1015. this.setState({
  1016. noVisible: false,
  1017. aloading: false,
  1018. reason: ""
  1019. });
  1020. },
  1021. //重置
  1022. reset() {
  1023. this.setState({
  1024. signBillVisible: false
  1025. });
  1026. this.state.orderNo = "";
  1027. this.state.customerName = "";
  1028. this.state.releaseDate[0] = undefined;
  1029. this.state.releaseDate[1] = undefined;
  1030. this.state.approval = undefined;
  1031. this.loadData(1);
  1032. },
  1033. outReset() {
  1034. this.setState({
  1035. companyName: "",
  1036. amount: "",
  1037. unitPrice: "",
  1038. unitNumber: "",
  1039. outsourceRemarks: "",
  1040. attachmentUrl: [],
  1041. pictureUrl: []
  1042. });
  1043. },
  1044. getOrgCodeUrl(e) {
  1045. this.setState({ pictureUrl: e });
  1046. },
  1047. //关闭详情
  1048. visitCancel() {
  1049. this.setState(
  1050. {
  1051. activeKey: "a"
  1052. },
  1053. () => {
  1054. this.setState({
  1055. visible: false
  1056. });
  1057. }
  1058. );
  1059. this.loadData(this.state.pageNo);
  1060. },
  1061. visitOk() {
  1062. this.setState({
  1063. visible: false
  1064. });
  1065. },
  1066. createTabs() {
  1067. $.ajax({
  1068. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  1069. method: "get",
  1070. data: {
  1071. orderNo: this.state.orderNo
  1072. },
  1073. success: data => {
  1074. if (data.error && data.error.length) {
  1075. message.warning(data.error[0].message);
  1076. } else {
  1077. this.setState({
  1078. tabList: data.data
  1079. });
  1080. }
  1081. }
  1082. });
  1083. },
  1084. changeList(arr) {
  1085. const newArr = [];
  1086. this.state.columns.forEach(item => {
  1087. arr.forEach(val => {
  1088. if (val === item.title) {
  1089. newArr.push(item);
  1090. }
  1091. });
  1092. });
  1093. this.setState({
  1094. changeList: newArr
  1095. });
  1096. },
  1097. render() {
  1098. const tabList = this.state.tabList || [];
  1099. const formItemLayout = {
  1100. labelCol: { span: 8 },
  1101. wrapperCol: { span: 14 }
  1102. };
  1103. const FormItem = Form.Item;
  1104. const { TabPane } = Tabs;
  1105. return (
  1106. <div className="user-content">
  1107. <ShowModalDiv ShowModal={this.state.showModal} />
  1108. <div className="content-title">
  1109. <span>合同变更审核订单</span>
  1110. </div>
  1111. <div className="user-search">
  1112. <Tabs
  1113. defaultActiveKey="1"
  1114. onChange={this.callback}
  1115. className="test">
  1116. <TabPane tab="搜索" key="1">
  1117. <div style={{ marginLeft: 10 }}>
  1118. <SearchInput search={this.search} />
  1119. </div>
  1120. </TabPane>
  1121. <TabPane tab="更改表格显示数据" key="2">
  1122. <div style={{ marginLeft: 10 }}>
  1123. <ChooseList
  1124. columns={this.state.columns}
  1125. changeFn={this.changeList}
  1126. changeList={this.state.changeList}
  1127. top={55}
  1128. margin={11}
  1129. />
  1130. </div>
  1131. </TabPane>
  1132. </Tabs>
  1133. <div className="patent-table">
  1134. <Spin spinning={this.state.loading}>
  1135. <Table
  1136. size="small"
  1137. bordered
  1138. columns={
  1139. this.state.changeList
  1140. ? this.state.changeList
  1141. : this.state.columns
  1142. }
  1143. dataSource={this.state.dataSource}
  1144. pagination={this.state.pagination}
  1145. onRowClick={this.tableRowClick}
  1146. />
  1147. </Spin>
  1148. </div>
  1149. {this.state.visible ? <Modal
  1150. className="customeDetails"
  1151. footer=""
  1152. maskClosable={false}
  1153. width="900px"
  1154. visible={this.state.visible}
  1155. onOk={this.visitOk}
  1156. onCancel={this.visitCancel}
  1157. >
  1158. <Tabs
  1159. activeKey={this.state.activeKey}
  1160. onChange={this.callback}
  1161. type="card"
  1162. tabBarExtraContent={
  1163. <div style={{fontWeight:'bold',paddingRight:'15px'}}>
  1164. <OrderItemStatus deleteSign={this.state.deleteSign}/>
  1165. </div>
  1166. }
  1167. >
  1168. <TabPane tab="订单详情" key="a">
  1169. {this.state.activeKey === "a" ? <Form
  1170. layout="horizontal"
  1171. onSubmit={this.handleSubmit}
  1172. id="demand-form"
  1173. style={{ paddingBottom: "40px" }}
  1174. >
  1175. <Spin spinning={this.state.loading}>
  1176. <OrderDetail
  1177. orderUid={this.state.orderUid}
  1178. orderData={this.state.orderData}
  1179. getOrderLog={this.getOrderLog}
  1180. dataSourceX={this.state.dataSourceX}
  1181. contactList={this.state.contactList}
  1182. totalCui={this.state.totalCui}
  1183. contactListNew={this.state.contactListNew}
  1184. orderNo={this.state.orderNo}
  1185. />
  1186. </Spin>
  1187. </Form> : <div/>}
  1188. </TabPane>
  1189. {/* <TabPane tab="合同变更记录" key="2">
  1190. <ChangeDetail
  1191. data={this.state.contractData}
  1192. pictureUrl={this.state.voucherUrl}
  1193. processState={this.props.processState}
  1194. loadData={this.callback}
  1195. reset={this.state.visible}
  1196. dataSource={this.state.dataProps}
  1197. proceedsData={this.state.proceedsData}
  1198. proceedsTotal={this.state.proTotal}
  1199. invoiceTotal={this.state.invTotal}
  1200. contactList={this.state.refundInvoice}
  1201. onCancel={this.visitCancel}
  1202. />
  1203. </TabPane> */}
  1204. {tabList.map((item, index, arr) => {
  1205. return (
  1206. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1207. {this.state.activeKey === String(item.id) ?<ChangeDetail
  1208. id={item.id}
  1209. orderUid={this.state.orderUid}
  1210. money={index == arr.length - 1 ? this.state.orderData.totalAmount + "" : undefined}
  1211. data={this.state.contractData}
  1212. pictureUrl={this.state.voucherUrl}
  1213. processState={this.props.processState}
  1214. loadData={this.callback}
  1215. reset={this.state.visible}
  1216. dataSource={this.state.dataProps}
  1217. proceedsData={this.state.proceedsData}
  1218. proceedsTotal={this.state.proTotal}
  1219. invoiceTotal={this.state.invTotal}
  1220. contactList={this.state.refundInvoice}
  1221. onCancel={this.visitCancel}
  1222. /> : <div/>}
  1223. </TabPane>
  1224. );
  1225. })}
  1226. {/* {this.state.status === 4 ? (
  1227. <TabPane tab="原订单" key="3">
  1228. <Form
  1229. layout="horizontal"
  1230. onSubmit={this.handleSubmit}
  1231. id="demand-form"
  1232. style={{ paddingBottom: "40px" }}
  1233. >
  1234. <Spin spinning={this.state.loading}>
  1235. <OrderDetail
  1236. orderData={this.state.primaryOrderData}
  1237. getOrderLog={this.getOrderLog}
  1238. dataSourceX={this.state.dataSourceX}
  1239. contactList={this.state.contactList}
  1240. orderNo={this.state.primaryOrderNo}
  1241. totalCui={this.state.totalCui}
  1242. contactListNew={this.state.contactListNew}
  1243. />
  1244. </Spin>
  1245. </Form>
  1246. </TabPane>
  1247. ) : (
  1248. ""
  1249. )} */}
  1250. {tabList.map((item, index) => {
  1251. if (item.usedOrder) {
  1252. return (
  1253. <TabPane
  1254. tab={"原订单" + (index + 1)}
  1255. key={item.usedOrder}
  1256. >
  1257. {this.state.activeKey === String(item.usedOrder) ?<Form
  1258. layout="horizontal"
  1259. onSubmit={this.handleSubmit}
  1260. id="demand-form"
  1261. style={{ paddingBottom: "40px" }}
  1262. >
  1263. <Spin spinning={this.state.loading}>
  1264. <OrderDetail
  1265. orderData={this.state.primaryOrderData}
  1266. getOrderLog={this.getOrderLog}
  1267. dataSourceX={this.state.dataSourceX}
  1268. contactList={this.state.contactList}
  1269. orderNo={this.state.primaryOrderNo}
  1270. totalCui={this.state.totalCui}
  1271. contactListNew={this.state.contactListNew}
  1272. />
  1273. </Spin>
  1274. </Form> : <div/>}
  1275. </TabPane>
  1276. );
  1277. } else {
  1278. return "";
  1279. }
  1280. })}
  1281. {this.state.status === 4 && this.state.isAddition ? (
  1282. this.state.type === 4 || this.state.type === 5 ? (
  1283. <TabPane tab="附加订单" key="c">
  1284. {this.state.activeKey === 'c' ? <OrderDetail
  1285. orderData={this.state.additionalOrderData}
  1286. getOrderLog={this.getOrderLog}
  1287. dataSourceX={this.state.dataSourceX}
  1288. contactList={this.state.contactList}
  1289. orderNo={this.state.additionalOrder}
  1290. totalCui={this.state.totalCui}
  1291. contactListNew={this.state.contactListNew}
  1292. /> : <div/>}
  1293. </TabPane>
  1294. ) : (
  1295. ""
  1296. )
  1297. ) : (
  1298. ""
  1299. )}
  1300. </Tabs>
  1301. </Modal>:<div/>}
  1302. <Modal
  1303. maskClosable={false}
  1304. visible={this.state.noVisible}
  1305. onOk={this.handleOk}
  1306. onCancel={this.noCancel}
  1307. width="400px"
  1308. title={"拒绝理由"}
  1309. footer=""
  1310. className="admin-desc-content"
  1311. confirmLoading={this.state.confirmLoading}
  1312. >
  1313. <Form layout="horizontal" id="demand-form">
  1314. <Spin spinning={this.state.loading}>
  1315. <div className="clearfix">
  1316. <FormItem
  1317. labelCol={{ span: 4 }}
  1318. wrapperCol={{ span: 16 }}
  1319. label="拒绝理由"
  1320. >
  1321. <Input
  1322. type="textarea"
  1323. placeholder="请输入拒绝理由"
  1324. rows={4}
  1325. value={this.state.reason}
  1326. onChange={e => {
  1327. this.setState({ reason: e.target.value });
  1328. }}
  1329. />
  1330. </FormItem>
  1331. </div>
  1332. <div className="clearfix">
  1333. <Button
  1334. className="cancel"
  1335. type="primary"
  1336. onClick={this.examOks}
  1337. style={{ marginLeft: "50px" }}
  1338. htmlType="submit"
  1339. loading={this.state.aloading}
  1340. >
  1341. 确定
  1342. </Button>
  1343. <Button
  1344. className="cancel"
  1345. type="ghost"
  1346. onClick={this.noCancel}
  1347. style={{ marginLeft: "50px" }}
  1348. >
  1349. 取消
  1350. </Button>
  1351. </div>
  1352. </Spin>
  1353. </Form>
  1354. </Modal>
  1355. {/* <Modal
  1356. visible={this.state.rizhivisible}
  1357. className="admin-desc-content"
  1358. width="800px"
  1359. maskClosable={false}
  1360. title="订单日志"
  1361. footer={null}
  1362. onCancel={this.closeOrderLog}
  1363. >
  1364. <div className="patent-table">
  1365. <Spin spinning={this.state.loading}>
  1366. <Table
  1367. bordered
  1368. columns={this.state.columnsrizhi}
  1369. dataSource={this.state.dataSourcerizhi}
  1370. pagination={false}
  1371. />
  1372. </Spin>
  1373. </div>
  1374. </Modal> */}
  1375. <OrderRiZi
  1376. dataSourcerizhi={this.state.dataSourcerizhi}
  1377. closeOrderLog={this.closeOrderLog}
  1378. visible={this.state.rizhivisible}
  1379. loading={this.state.loading}
  1380. />
  1381. </div>
  1382. {this.state.addnextVisible && <ProjectDetailsReadOnly
  1383. infor={this.state.dataInfor}
  1384. visible={this.state.addnextVisible}
  1385. onCancel={this.nextCancel}
  1386. />}
  1387. </div>
  1388. );
  1389. }
  1390. })
  1391. );
  1392. export default contractChange;