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