contractJszj.js 46 KB

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