contractYxgly.js 44 KB

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