contractJsy.js 40 KB

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