contractJsy.js 42 KB

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