contractCwzj.js 43 KB

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