contractJsjl.js 43 KB

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