contractJsy.js 41 KB

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