contractYxjl.js 46 KB

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