contractCwzj.js 43 KB

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