contractCwzj.js 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443
  1. import React from "react";
  2. import { Button, Input, Spin, Table, message, Form, Modal, Tabs } from "antd";
  3. import $ from "jquery/src/ajax";
  4. import {
  5. getNewOrderStatus,
  6. getProcessStatusNew,
  7. splitUrl,
  8. getjiedian,
  9. getboutique,
  10. getCuikuan,
  11. getProjectStatus,
  12. ShowModal,
  13. getType
  14. } from "@/tools.js";
  15. import "./customer.less";
  16. import { ChangeDetail } from "./changeComponent/changeDetailCwzj.js";
  17. import { SearchInput } from "./changeComponent/searchInput.js";
  18. import OrderDetail from "./changeComponent/orderDetail";
  19. import { ChooseList } from "./chooseList.jsx";
  20. import ShowModalDiv from "@/showModal.jsx";
  21. import OrderRiZi from "@/orderRiZi.jsx";
  22. 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. processState: this.props.processState,
  38. timeType: this.state.searchData.timeTypeSearch,
  39. startTime: this.state.searchData.releaseDate[0],
  40. endTime: this.state.searchData.releaseDate[1],
  41. salesmanName: this.state.searchData.salesmanNameSearch,
  42. orderNo: this.state.searchData.orderNoSearch,
  43. contractNo: this.state.searchData.contractNoSearch,
  44. complete: this.state.searchData.completeSearch || 1,
  45. depId: this.state.searchData.depIdSearch
  46. },
  47. success: function(data) {
  48. ShowModal(this);
  49. let theArr = [];
  50. if (data.error.length || data.data.list == "") {
  51. if (data.error && data.error.length) {
  52. message.warning(data.error[0].message);
  53. }
  54. } else {
  55. for (let i = 0; i < data.data.list.length; i++) {
  56. let thisdata = data.data.list[i];
  57. theArr.push({
  58. key: i,
  59. orderNo: thisdata.orderNo,
  60. createTimes: thisdata.createTimes,
  61. nickname: thisdata.nickname,
  62. orderType: thisdata.orderType,
  63. establishTimes: thisdata.establishTimes,
  64. orderStatus: thisdata.orderStatus,
  65. totalAmount: thisdata.totalAmount,
  66. settlementAmount: thisdata.settlementAmount,
  67. arrears: thisdata.arrears,
  68. salesmanName: thisdata.salesmanName,
  69. depName: thisdata.depName,
  70. processState: thisdata.processState,
  71. type: thisdata.type,
  72. status: thisdata.status,
  73. id: thisdata.id,
  74. contractNo: thisdata.contractNo,
  75. processStateText: getProcessStatusNew(
  76. thisdata.processState,
  77. thisdata.status
  78. )
  79. });
  80. }
  81. this.state.pagination.total = data.data.totalCount;
  82. this.state.pagination.current = data.data.pageNo;
  83. }
  84. if (data.data && data.data.list && !data.data.list.length) {
  85. this.state.pagination.total = 0;
  86. }
  87. this.setState({
  88. dataSource: theArr,
  89. pageNo: pageNo,
  90. pagination: this.state.pagination
  91. });
  92. }.bind(this)
  93. }).always(
  94. function() {
  95. this.setState({
  96. loading: false
  97. });
  98. }.bind(this)
  99. );
  100. },
  101. getInitialState() {
  102. return {
  103. page: 1,
  104. searchData: {
  105. releaseDate: []
  106. },
  107. primaryOrderData: {}, //原订单数据
  108. orderData: {}, //现订单数据
  109. pictureUrl: [],
  110. voucherUrl: [],
  111. attachmentUrl: [],
  112. //收款数据
  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. // 子组件改变的表格title数组
  278. changeList: undefined,
  279. columnsrizhi: [
  280. {
  281. title: "流程",
  282. dataIndex: "processName",
  283. key: "processName"
  284. },
  285. {
  286. title: "操作人",
  287. dataIndex: "adminName",
  288. key: "adminName"
  289. },
  290. {
  291. title: "时间",
  292. dataIndex: "createDate",
  293. key: "createDate"
  294. }
  295. ],
  296. dataSourceX: [],
  297. ContactsLists: [
  298. {
  299. title: "催款科目",
  300. dataIndex: "dunSubject",
  301. key: "dunSubject",
  302. render: text => {
  303. return getjiedian(text);
  304. }
  305. },
  306. {
  307. title: "金额(万元)",
  308. dataIndex: "money",
  309. key: "money"
  310. },
  311. {
  312. title: "催款状态",
  313. dataIndex: "dunStatus",
  314. key: "dunStatus",
  315. render: text => {
  316. return getCuikuan(text);
  317. }
  318. }
  319. ]
  320. };
  321. },
  322. //页面加载函数
  323. componentWillMount() {
  324. this.loadData();
  325. },
  326. //整行点击
  327. tableRowClick(record) {
  328. this.setState(
  329. {
  330. visible: true,
  331. type: record.type,
  332. status: record.status,
  333. buttonStatus: true,
  334. orderStatus: record.orderStatus,
  335. processStateText: record.processStateText,
  336. id: record.id,
  337. orderNo: record.orderNo
  338. },
  339. () => {
  340. this.xiangqing(record.orderNo);
  341. this.xiangmu(record.orderNo);
  342. this.jiedian(record.orderNo);
  343. this.jiedianNew(record.orderNo);
  344. this.createTabs();
  345. }
  346. );
  347. },
  348. //点击打卡项目详情
  349. tableRowClickX(record) {
  350. this.setState({
  351. jid: record.id, //项目ID
  352. kid: record.commodityId, //商品ID
  353. commodityName: record.commodityName, //金额
  354. commodityPrice: record.commodityPrice, //金额
  355. commodityQuantity: record.commodityQuantity, //数量
  356. taskComment: record.taskComment, //备注
  357. main: record.main.toString(), //是否为主要
  358. addnextVisible: true,
  359. addState: 0
  360. });
  361. },
  362. //项目详情关闭
  363. nextCancel() {
  364. this.setState({
  365. addnextVisible: false
  366. });
  367. },
  368. // 合同变更详情
  369. ChangeDetail(id) {
  370. let url = window.location.href.substring(7);
  371. $.ajax({
  372. method: "get",
  373. dataType: "json",
  374. crossDomain: false,
  375. url:
  376. globalConfig.context +
  377. "/api/admin/orderChange/orderChangeDetailsById",
  378. data: {
  379. id: id
  380. },
  381. success: function(data) {
  382. if (data.data) {
  383. let thisdata = data.data;
  384. Object.assign(thisdata, {
  385. processStateText: this.state.processStateText,
  386. userName: this.state.userName,
  387. contractNo: this.state.contractNo
  388. });
  389. this.setState({
  390. contractData: thisdata,
  391. voucherUrl: thisdata.voucherUrl
  392. ? splitUrl(
  393. thisdata.voucherUrl,
  394. ",",
  395. globalConfig.avatarHost + "/upload",
  396. url
  397. )
  398. : []
  399. });
  400. }
  401. }.bind(this)
  402. });
  403. $.ajax({
  404. method: "get",
  405. dataType: "json",
  406. crossDomain: false,
  407. url:
  408. globalConfig.context +
  409. "/api/admin/orderChange/listOrderInvoiceAndBill",
  410. data: {
  411. orderNo: this.state.orderNo
  412. },
  413. success: function(data) {
  414. if (!data.data) return;
  415. let proTotal = 0;
  416. let invTotal = 0;
  417. data.data.bill.forEach(item => {
  418. proTotal += item.transactionAmount;
  419. });
  420. data.data.invoice.forEach(item => {
  421. invTotal += item.amount;
  422. });
  423. this.setState({
  424. proceedsData: data.data,
  425. proTotal,
  426. invTotal
  427. });
  428. }.bind(this)
  429. });
  430. $.ajax({
  431. method: "get",
  432. dataType: "json",
  433. crossDomain: false,
  434. url:
  435. globalConfig.context +
  436. "/api/admin/orderChange/listOrderRefundInvoice",
  437. data: {
  438. orderNo: this.state.orderNo
  439. },
  440. success: data => {
  441. if (!data) return;
  442. data.data.forEach(item => {
  443. item.load = true;
  444. });
  445. this.setState({
  446. refundInvoice: data.data
  447. });
  448. }
  449. });
  450. },
  451. //订单详情
  452. xiangqing(orderNos) {
  453. $.ajax({
  454. method: "get",
  455. dataType: "json",
  456. crossDomain: false,
  457. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  458. data: {
  459. orderNo: orderNos
  460. },
  461. success: function(data) {
  462. if (data.error.length || data.data.list == "") {
  463. if (data.error && data.error.length) {
  464. message.warning(data.error[0].message);
  465. }
  466. } else {
  467. let thisdata = data.data;
  468. this.setState({
  469. userName: thisdata.userName,
  470. primaryOrderNo: thisdata.primaryOrder,
  471. additionalOrder: thisdata.additionalOrder,
  472. contractNo: thisdata.contractNo,
  473. // arrears: thisdata.arrears,
  474. orderData: thisdata,
  475. isAddition: thisdata.additionalOrder ? true : false
  476. });
  477. }
  478. }.bind(this)
  479. });
  480. },
  481. // 原订单数据
  482. primaryOrder(primaryOrder) {
  483. $.ajax({
  484. method: "get",
  485. dataType: "json",
  486. crossDomain: false,
  487. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  488. data: {
  489. orderNo: primaryOrder
  490. },
  491. success: function(data) {
  492. if (data.error.length || data.data.list == "") {
  493. if (data.error && data.error.length) {
  494. message.warning(data.error[0].message);
  495. }
  496. } else {
  497. let thisdata = data.data;
  498. this.setState({
  499. primaryOrderData: thisdata
  500. });
  501. }
  502. }.bind(this)
  503. });
  504. },
  505. // 附加订单数据
  506. additionalOrder(additionalOrder) {
  507. $.ajax({
  508. method: "get",
  509. dataType: "json",
  510. crossDomain: false,
  511. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  512. data: {
  513. orderNo: additionalOrder
  514. },
  515. success: function(data) {
  516. if (data.error.length || data.data.list == "") {
  517. if (data.error && data.error.length) {
  518. message.warning(data.error[0].message);
  519. }
  520. } else {
  521. let thisdata = data.data;
  522. this.setState({
  523. additionalOrderData: thisdata
  524. });
  525. }
  526. }.bind(this)
  527. });
  528. },
  529. //项目列表
  530. xiangmu(orderNos) {
  531. $.ajax({
  532. method: "get",
  533. dataType: "json",
  534. crossDomain: false,
  535. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  536. data: {
  537. orderNo: orderNos
  538. },
  539. success: function(data) {
  540. let theArr = [];
  541. if (data.error.length || data.data.list == "") {
  542. if (data.error && data.error.length) {
  543. message.warning(data.error[0].message);
  544. }
  545. } else {
  546. for (let i = 0; i < data.data.length; i++) {
  547. let thisdata = data.data[i];
  548. theArr.push({
  549. key: i,
  550. id: thisdata.id,
  551. orderNo: thisdata.orderNo, //订单编号
  552. commodityId: thisdata.commodityId, //项目ID
  553. commodityName: thisdata.commodityName, //项目名称
  554. cname: thisdata.cname, //项目类别
  555. commodityPrice: thisdata.commodityPrice, //项目价格
  556. commodityQuantity: thisdata.commodityQuantity, //项目数量
  557. main: thisdata.main, //是否为主要任务
  558. taskComment: thisdata.taskComment, //任务说明
  559. contacts: thisdata.contacts, //联系人
  560. contactsMobile: thisdata.contactsMobile, //联系人电话
  561. projectStatus: thisdata.projectStatus, //项目状态
  562. sort: thisdata.cSort
  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. });
  703. }
  704. if (!totalCui) {
  705. totalCui = 0;
  706. }
  707. totalCui = (Math.round(totalCui * 10000) / 10000).toFixed(4);
  708. this.setState({
  709. contactListNew: theArr,
  710. totalCui
  711. });
  712. }
  713. }.bind(this)
  714. }).always(
  715. function() {
  716. this.setState({
  717. loading: false
  718. });
  719. }.bind(this)
  720. );
  721. },
  722. //审核通过
  723. examOk() {
  724. $.ajax({
  725. method: "post",
  726. dataType: "json",
  727. crossDomain: false,
  728. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  729. data: {
  730. orderNo: this.state.orderNo,
  731. orderStatus: 2
  732. },
  733. success: function(data) {
  734. if (data.error.length || data.data.list == "") {
  735. if (data.error && data.error.length) {
  736. message.warning(data.error[0].message);
  737. }
  738. } else {
  739. message.success("该订单已通过审核~");
  740. this.setState({
  741. visible: false
  742. });
  743. this.reset();
  744. }
  745. }.bind(this)
  746. }).always(
  747. function() {
  748. this.setState({
  749. loading: false
  750. });
  751. }.bind(this)
  752. );
  753. },
  754. //通过发给外包
  755. outsourcing() {
  756. $.ajax({
  757. method: "post",
  758. dataType: "json",
  759. crossDomain: false,
  760. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  761. data: {
  762. orderNo: this.state.orderNo,
  763. orderStatus: 2,
  764. outsource: 1
  765. },
  766. success: function(data) {
  767. if (data.error.length || data.data.list == "") {
  768. if (data.error && data.error.length) {
  769. message.warning(data.error[0].message);
  770. }
  771. } else {
  772. message.success("该订单已通过审核~");
  773. this.setState({
  774. visible: false
  775. });
  776. this.reset();
  777. }
  778. }.bind(this)
  779. }).always(
  780. function() {
  781. this.setState({
  782. loading: false
  783. });
  784. }.bind(this)
  785. );
  786. },
  787. //审核不通过
  788. examOks() {
  789. this.setState({
  790. aloading: true
  791. });
  792. $.ajax({
  793. method: "post",
  794. dataType: "json",
  795. crossDomain: false,
  796. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  797. data: {
  798. orderNo: this.state.orderNo,
  799. orderStatus: 3,
  800. reason: this.state.reason
  801. },
  802. success: function(data) {
  803. if (data.error.length || data.data.list == "") {
  804. if (data.error && data.error.length) {
  805. message.warning(data.error[0].message);
  806. this.setState({
  807. aloading: true
  808. });
  809. }
  810. } else {
  811. message.success("该订单已被拒绝~");
  812. this.setState({
  813. visible: false,
  814. aloading: false,
  815. noVisible: false,
  816. reason: ""
  817. });
  818. this.reset();
  819. // window.location.reload()
  820. }
  821. }.bind(this)
  822. }).always(
  823. function() {
  824. this.setState({
  825. loading: false
  826. });
  827. }.bind(this)
  828. );
  829. },
  830. //点击拒绝
  831. examNo() {
  832. this.setState({
  833. noVisible: true
  834. });
  835. },
  836. loadDataChange() {
  837. $.ajax({
  838. method: "get",
  839. dataType: "json",
  840. async: false,
  841. crossDomain: false,
  842. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  843. data: {
  844. changeId: this.state.id
  845. },
  846. success: function(data) {
  847. if (data.error.length || data.data.list == "") {
  848. if (data.error && data.error.length) {
  849. message.warning(data.error[0].message);
  850. }
  851. } else {
  852. // console.log("拿到历史", data.data);
  853. this.setState({
  854. dataProps: data.data
  855. });
  856. }
  857. }.bind(this)
  858. });
  859. },
  860. callback(key) {
  861. this.setState(
  862. {
  863. activeKey: key
  864. },
  865. () => {
  866. if (key != "a" && key != "c" && key.length < 10) {
  867. this.ChangeDetail(key);
  868. this.loadDataChange(key);
  869. } else if (key != "a" && key != "c" && key.length > 10) {
  870. this.primaryOrder(key);
  871. this.xiangmu(key);
  872. this.jiedian(key);
  873. this.jiedianNew(key);
  874. }
  875. }
  876. );
  877. if (key === "a") {
  878. this.xiangmu(this.state.orderNo);
  879. this.jiedian(this.state.orderNo);
  880. this.jiedianNew(this.state.orderNo);
  881. }
  882. // if (key === "2") {
  883. // this.ChangeDetail(this.state.id);
  884. // this.loadDataChange();
  885. // }
  886. // if (key === "3") {
  887. // this.primaryOrder(this.state.primaryOrderNo);
  888. // this.xiangmu(this.state.primaryOrderNo);
  889. // this.jiedian(this.state.primaryOrderNo);
  890. // this.jiedianNew(this.state.primaryOrderNo);
  891. // }
  892. if (key === "c") {
  893. this.additionalOrder(this.state.additionalOrder);
  894. this.xiangmu(this.state.additionalOrder);
  895. this.jiedian(this.state.additionalOrder);
  896. this.jiedianNew(this.state.additionalOrder);
  897. this.setState({
  898. buttonStatusA: false
  899. });
  900. } else {
  901. this.setState({
  902. buttonStatusA: true
  903. });
  904. }
  905. },
  906. closeDesc(e, s) {
  907. this.state.activeKey = "a";
  908. this.state.userDetaile = false;
  909. this.state.signBillVisible = false;
  910. this.state.visible = e;
  911. if (s) {
  912. this.loadData(this.state.pageNo);
  913. }
  914. },
  915. // 获取原订单编号
  916. getPrimaryOrder(value) {
  917. this.setState({
  918. primaryOrder: value
  919. });
  920. },
  921. getAdditionalOrder(value) {
  922. this.setState({
  923. additionalOrder: value
  924. });
  925. },
  926. getUrl(url) {
  927. let theorgCodeUrl = [];
  928. if (url.length) {
  929. let picArr = [];
  930. url.map(function(item) {
  931. if (
  932. item.response &&
  933. item.response.data &&
  934. item.response.data.length
  935. ) {
  936. picArr.push(item.response.data);
  937. }
  938. });
  939. theorgCodeUrl = picArr.join(",");
  940. }
  941. return theorgCodeUrl;
  942. },
  943. sureOut() {
  944. if (!this.state.companyName) {
  945. message.warning("公司名称不能为空");
  946. return;
  947. }
  948. if (!this.state.unitPrice) {
  949. message.warning("单价不能为空");
  950. return;
  951. }
  952. if (!this.state.unitNumber) {
  953. message.warning("数量不能为空");
  954. return;
  955. }
  956. if (!this.state.amount) {
  957. message.warning("总金额不能为空");
  958. return;
  959. }
  960. if (!this.state.outsourceRemarks) {
  961. message.warning("备注不能为空");
  962. return;
  963. }
  964. if (this.state.pictureUrl.length === 0) {
  965. message.warning("合同扫描件不能为空");
  966. return;
  967. }
  968. $.ajax({
  969. method: "POST",
  970. dataType: "json",
  971. crossDomain: false,
  972. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  973. data: {
  974. id: this.state.id,
  975. orderNo: this.state.orderNo,
  976. companyName: this.state.companyName,
  977. amount: this.state.amount,
  978. outsourceRemarks: this.state.outsourceRemarks,
  979. unitNumber: this.state.unitNumber,
  980. unitPrice: this.state.unitPrice,
  981. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  982. ? this.getUrl(this.state.attachmentUrl)
  983. : "",
  984. orderStatus: 2,
  985. pictureUrl: this.getUrl(this.state.pictureUrl).length
  986. ? this.getUrl(this.state.pictureUrl)
  987. : ""
  988. }
  989. }).done(
  990. function(data) {
  991. this.setState({
  992. loading: false
  993. });
  994. if (!data.error.length) {
  995. message.success("发起成功!");
  996. this.outReset();
  997. this.visitCancel();
  998. } else {
  999. message.warning(data.error[0].message);
  1000. }
  1001. }.bind(this)
  1002. );
  1003. },
  1004. //关闭输入理由框
  1005. noCancel() {
  1006. this.setState({
  1007. noVisible: false,
  1008. aloading: false,
  1009. reason: ""
  1010. });
  1011. },
  1012. //重置
  1013. reset() {
  1014. this.setState({
  1015. signBillVisible: false
  1016. });
  1017. this.state.orderNo = "";
  1018. this.state.customerName = "";
  1019. this.state.releaseDate[0] = undefined;
  1020. this.state.releaseDate[1] = undefined;
  1021. this.state.approval = undefined;
  1022. this.loadData(1);
  1023. // window.location.reload();
  1024. },
  1025. outReset() {
  1026. this.setState({
  1027. companyName: "",
  1028. amount: "",
  1029. unitPrice: "",
  1030. unitNumber: "",
  1031. outsourceRemarks: "",
  1032. attachmentUrl: [],
  1033. pictureUrl: []
  1034. });
  1035. },
  1036. getOrgCodeUrl(e) {
  1037. this.setState({ pictureUrl: e });
  1038. },
  1039. //关闭详情
  1040. visitCancel() {
  1041. this.setState(
  1042. {
  1043. activeKey: "a"
  1044. },
  1045. () => {
  1046. this.setState({
  1047. visible: false
  1048. });
  1049. }
  1050. );
  1051. this.loadData(this.state.pageNo);
  1052. },
  1053. visitOk() {
  1054. this.setState({
  1055. visible: false
  1056. });
  1057. },
  1058. changeList(arr) {
  1059. const newArr = [];
  1060. this.state.columns.forEach(item => {
  1061. arr.forEach(val => {
  1062. if (val === item.title) {
  1063. newArr.push(item);
  1064. }
  1065. });
  1066. });
  1067. this.setState({
  1068. changeList: newArr
  1069. });
  1070. },
  1071. createTabs() {
  1072. $.ajax({
  1073. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  1074. method: "get",
  1075. data: {
  1076. orderNo: this.state.orderNo
  1077. },
  1078. success: data => {
  1079. if (data.error && data.error.length) {
  1080. message.warning(data.error[0].message);
  1081. } else {
  1082. this.setState({
  1083. tabList: data.data
  1084. });
  1085. }
  1086. }
  1087. });
  1088. },
  1089. render() {
  1090. const tabList = this.state.tabList || [];
  1091. const formItemLayout = {
  1092. labelCol: { span: 8 },
  1093. wrapperCol: { span: 14 }
  1094. };
  1095. const FormItem = Form.Item;
  1096. const { TabPane } = Tabs;
  1097. return (
  1098. <div className="user-content">
  1099. <ShowModalDiv ShowModal={this.state.showModal} />
  1100. <div className="content-title">
  1101. <span>合同变更审核订单</span>
  1102. </div>
  1103. <div className="user-search">
  1104. <SearchInput search={this.search} />
  1105. <ChooseList
  1106. columns={this.state.columns}
  1107. changeFn={this.changeList}
  1108. changeList={this.state.changeList}
  1109. top={65}
  1110. />
  1111. <div className="patent-table">
  1112. <Spin spinning={this.state.loading}>
  1113. <Table
  1114. size="small"
  1115. bordered
  1116. columns={
  1117. this.state.changeList == undefined
  1118. ? this.state.columns
  1119. : this.state.changeList
  1120. }
  1121. dataSource={this.state.dataSource}
  1122. pagination={this.state.pagination}
  1123. onRowClick={this.tableRowClick}
  1124. />
  1125. </Spin>
  1126. </div>
  1127. <Modal
  1128. className="customeDetails"
  1129. footer=""
  1130. maskClosable={false}
  1131. width="900px"
  1132. visible={this.state.visible}
  1133. onOk={this.visitOk}
  1134. onCancel={this.visitCancel}
  1135. >
  1136. <Tabs
  1137. activeKey={this.state.activeKey}
  1138. onChange={this.callback}
  1139. type="card"
  1140. >
  1141. <TabPane tab="订单详情" key="a">
  1142. <Form
  1143. layout="horizontal"
  1144. onSubmit={this.handleSubmit}
  1145. id="demand-form"
  1146. style={{ paddingBottom: "40px" }}
  1147. >
  1148. <Spin spinning={this.state.loading}>
  1149. <OrderDetail
  1150. orderData={this.state.orderData}
  1151. getOrderLog={this.getOrderLog}
  1152. dataSourceX={this.state.dataSourceX}
  1153. contactList={this.state.contactList}
  1154. orderNo={this.state.orderNo}
  1155. totalCui={this.state.totalCui}
  1156. contactListNew={this.state.contactListNew}
  1157. isCaiWu={true}
  1158. />
  1159. </Spin>
  1160. </Form>
  1161. </TabPane>
  1162. {/* <TabPane tab="合同变更记录" key="2">
  1163. <ChangeDetail
  1164. data={this.state.contractData}
  1165. txt={this.state.processStateText}
  1166. pictureUrl={this.state.voucherUrl}
  1167. processState={this.props.processState}
  1168. loadData={this.callback}
  1169. reset={this.state.visible}
  1170. dataSource={this.state.dataProps}
  1171. proceedsData={this.state.proceedsData}
  1172. proceedsTotal={this.state.proTotal}
  1173. invoiceTotal={this.state.invTotal}
  1174. contactList={this.state.refundInvoice}
  1175. onCancel={this.visitCancel}
  1176. />
  1177. </TabPane> */}
  1178. {tabList.map((item, index, arr) => {
  1179. return (
  1180. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1181. <ChangeDetail
  1182. id={item.id}
  1183. money={index == arr.length - 1 ? this.state.orderData.totalAmount + "" : undefined}
  1184. data={this.state.contractData}
  1185. txt={this.state.processStateText}
  1186. pictureUrl={this.state.voucherUrl}
  1187. processState={this.props.processState}
  1188. loadData={this.callback}
  1189. reset={this.state.visible}
  1190. dataSource={this.state.dataProps}
  1191. proceedsData={this.state.proceedsData}
  1192. proceedsTotal={this.state.proTotal}
  1193. invoiceTotal={this.state.invTotal}
  1194. contactList={this.state.refundInvoice}
  1195. onCancel={this.visitCancel}
  1196. />
  1197. </TabPane>
  1198. );
  1199. })}
  1200. {/* {this.state.status === 4 ? (
  1201. <TabPane tab="原订单" key="3">
  1202. <Form
  1203. layout="horizontal"
  1204. onSubmit={this.handleSubmit}
  1205. id="demand-form"
  1206. style={{ paddingBottom: "40px" }}
  1207. >
  1208. <Spin spinning={this.state.loading}>
  1209. <OrderDetail
  1210. orderData={this.state.primaryOrderData}
  1211. getOrderLog={this.getOrderLog}
  1212. dataSourceX={this.state.dataSourceX}
  1213. contactList={this.state.contactList}
  1214. orderNo={this.state.primaryOrderNo}
  1215. isCaiWu={true}
  1216. totalCui={this.state.totalCui}
  1217. contactListNew={this.state.contactListNew}
  1218. />
  1219. </Spin>
  1220. </Form>
  1221. </TabPane>
  1222. ) : (
  1223. ""
  1224. )} */}
  1225. {tabList.map((item, index) => {
  1226. if (item.usedOrder) {
  1227. return (
  1228. <TabPane
  1229. tab={"原订单" + (index + 1)}
  1230. key={item.usedOrder}
  1231. >
  1232. <Form
  1233. layout="horizontal"
  1234. onSubmit={this.handleSubmit}
  1235. id="demand-form"
  1236. style={{ paddingBottom: "40px" }}
  1237. >
  1238. <Spin spinning={this.state.loading}>
  1239. <OrderDetail
  1240. orderData={this.state.primaryOrderData}
  1241. getOrderLog={this.getOrderLog}
  1242. dataSourceX={this.state.dataSourceX}
  1243. contactList={this.state.contactList}
  1244. orderNo={this.state.primaryOrderNo}
  1245. isCaiWu={true}
  1246. totalCui={this.state.totalCui}
  1247. contactListNew={this.state.contactListNew}
  1248. />
  1249. </Spin>
  1250. </Form>
  1251. </TabPane>
  1252. );
  1253. } else {
  1254. return "";
  1255. }
  1256. })}
  1257. {this.state.status === 4 && this.state.isAddition ? (
  1258. this.state.type === 4 || this.state.type === 5 ? (
  1259. <TabPane tab="附加订单" key="c">
  1260. <OrderDetail
  1261. orderData={this.state.additionalOrderData}
  1262. getOrderLog={this.getOrderLog}
  1263. dataSourceX={this.state.dataSourceX}
  1264. contactList={this.state.contactList}
  1265. orderNo={this.state.additionalOrder}
  1266. isCaiWu={true}
  1267. totalCui={this.state.totalCui}
  1268. contactListNew={this.state.contactListNew}
  1269. />
  1270. </TabPane>
  1271. ) : (
  1272. ""
  1273. )
  1274. ) : (
  1275. ""
  1276. )}
  1277. </Tabs>
  1278. </Modal>
  1279. <Modal
  1280. maskClosable={false}
  1281. visible={this.state.addnextVisible}
  1282. onOk={this.nextCancel}
  1283. onCancel={this.nextCancel}
  1284. confirmLoading={this.state.confirmLoading}
  1285. width="800px"
  1286. title={"项目任务详情"}
  1287. footer=""
  1288. className="admin-desc-content"
  1289. >
  1290. <Form layout="horizontal" id="demand-form">
  1291. <Spin spinning={this.state.loading}>
  1292. <div className="clearfix">
  1293. <FormItem
  1294. className="half-item"
  1295. {...formItemLayout}
  1296. label="项目名称"
  1297. >
  1298. <span>{this.state.commodityName}</span>
  1299. </FormItem>
  1300. <FormItem
  1301. className="half-item"
  1302. {...formItemLayout}
  1303. label="项目数量"
  1304. >
  1305. <span>{this.state.commodityQuantity}</span>
  1306. </FormItem>
  1307. <FormItem
  1308. className="half-item"
  1309. {...formItemLayout}
  1310. label="金额(万元)"
  1311. >
  1312. <span>{this.state.commodityPrice}</span>
  1313. </FormItem>
  1314. <FormItem
  1315. className="half-item"
  1316. {...formItemLayout}
  1317. label="主要项目"
  1318. >
  1319. <span>{getboutique(this.state.main)}</span>
  1320. </FormItem>
  1321. <div className="clearfix">
  1322. <FormItem
  1323. labelCol={{ span: 4 }}
  1324. wrapperCol={{ span: 16 }}
  1325. label="服务说明"
  1326. >
  1327. <span>{this.state.taskComment}</span>
  1328. </FormItem>
  1329. </div>
  1330. </div>
  1331. </Spin>
  1332. </Form>
  1333. </Modal>
  1334. <Modal
  1335. maskClosable={false}
  1336. visible={this.state.noVisible}
  1337. onOk={this.handleOk}
  1338. onCancel={this.noCancel}
  1339. width="400px"
  1340. title={"拒绝理由"}
  1341. footer=""
  1342. className="admin-desc-content"
  1343. confirmLoading={this.state.confirmLoading}
  1344. >
  1345. <Form layout="horizontal" id="demand-form">
  1346. <Spin spinning={this.state.loading}>
  1347. <div className="clearfix">
  1348. <FormItem
  1349. labelCol={{ span: 4 }}
  1350. wrapperCol={{ span: 16 }}
  1351. label="拒绝理由"
  1352. >
  1353. <Input
  1354. type="textarea"
  1355. placeholder="请输入拒绝理由"
  1356. rows={4}
  1357. value={this.state.reason}
  1358. onChange={e => {
  1359. this.setState({ reason: e.target.value });
  1360. }}
  1361. />
  1362. </FormItem>
  1363. </div>
  1364. <div className="clearfix">
  1365. <Button
  1366. className="cancel"
  1367. type="primary"
  1368. onClick={this.examOks}
  1369. style={{ marginLeft: "50px" }}
  1370. htmlType="submit"
  1371. loading={this.state.aloading}
  1372. >
  1373. 确定
  1374. </Button>
  1375. <Button
  1376. className="cancel"
  1377. type="ghost"
  1378. onClick={this.noCancel}
  1379. style={{ marginLeft: "50px" }}
  1380. >
  1381. 取消
  1382. </Button>
  1383. </div>
  1384. </Spin>
  1385. </Form>
  1386. </Modal>
  1387. {/* <Modal
  1388. visible={this.state.rizhivisible}
  1389. className="admin-desc-content"
  1390. width="800px"
  1391. maskClosable={false}
  1392. title="订单日志"
  1393. footer={null}
  1394. onCancel={this.closeOrderLog}
  1395. >
  1396. <div className="patent-table">
  1397. <Spin spinning={this.state.loading}>
  1398. <Table
  1399. bordered
  1400. columns={this.state.columnsrizhi}
  1401. dataSource={this.state.dataSourcerizhi}
  1402. pagination={false}
  1403. />
  1404. </Spin>
  1405. </div>
  1406. </Modal> */}
  1407. <OrderRiZi
  1408. dataSourcerizhi={this.state.dataSourcerizhi}
  1409. closeOrderLog={this.closeOrderLog}
  1410. visible={this.state.rizhivisible}
  1411. loading={this.state.loading}
  1412. />
  1413. </div>
  1414. </div>
  1415. );
  1416. }
  1417. })
  1418. );
  1419. export default contractChange;