contractCwzj.js 44 KB

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