contractJsjl.js 44 KB

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