contractYxgly.js 39 KB

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