contractCwzj.js 46 KB

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