contractYxgly.js 43 KB

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