contractJszj.js 45 KB

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