contractJsjl.js 45 KB

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