contractJsjl.js 46 KB

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