contractJszj.js 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419
  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/changeDetailJszj.js";
  17. import { SearchInput } from "./changeComponent/searchInput.js";
  18. import OrderDetail from "./changeComponent/orderDetail";
  19. import ShowModalDiv from "@/showModal.jsx";
  20. import OrderRiZi from "@/orderRiZi.jsx";
  21. const contractChange = Form.create()(
  22. React.createClass({
  23. loadData(pageNo) {
  24. this.setState({
  25. loading: true
  26. });
  27. $.ajax({
  28. method: "get",
  29. dataType: "json",
  30. crossDomain: false,
  31. url: globalConfig.context + "/api/admin/orderChange/orderChangeList",
  32. data: {
  33. pageNo: pageNo || 1,
  34. pageSize: this.state.pagination.pageSize,
  35. userName: this.state.searchData.userNameSearch,
  36. processState: this.props.processState,
  37. timeType: this.state.searchData.timeTypeSearch,
  38. startTime: this.state.searchData.releaseDate[0],
  39. endTime: this.state.searchData.releaseDate[1],
  40. salesmanName: this.state.searchData.salesmanNameSearch,
  41. complete: this.state.searchData.completeSearch || 1,
  42. depId: this.state.searchData.depIdSearch,
  43. orderNo: this.state.searchData.orderNoSearch,
  44. contractNo: this.state.searchData.contractNoSearch,
  45. type: this.state.searchData.changeSearch
  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. proceedsData: {},
  113. proTotal: 0,
  114. invTotal: 0,
  115. contractData: {},
  116. // 回收退票数据
  117. refundInvoice: [],
  118. RefundInvoice: [],
  119. additionalOrderData: {},
  120. paginations: false,
  121. activeKey: "a",
  122. confirmLoading: false,
  123. aloading: false,
  124. pagination: {
  125. defaultCurrent: 1,
  126. defaultPageSize: 10,
  127. showQuickJumper: true,
  128. pageSize: 10,
  129. onChange: function (page) {
  130. this.loadData(page);
  131. }.bind(this),
  132. showTotal: function (total) {
  133. return "共" + total + "条数据";
  134. }
  135. },
  136. columns: [
  137. {
  138. title: "合同编号",
  139. dataIndex: "contractNo",
  140. key: "contractNo"
  141. },
  142. {
  143. title: "订单编号",
  144. dataIndex: "orderNo",
  145. key: "orderNo"
  146. },
  147. {
  148. title: "客户名称",
  149. dataIndex: "nickname",
  150. key: "nickname"
  151. },
  152. {
  153. title: "订单部门",
  154. dataIndex: "depName",
  155. key: "depName"
  156. },
  157. {
  158. title: "订单类型",
  159. dataIndex: "orderType",
  160. key: "orderType",
  161. render: text => {
  162. return text ? "科技项目" : "认证项目";
  163. }
  164. },
  165. {
  166. title: "下单时间",
  167. dataIndex: "establishTimes",
  168. key: "establishTimes"
  169. },
  170. {
  171. title: "订单状态",
  172. dataIndex: "orderStatus",
  173. key: "orderStatus",
  174. render: text => {
  175. return getNewOrderStatus(text);
  176. }
  177. },
  178. {
  179. title: "合同额(万元)",
  180. dataIndex: "totalAmount",
  181. key: "totalAmount"
  182. },
  183. {
  184. title: "已付额(万元)",
  185. dataIndex: "settlementAmount",
  186. key: "settlementAmount"
  187. },
  188. {
  189. title: "欠款(万元)",
  190. dataIndex: "arrears",
  191. key: "arrears"
  192. },
  193. {
  194. title: "订单负责人",
  195. dataIndex: "salesmanName",
  196. key: "salesmanName"
  197. },
  198. {
  199. title: "变更类型",
  200. dataIndex: "type",
  201. key: "type",
  202. render: text => {
  203. return getType(text);
  204. }
  205. },
  206. {
  207. title: "审核状态",
  208. dataIndex: "processStateText",
  209. key: "processStateText"
  210. },
  211. {
  212. title: "提交时间",
  213. dataIndex: "createTimes",
  214. key: "createTimes"
  215. }
  216. ],
  217. dataSource: [],
  218. // 传递给子组件的
  219. dataProps: [],
  220. columnsX: [
  221. {
  222. title: "业务项目名称",
  223. dataIndex: "commodityName",
  224. key: "commodityName"
  225. },
  226. {
  227. title: "项目类别",
  228. dataIndex: "cname",
  229. key: "cname"
  230. },
  231. {
  232. title: "项目数量",
  233. dataIndex: "commodityQuantity",
  234. key: "commodityQuantity"
  235. },
  236. {
  237. title: "金额(万元)",
  238. dataIndex: "commodityPrice",
  239. key: "commodityPrice"
  240. },
  241. {
  242. title: "负责人",
  243. dataIndex: "contacts",
  244. key: "contacts"
  245. },
  246. {
  247. title: "负责人电话",
  248. dataIndex: "contactsMobile",
  249. key: "contactsMobile"
  250. },
  251. {
  252. title: "项目状态",
  253. dataIndex: "projectStatus",
  254. key: "projectStatus",
  255. render: text => {
  256. return getProjectStatus(text);
  257. }
  258. },
  259. {
  260. title: "主要项目",
  261. dataIndex: "main",
  262. key: "main",
  263. render: text => {
  264. return text ? "是" : "否";
  265. }
  266. },
  267. {
  268. title: "项目说明",
  269. dataIndex: "taskComment",
  270. key: "taskComment",
  271. render: text => {
  272. return text && text.length > 8 ? text.substr(0, 8) + "…" : text;
  273. }
  274. }
  275. ],
  276. columnsrizhi: [
  277. {
  278. title: "流程",
  279. dataIndex: "processName",
  280. key: "processName"
  281. },
  282. {
  283. title: "操作人",
  284. dataIndex: "adminName",
  285. key: "adminName"
  286. },
  287. {
  288. title: "时间",
  289. dataIndex: "createDate",
  290. key: "createDate"
  291. }
  292. ],
  293. dataSourceX: [],
  294. ContactsLists: [
  295. {
  296. title: "催款科目",
  297. dataIndex: "dunSubject",
  298. key: "dunSubject",
  299. render: text => {
  300. return getjiedian(text);
  301. }
  302. },
  303. {
  304. title: "金额(万元)",
  305. dataIndex: "money",
  306. key: "money"
  307. },
  308. {
  309. title: "催款状态",
  310. dataIndex: "dunStatus",
  311. key: "dunStatus",
  312. render: text => {
  313. return getCuikuan(text);
  314. }
  315. }
  316. ]
  317. };
  318. },
  319. //页面加载函数
  320. componentWillMount() {
  321. this.loadData();
  322. },
  323. //整行点击
  324. tableRowClick(record) {
  325. this.setState(
  326. {
  327. visible: true,
  328. type: record.type,
  329. status: record.status,
  330. buttonStatus: true,
  331. orderStatus: record.orderStatus,
  332. processStateText: record.processStateText,
  333. id: record.id,
  334. orderNo: record.orderNo
  335. },
  336. () => {
  337. this.xiangqing(record.orderNo);
  338. this.xiangmu(record.orderNo);
  339. this.jiedian(record.orderNo);
  340. this.jiedianNew(record.orderNo);
  341. this.createTabs();
  342. }
  343. );
  344. },
  345. //点击打卡项目详情
  346. tableRowClickX(record) {
  347. this.setState({
  348. jid: record.id, //项目ID
  349. kid: record.commodityId, //商品ID
  350. commodityName: record.commodityName, //金额
  351. commodityPrice: record.commodityPrice, //金额
  352. commodityQuantity: record.commodityQuantity, //数量
  353. taskComment: record.taskComment, //备注
  354. main: record.main.toString(), //是否为主要
  355. addnextVisible: true,
  356. addState: 0
  357. });
  358. },
  359. //项目详情关闭
  360. nextCancel() {
  361. this.setState({
  362. addnextVisible: false
  363. });
  364. },
  365. // 合同变更详情
  366. ChangeDetail(id) {
  367. let url = window.location.href.substring(7);
  368. $.ajax({
  369. method: "get",
  370. dataType: "json",
  371. crossDomain: false,
  372. url:
  373. globalConfig.context +
  374. "/api/admin/orderChange/orderChangeDetailsById",
  375. data: {
  376. id: id
  377. },
  378. success: function (data) {
  379. if (data.data) {
  380. let thisdata = data.data;
  381. Object.assign(thisdata, {
  382. processStateText: this.state.processStateText,
  383. userName: this.state.userName,
  384. contractNo: this.state.contractNo
  385. });
  386. this.setState({
  387. contractData: thisdata,
  388. voucherUrl: thisdata.voucherUrl
  389. ? splitUrl(
  390. thisdata.voucherUrl,
  391. ",",
  392. globalConfig.avatarHost + "/upload",
  393. url
  394. )
  395. : []
  396. });
  397. }
  398. }.bind(this)
  399. });
  400. $.ajax({
  401. method: "get",
  402. dataType: "json",
  403. crossDomain: false,
  404. url:
  405. globalConfig.context +
  406. "/api/admin/orderChange/listOrderInvoiceAndBill",
  407. data: {
  408. orderNo: this.state.orderNo
  409. },
  410. success: function (data) {
  411. if (!data.data) return;
  412. let proTotal = 0;
  413. let invTotal = 0;
  414. data.data.bill.forEach(item => {
  415. proTotal += item.transactionAmount;
  416. });
  417. data.data.invoice.forEach(item => {
  418. invTotal += item.amount;
  419. });
  420. this.setState({
  421. proceedsData: data.data,
  422. proTotal,
  423. invTotal
  424. });
  425. }.bind(this)
  426. });
  427. $.ajax({
  428. method: "get",
  429. dataType: "json",
  430. crossDomain: false,
  431. url:
  432. globalConfig.context +
  433. "/api/admin/orderChange/listOrderRefundInvoice",
  434. data: {
  435. orderNo: this.state.orderNo
  436. },
  437. success: data => {
  438. if (!data) return;
  439. data.data.forEach(item => {
  440. item.load = true;
  441. });
  442. this.setState({
  443. refundInvoice: data.data
  444. });
  445. }
  446. });
  447. },
  448. //订单详情
  449. xiangqing(orderNos) {
  450. $.ajax({
  451. method: "get",
  452. dataType: "json",
  453. crossDomain: false,
  454. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  455. data: {
  456. orderNo: orderNos
  457. },
  458. success: function (data) {
  459. if (data.error.length || data.data.list == "") {
  460. if (data.error && data.error.length) {
  461. message.warning(data.error[0].message);
  462. }
  463. } else {
  464. let thisdata = data.data;
  465. this.setState({
  466. userName: thisdata.userName,
  467. primaryOrderNo: thisdata.primaryOrder,
  468. additionalOrder: thisdata.additionalOrder,
  469. contractNo: thisdata.contractNo,
  470. // arrears: thisdata.arrears,
  471. orderData: thisdata,
  472. isAddition: thisdata.additionalOrder ? true : false
  473. });
  474. }
  475. }.bind(this)
  476. });
  477. },
  478. // 原订单数据
  479. primaryOrder(primaryOrder) {
  480. $.ajax({
  481. method: "get",
  482. dataType: "json",
  483. crossDomain: false,
  484. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  485. data: {
  486. orderNo: primaryOrder
  487. },
  488. success: function (data) {
  489. if (data.error.length || data.data.list == "") {
  490. if (data.error && data.error.length) {
  491. message.warning(data.error[0].message);
  492. }
  493. } else {
  494. let thisdata = data.data;
  495. this.setState({
  496. primaryOrderData: thisdata
  497. });
  498. }
  499. }.bind(this)
  500. });
  501. },
  502. // 附加订单数据
  503. additionalOrder(additionalOrder) {
  504. $.ajax({
  505. method: "get",
  506. dataType: "json",
  507. crossDomain: false,
  508. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  509. data: {
  510. orderNo: additionalOrder
  511. },
  512. success: function (data) {
  513. if (data.error.length || data.data.list == "") {
  514. if (data.error && data.error.length) {
  515. message.warning(data.error[0].message);
  516. }
  517. } else {
  518. let thisdata = data.data;
  519. this.setState({
  520. additionalOrderData: thisdata
  521. });
  522. }
  523. }.bind(this)
  524. });
  525. },
  526. //项目列表
  527. xiangmu(orderNos) {
  528. $.ajax({
  529. method: "get",
  530. dataType: "json",
  531. crossDomain: false,
  532. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  533. data: {
  534. orderNo: orderNos
  535. },
  536. success: function (data) {
  537. let theArr = [];
  538. if (data.error.length || data.data.list == "") {
  539. if (data.error && data.error.length) {
  540. message.warning(data.error[0].message);
  541. }
  542. } else {
  543. for (let i = 0; i < data.data.length; i++) {
  544. let thisdata = data.data[i];
  545. theArr.push({
  546. key: i,
  547. id: thisdata.id,
  548. orderNo: thisdata.orderNo, //订单编号
  549. commodityId: thisdata.commodityId, //项目ID
  550. commodityName: thisdata.commodityName, //项目名称
  551. cname: thisdata.cname, //项目类别
  552. commodityPrice: thisdata.commodityPrice, //项目价格
  553. commodityQuantity: thisdata.commodityQuantity, //项目数量
  554. main: thisdata.main, //是否为主要任务
  555. taskComment: thisdata.taskComment, //任务说明
  556. contacts: thisdata.contacts, //联系人
  557. contactsMobile: thisdata.contactsMobile, //联系人电话
  558. projectStatus: thisdata.projectStatus, //项目状态
  559. sort: thisdata.cSort,
  560. splitStatus: thisdata.splitStatus
  561. });
  562. }
  563. }
  564. this.setState({
  565. dataSourceX: theArr
  566. });
  567. }.bind(this)
  568. });
  569. },
  570. search(obj) {
  571. this.setState(
  572. {
  573. searchData: obj
  574. },
  575. () => {
  576. this.loadData(1);
  577. }
  578. );
  579. },
  580. rizhi(orderNo) {
  581. $.ajax({
  582. method: "get",
  583. dataType: "json",
  584. crossDomain: false,
  585. url: "/api/admin/newOrder/selectOrderLog",
  586. data: {
  587. orderNo: orderNo
  588. },
  589. success: function (data) {
  590. let theArr = [];
  591. let thisData = data.data;
  592. if (!thisData.length) {
  593. if (data.error && data.error.length) {
  594. message.warning(data.error[0].message);
  595. }
  596. thisData = {};
  597. } else {
  598. for (let i = 0; i < data.data.length; i++) {
  599. let thisdata = data.data[i];
  600. theArr.push({
  601. processName: thisdata.processName,
  602. adminName: thisdata.adminName,
  603. createDate: thisdata.createDate,
  604. remarks: thisdata.remarks
  605. });
  606. }
  607. }
  608. this.setState({
  609. dataSourcerizhi: theArr
  610. });
  611. }.bind(this)
  612. });
  613. },
  614. getOrderLog(orderNo) {
  615. this.setState({
  616. rizhivisible: true
  617. });
  618. this.rizhi(orderNo);
  619. },
  620. closeOrderLog() {
  621. this.setState({
  622. rizhivisible: false
  623. });
  624. },
  625. //节点列表
  626. jiedian(orderNos) {
  627. $.ajax({
  628. method: "get",
  629. dataType: "json",
  630. crossDomain: false,
  631. url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",
  632. data: {
  633. orderNo: orderNos
  634. },
  635. success: function (data) {
  636. let theArr = [];
  637. let thisData = [];
  638. if (data.error.length || data.data.list == "") {
  639. if (data.error && data.error.length) {
  640. message.warning(data.error[0].message);
  641. }
  642. } else {
  643. for (let i = 0; i < data.data.length; i++) {
  644. thisData = data.data[i];
  645. theArr.push({
  646. key: i,
  647. dunSubject: thisData.dunSubject
  648. ? thisData.dunSubject.toString()
  649. : "", //催款科目
  650. id: thisData.id, //节点Id
  651. money: thisData.money, //催款金额
  652. dunStatus: thisData.dunStatus //催款状态
  653. });
  654. }
  655. this.setState({
  656. contactList: theArr
  657. });
  658. }
  659. }.bind(this)
  660. });
  661. },
  662. jiedianNew(orderNos) {
  663. $.ajax({
  664. method: "get",
  665. dataType: "json",
  666. crossDomain: false,
  667. url:
  668. globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
  669. data: {
  670. orderNo: orderNos
  671. },
  672. success: function (data) {
  673. if (data.error && data.error.length) {
  674. message.warning(data.error[0].message);
  675. } else {
  676. let theArr = [];
  677. let thisData = [];
  678. let arr = data.data || [];
  679. let totalCui = 0;
  680. for (let i = 0; i < arr.length; i++) {
  681. thisData = arr[i];
  682. totalCui += +thisData.money;
  683. theArr.push({
  684. key: i,
  685. dunSubject: thisData.dunSubject
  686. ? thisData.dunSubject.toString()
  687. : "", //催款科目
  688. id: thisData.id, //节点Id
  689. money: thisData.money, //催款金额
  690. // orderNo: record ? record.orderNo : this.props.datauser.orderNo,
  691. commodityName: thisData.commodityName,
  692. projectType: thisData.projectType,
  693. dunTypeName: thisData.dunTypeName,
  694. status: thisData.status,
  695. waitDay: thisData.waitDay,
  696. effectiveCount: thisData.effectiveCount,
  697. startDate: thisData.startDate,
  698. dunType: thisData.dunType,
  699. appropriationRatio: thisData.appropriationRatio,
  700. customizeName: thisData.customizeName,
  701. customizeTimes: thisData.customizeTimes,
  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. }
  820. }.bind(this)
  821. }).always(
  822. function () {
  823. this.setState({
  824. loading: false
  825. });
  826. }.bind(this)
  827. );
  828. },
  829. //点击拒绝
  830. examNo() {
  831. this.setState({
  832. noVisible: true
  833. });
  834. },
  835. loadDataChange(key) {
  836. $.ajax({
  837. method: "get",
  838. dataType: "json",
  839. async: false,
  840. crossDomain: false,
  841. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  842. data: {
  843. changeId: key
  844. },
  845. success: function (data) {
  846. if (data.error.length || data.data.list == "") {
  847. if (data.error && data.error.length) {
  848. message.warning(data.error[0].message);
  849. }
  850. } else {
  851. // console.log("拿到历史", data.data);
  852. this.setState({
  853. dataProps: data.data
  854. });
  855. }
  856. }.bind(this)
  857. });
  858. },
  859. callback(key) {
  860. this.setState(
  861. {
  862. activeKey: key
  863. },
  864. () => {
  865. if (key != "a" && key != "c" && key.length < 10) {
  866. this.ChangeDetail(key);
  867. this.loadDataChange(key);
  868. } else if (key != "a" && key != "c" && key.length > 10) {
  869. this.primaryOrder(key);
  870. this.xiangmu(key);
  871. this.jiedian(key);
  872. this.jiedianNew(key);
  873. this.loadDataChange(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. },
  1024. outReset() {
  1025. this.setState({
  1026. companyName: "",
  1027. amount: "",
  1028. unitPrice: "",
  1029. unitNumber: "",
  1030. outsourceRemarks: "",
  1031. attachmentUrl: [],
  1032. pictureUrl: []
  1033. });
  1034. },
  1035. getOrgCodeUrl(e) {
  1036. this.setState({ pictureUrl: e });
  1037. },
  1038. //关闭详情
  1039. visitCancel() {
  1040. this.setState(
  1041. {
  1042. activeKey: "a"
  1043. },
  1044. () => {
  1045. this.setState({
  1046. visible: false
  1047. });
  1048. }
  1049. );
  1050. this.loadData(this.state.pageNo);
  1051. },
  1052. visitOk() {
  1053. this.setState({
  1054. visible: false
  1055. });
  1056. },
  1057. createTabs() {
  1058. $.ajax({
  1059. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  1060. method: "get",
  1061. data: {
  1062. orderNo: this.state.orderNo
  1063. },
  1064. success: data => {
  1065. if (data.error && data.error.length) {
  1066. message.warning(data.error[0].message);
  1067. } else {
  1068. this.setState({
  1069. tabList: data.data
  1070. });
  1071. }
  1072. }
  1073. });
  1074. },
  1075. render() {
  1076. const tabList = this.state.tabList || [];
  1077. const formItemLayout = {
  1078. labelCol: { span: 8 },
  1079. wrapperCol: { span: 14 }
  1080. };
  1081. const FormItem = Form.Item;
  1082. const { TabPane } = Tabs;
  1083. return (
  1084. <div className="user-content">
  1085. <ShowModalDiv ShowModal={this.state.showModal} />
  1086. <div className="content-title">
  1087. <span>合同变更审核订单</span>
  1088. </div>
  1089. <div className="user-search">
  1090. <Tabs
  1091. defaultActiveKey="1"
  1092. onChange={this.callback}
  1093. className="test">
  1094. <TabPane tab="搜索" key="1">
  1095. <div style={{ marginLeft: 10 }}>
  1096. <SearchInput search={this.search} />
  1097. </div>
  1098. </TabPane>
  1099. </Tabs>
  1100. <div className="patent-table">
  1101. <Spin spinning={this.state.loading}>
  1102. <Table
  1103. size="small"
  1104. bordered
  1105. columns={this.state.columns}
  1106. dataSource={this.state.dataSource}
  1107. pagination={this.state.pagination}
  1108. onRowClick={this.tableRowClick}
  1109. />
  1110. </Spin>
  1111. </div>
  1112. <Modal
  1113. className="customeDetails"
  1114. footer=""
  1115. maskClosable={false}
  1116. width="900px"
  1117. visible={this.state.visible}
  1118. onOk={this.visitOk}
  1119. onCancel={this.visitCancel}
  1120. >
  1121. <Tabs
  1122. activeKey={this.state.activeKey}
  1123. onChange={this.callback}
  1124. type="card"
  1125. >
  1126. <TabPane tab="订单详情" key="a">
  1127. <Form
  1128. layout="horizontal"
  1129. onSubmit={this.handleSubmit}
  1130. id="demand-form"
  1131. style={{ paddingBottom: "40px" }}
  1132. >
  1133. <Spin spinning={this.state.loading}>
  1134. <OrderDetail
  1135. orderData={this.state.orderData}
  1136. getOrderLog={this.getOrderLog}
  1137. dataSourceX={this.state.dataSourceX}
  1138. contactList={this.state.contactList}
  1139. totalCui={this.state.totalCui}
  1140. contactListNew={this.state.contactListNew}
  1141. orderNo={this.state.orderNo}
  1142. />
  1143. </Spin>
  1144. </Form>
  1145. </TabPane>
  1146. {/* <TabPane tab="合同变更记录" key="2">
  1147. <ChangeDetail
  1148. data={this.state.contractData}
  1149. pictureUrl={this.state.voucherUrl}
  1150. processState={this.props.processState}
  1151. loadData={this.callback}
  1152. reset={this.state.visible}
  1153. dataSource={this.state.dataProps}
  1154. proceedsData={this.state.proceedsData}
  1155. proceedsTotal={this.state.proTotal}
  1156. invoiceTotal={this.state.invTotal}
  1157. contactList={this.state.refundInvoice}
  1158. onCancel={this.visitCancel}
  1159. />
  1160. </TabPane> */}
  1161. {tabList.map((item, index, arr) => {
  1162. return (
  1163. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1164. <ChangeDetail
  1165. id={item.id}
  1166. money={index == arr.length - 1 ? this.state.orderData.totalAmount + "" : undefined}
  1167. data={this.state.contractData}
  1168. pictureUrl={this.state.voucherUrl}
  1169. processState={this.props.processState}
  1170. loadData={this.callback}
  1171. reset={this.state.visible}
  1172. dataSource={this.state.dataProps}
  1173. proceedsData={this.state.proceedsData}
  1174. proceedsTotal={this.state.proTotal}
  1175. invoiceTotal={this.state.invTotal}
  1176. contactList={this.state.refundInvoice}
  1177. onCancel={this.visitCancel}
  1178. />
  1179. </TabPane>
  1180. );
  1181. })}
  1182. {/* {this.state.status === 4 ? (
  1183. <TabPane tab="原订单" key="3">
  1184. <Form
  1185. layout="horizontal"
  1186. onSubmit={this.handleSubmit}
  1187. id="demand-form"
  1188. style={{ paddingBottom: "40px" }}
  1189. >
  1190. <Spin spinning={this.state.loading}>
  1191. <OrderDetail
  1192. orderData={this.state.primaryOrderData}
  1193. getOrderLog={this.getOrderLog}
  1194. dataSourceX={this.state.dataSourceX}
  1195. contactList={this.state.contactList}
  1196. orderNo={this.state.primaryOrderNo}
  1197. totalCui={this.state.totalCui}
  1198. contactListNew={this.state.contactListNew}
  1199. />
  1200. </Spin>
  1201. </Form>
  1202. </TabPane>
  1203. ) : (
  1204. ""
  1205. )} */}
  1206. {tabList.map((item, index) => {
  1207. if (item.usedOrder) {
  1208. return (
  1209. <TabPane
  1210. tab={"原订单" + (index + 1)}
  1211. key={item.usedOrder}
  1212. >
  1213. <Form
  1214. layout="horizontal"
  1215. onSubmit={this.handleSubmit}
  1216. id="demand-form"
  1217. style={{ paddingBottom: "40px" }}
  1218. >
  1219. <Spin spinning={this.state.loading}>
  1220. <OrderDetail
  1221. orderData={this.state.primaryOrderData}
  1222. getOrderLog={this.getOrderLog}
  1223. dataSourceX={this.state.dataSourceX}
  1224. contactList={this.state.contactList}
  1225. orderNo={this.state.primaryOrderNo}
  1226. totalCui={this.state.totalCui}
  1227. contactListNew={this.state.contactListNew}
  1228. />
  1229. </Spin>
  1230. </Form>
  1231. </TabPane>
  1232. );
  1233. } else {
  1234. return "";
  1235. }
  1236. })}
  1237. {this.state.status === 4 && this.state.isAddition ? (
  1238. this.state.type === 4 || this.state.type === 5 ? (
  1239. <TabPane tab="附加订单" key="c">
  1240. <OrderDetail
  1241. orderData={this.state.additionalOrderData}
  1242. getOrderLog={this.getOrderLog}
  1243. dataSourceX={this.state.dataSourceX}
  1244. contactList={this.state.contactList}
  1245. orderNo={this.state.additionalOrder}
  1246. totalCui={this.state.totalCui}
  1247. contactListNew={this.state.contactListNew}
  1248. />
  1249. </TabPane>
  1250. ) : (
  1251. ""
  1252. )
  1253. ) : (
  1254. ""
  1255. )}
  1256. </Tabs>
  1257. </Modal>
  1258. <Modal
  1259. maskClosable={false}
  1260. visible={this.state.addnextVisible}
  1261. onOk={this.nextCancel}
  1262. onCancel={this.nextCancel}
  1263. confirmLoading={this.state.confirmLoading}
  1264. width="800px"
  1265. title={"项目任务详情"}
  1266. footer=""
  1267. className="admin-desc-content"
  1268. >
  1269. <Form layout="horizontal" id="demand-form">
  1270. <Spin spinning={this.state.loading}>
  1271. <div className="clearfix">
  1272. <FormItem
  1273. className="half-item"
  1274. {...formItemLayout}
  1275. label="项目名称"
  1276. >
  1277. <span>{this.state.commodityName}</span>
  1278. </FormItem>
  1279. <FormItem
  1280. className="half-item"
  1281. {...formItemLayout}
  1282. label="项目数量"
  1283. >
  1284. <span>{this.state.commodityQuantity}</span>
  1285. </FormItem>
  1286. <FormItem
  1287. className="half-item"
  1288. {...formItemLayout}
  1289. label="金额(万元)"
  1290. >
  1291. <span>{this.state.commodityPrice}</span>
  1292. </FormItem>
  1293. <FormItem
  1294. className="half-item"
  1295. {...formItemLayout}
  1296. label="主要项目"
  1297. >
  1298. <span>{getboutique(this.state.main)}</span>
  1299. </FormItem>
  1300. <div className="clearfix">
  1301. <FormItem
  1302. labelCol={{ span: 4 }}
  1303. wrapperCol={{ span: 16 }}
  1304. label="服务说明"
  1305. >
  1306. <span>{this.state.taskComment}</span>
  1307. </FormItem>
  1308. </div>
  1309. </div>
  1310. </Spin>
  1311. </Form>
  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. </div>
  1394. );
  1395. }
  1396. })
  1397. );
  1398. export default contractChange;