contractJszj.js 42 KB

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