contractJsy.js 41 KB

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