changeDetailYxy.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. import React, { Component } from "react";
  2. import { Form, Tooltip, Modal, Button, message, Table, Input } from "antd";
  3. import AgreeButton from "./agreeButton.js";
  4. import Rizhi from "./rizhi.js";
  5. import { getProcessStatusNew, changeColor } from "@/tools.js";
  6. import { shenghePeo } from "@/tools.js";
  7. import $ from "jquery/src/ajax";
  8. import tongguo from "../../../../../../image/tongguo.png";
  9. import quxiao from "../../../../../../image/quxiao.png";
  10. import ProAndCuiList from "./proAndCuiList.jsx";
  11. import Refund from "./refund.js"
  12. import ReactToPrint from "react-to-print";
  13. import ImgList from "../../../../common/imgList";
  14. import EnterpriseNameChange from "../../../../common/enterpriseNameChange";
  15. const formItemLayout = {
  16. labelCol: { span: 8 },
  17. wrapperCol: { span: 14 }
  18. };
  19. const changeType = [
  20. {
  21. value: "0",
  22. key: "退单退款"
  23. },
  24. {
  25. value: "1",
  26. key: "项目及金额变更"
  27. },
  28. {
  29. value: "2",
  30. key: "仅项目变更"
  31. },
  32. {
  33. value: "3",
  34. key: "仅金额变更"
  35. },
  36. {
  37. value: "4",
  38. key: "重报"
  39. },
  40. {
  41. value: "5",
  42. key: "赠送"
  43. }
  44. ];
  45. const getChangeType = function (e) {
  46. if (e || e == 0) {
  47. let str = e.toString();
  48. let theType = "";
  49. changeType.map(function (item) {
  50. if (item.value == str) {
  51. theType = item.key;
  52. }
  53. });
  54. return theType;
  55. }
  56. };
  57. class Itemlist extends Component {
  58. constructor(props) {
  59. super(props);
  60. }
  61. render() {
  62. let pageData = this.props.pageData;
  63. return (
  64. <div className="clearfix" style={{ height: "30px", overflow: "hidden" }}>
  65. {pageData.labelA === '当前进度' || pageData.labelA === '变更原因' ? <Form.Item
  66. label={pageData.labelA}
  67. {...pageData.formItemLayoutA}
  68. className="half-item"
  69. >
  70. <Tooltip placement="topLeft" title={pageData.dataA}>
  71. <div style={{
  72. width: '350px !important',
  73. whiteSpace: 'nowrap',
  74. wordBreak: 'break-all',
  75. overflow: 'hidden',
  76. textOverflow: 'ellipsis',
  77. }}>{pageData.dataA}</div>
  78. </Tooltip>
  79. </Form.Item> : <Form.Item
  80. label={pageData.labelA}
  81. {...pageData.formItemLayoutA}
  82. className="half-item"
  83. >
  84. <div>
  85. {pageData.dataA}
  86. {pageData.labelA === '客户名称' ?
  87. <EnterpriseNameChange
  88. type='journal'
  89. style={{ marginLeft: 10 }}
  90. enterpriseId={this.props.orderUid}/> : null
  91. }
  92. </div>
  93. </Form.Item>}
  94. <Form.Item
  95. label={pageData.labelB}
  96. {...pageData.formItemLayoutB}
  97. className="half-item"
  98. >
  99. <span>{pageData.dataB}</span>
  100. </Form.Item>
  101. </div>
  102. );
  103. }
  104. }
  105. class ChangeDetail extends Component {
  106. constructor(props) {
  107. super(props);
  108. this.state = {
  109. rotateDeg: 0,
  110. previewVisible: false,
  111. dataSource: [],
  112. // 累计回收退票
  113. refundInvoice: 0,
  114. // 退票数组
  115. contactList: [],
  116. rejectState: 0,
  117. // 收款信息
  118. proceedsData: [],
  119. proceedsTotal: this.props.proceedsTotal,
  120. // 开票信息
  121. invoiceData: [],
  122. invoiceTotal: this.props.invoiceTotal,
  123. cost: 10,
  124. refund: 8,
  125. // 测试添加退票
  126. contactList: this.props.contactList,
  127. ContactsLists: [
  128. {
  129. title: "金额(万元)",
  130. dataIndex: "amount",
  131. key: "amount",
  132. render: (text, record) => {
  133. return (
  134. <div>
  135. 实际回收退票(万元)
  136. <Input
  137. value={record.amount}
  138. placeholder="请输入金额(必填项)"
  139. disabled={record.load}
  140. key={record.id}
  141. required="required"
  142. onChange={e => {
  143. record.amount = e.target.value;
  144. this.setState({ contactList: this.state.contactList });
  145. }}
  146. style={{ width: "120px" }}
  147. />
  148. </div>
  149. );
  150. }
  151. },
  152. {
  153. title: "时间",
  154. dataIndex: "createTimes",
  155. key: "createTimes",
  156. render: (text, record) => {
  157. return <div>{record.createTimes}</div>;
  158. }
  159. }
  160. ]
  161. };
  162. this.getOrgCodeUrl = this.getOrgCodeUrl.bind(this);
  163. this.downImg = this.downImg.bind(this);
  164. this.upImg = this.upImg.bind(this);
  165. this.rotate = this.rotate.bind(this);
  166. this.moneyOld = this.moneyOld.bind(this);
  167. }
  168. getOrgCodeUrl(e) {
  169. this.setState({
  170. orgCodeUrl: e
  171. });
  172. }
  173. componentDidMount() { }
  174. // loadData() {
  175. // $.ajax({
  176. // method: "get",
  177. // dataType: "json",
  178. // async: false,
  179. // crossDomain: false,
  180. // url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  181. // data: {
  182. // changeId: this.props.data.id
  183. // },
  184. // success: function(data) {
  185. // if (data.error.length || data.data.list == "") {
  186. // if (data.error && data.error.length) {
  187. // message.warning(data.error[0].message);
  188. // }
  189. // } else {
  190. // this.setState({
  191. // dataSource: data.data
  192. // });
  193. // }
  194. // }.bind(this)
  195. // });
  196. // }
  197. componentWillReceiveProps(nextProps) {
  198. this.setState({
  199. paymentTimes: nextProps.data.paymentTimes,
  200. paymentAmount: nextProps.data.paymentAmount,
  201. invoiceTimes: nextProps.data.invoiceTimes,
  202. invoiceAmount: nextProps.data.invoiceAmount,
  203. cwCost: nextProps.data.cwCost,
  204. refundableAmount: nextProps.data.refundableAmount,
  205. cwRemarks: nextProps.data.cwRemarks,
  206. contactList: nextProps.contactList,
  207. refundInvoice: nextProps.data.refundInvoice
  208. });
  209. }
  210. downImg() {
  211. let num = 0;
  212. for (let i = 0; i < this.props.pictureUrl.length; i++) {
  213. if (this.props.pictureUrl[i].url == this.state.previewImage) {
  214. num = i;
  215. }
  216. }
  217. if (num == this.props.pictureUrl.length - 1) {
  218. return message.warning("已经是最后一张了哦");
  219. }
  220. this.state.previewImage = this.props.pictureUrl[num + 1].url;
  221. this.setState({
  222. previewImage: this.state.previewImage,
  223. rotateDeg: 0
  224. });
  225. }
  226. upImg() {
  227. let num = 0;
  228. for (let i = 0; i < this.props.pictureUrl.length; i++) {
  229. if (this.props.pictureUrl[i].url == this.state.previewImage) {
  230. num = i;
  231. }
  232. }
  233. if (num == 0) {
  234. return message.warning("已经是第一张了哦");
  235. }
  236. this.state.previewImage = this.props.pictureUrl[num - 1].url;
  237. this.setState({
  238. previewImage: this.state.previewImage,
  239. rotateDeg: 0
  240. });
  241. }
  242. rotate() {
  243. let rotateDeg = this.state.rotateDeg + 90;
  244. this.setState({
  245. rotateDeg
  246. });
  247. }
  248. moneyOld(str, money) {
  249. if (money) {
  250. return (
  251. <span style={{ color: "red", fontWeight: 900, fontSize: 16 }}>
  252. {str}(原合同金额{money}万元)
  253. </span>
  254. );
  255. } else {
  256. return (
  257. <span style={{ color: "red", fontWeight: 900, fontSize: 16 }}>
  258. {str}
  259. </span>
  260. );
  261. }
  262. }
  263. render() {
  264. // const loadData = [
  265. // {
  266. // labelA: "",
  267. // formItemLayoutA: formItemLayout,
  268. // dataA
  269. // }
  270. // ];
  271. const pageData = [
  272. {
  273. labelA: "客户名称",
  274. formItemLayoutA: formItemLayout,
  275. dataA: this.props.data.userName,
  276. labelB: "合同编号",
  277. formItemLayoutB: formItemLayout,
  278. dataB: this.props.data.contractNo
  279. },
  280. {
  281. labelA: "时间",
  282. formItemLayoutA: formItemLayout,
  283. dataA: this.props.data.createTimes,
  284. labelB: "发起人",
  285. formItemLayoutB: formItemLayout,
  286. dataB: this.props.data.applicant
  287. },
  288. {
  289. labelA: "当前进度",
  290. formItemLayoutA: formItemLayout,
  291. // 当前是咨询师以及咨询师经理时使用shenhePeo函数,其他流程正常显示
  292. dataA:
  293. this.props.data.processState == 2 || this.props.data.processState == 3
  294. ? shenghePeo(
  295. this.props.data.processState == 2
  296. ? this.props.data.consultantExamine
  297. : this.props.data.managerExamine,
  298. this.props.data.processState
  299. )
  300. : getProcessStatusNew(
  301. this.props.data.processState,
  302. this.props.data.status
  303. ),
  304. labelB: "变更类型",
  305. formItemLayoutB: formItemLayout,
  306. dataB: getChangeType(this.props.data.type)
  307. },
  308. {
  309. labelA: "合同额(万元)",
  310. formItemLayoutA: formItemLayout,
  311. dataA: this.moneyOld(this.props.data.totalAmount, this.props.money),
  312. labelB: "已收款(万元)",
  313. formItemLayoutB: formItemLayout,
  314. dataB: changeColor(this.props.data.settlementAmount)
  315. },
  316. {
  317. labelA: "欠款(万元)",
  318. formItemLayoutA: formItemLayout,
  319. dataA: changeColor(this.props.data.arrears),
  320. labelB: "申请退款(万元)",
  321. formItemLayoutB: formItemLayout,
  322. dataB: changeColor(this.props.data.changeAmount)
  323. },
  324. {
  325. labelA: "变更原因",
  326. formItemLayoutA: formItemLayout,
  327. dataA: this.props.data.remarks
  328. }
  329. ];
  330. const planData = [
  331. {
  332. labelA: "项目进度",
  333. formItemLayoutA: formItemLayout,
  334. dataA: this.props.data.projectState,
  335. labelB: "发生成本费用(万元)",
  336. formItemLayoutB: formItemLayout,
  337. dataB: this.props.data.zxsCost
  338. },
  339. {
  340. labelA: "备注",
  341. formItemLayoutA: formItemLayout,
  342. dataA: this.props.data.zxsRemarks
  343. }
  344. ];
  345. const financeData = [
  346. {
  347. labelA: "发生成本(万元)",
  348. formItemLayoutA: formItemLayout,
  349. dataA: this.props.data.cwCost,
  350. labelB: "应退金额(万元)",
  351. formItemLayoutB: formItemLayout,
  352. dataB: this.props.data.refundableAmount
  353. }
  354. ];
  355. const buttonData = [
  356. {
  357. name: "同意",
  358. title: "理由",
  359. placeholder: "请输入理由",
  360. type: "primary",
  361. status: 2,
  362. onChange: value => {
  363. this.setState({
  364. remarks: value
  365. });
  366. }
  367. },
  368. {
  369. name: "拒绝",
  370. title: "理由",
  371. placeholder: "请输入理由",
  372. type: "danger",
  373. status: 3,
  374. onChange: value => {
  375. this.setState({
  376. remarks: value
  377. });
  378. }
  379. }
  380. ];
  381. const orgCodeUrl = this.props.pictureUrl;
  382. return (
  383. <div className="clearfix changeDetail">
  384. <div
  385. className="clearfix"
  386. style={{ marginTop: 0 }}
  387. ref={(e) => {
  388. this.refs = e;
  389. }}
  390. >
  391. <div
  392. style={{
  393. borderRadius: "50%",
  394. width: 300,
  395. height: 300,
  396. position: "absolute",
  397. top: 230,
  398. left: 525,
  399. transform: "rotate(-5deg)",
  400. zIndex: 1,
  401. display:
  402. (this.props.data.processState == 7 ||
  403. this.props.data.processState == 8) &&
  404. this.props.data.status == 4
  405. ? "block"
  406. : "none",
  407. }}
  408. >
  409. {/* <span
  410. style={{
  411. fontSize: 29,
  412. position: "absolute",
  413. left: "50%",
  414. top: "50%",
  415. transform: "translate(-50%,-50%)",
  416. color: "red"
  417. }}
  418. >
  419. 通过
  420. </span> */}
  421. <img src={tongguo} style={{ width: "100%" }} />
  422. </div>
  423. <div
  424. style={{
  425. borderRadius: "50%",
  426. width: 300,
  427. height: 300,
  428. position: "absolute",
  429. top: 284,
  430. left: 586,
  431. transform: "rotate(-5deg)",
  432. zIndex: 1,
  433. display: this.props.data.status == 5 ? "block" : "none",
  434. }}
  435. >
  436. {/* <span
  437. style={{
  438. fontSize: 29,
  439. position: "absolute",
  440. left: "50%",
  441. top: "50%",
  442. transform: "translate(-50%,-50%)",
  443. color: "red"
  444. }}
  445. >
  446. 通过
  447. </span> */}
  448. <img src={quxiao} style={{ width: "63%" }} />
  449. </div>
  450. <h2 style={{ textAlign: "center", marginBottom: 10, marginTop: 20 }}>
  451. 合同变更记录
  452. </h2>
  453. {pageData.map((item, index) => {
  454. return <Itemlist key={index} pageData={item} orderUid={this.props.orderUid}/>;
  455. })}
  456. <Form.Item
  457. label="变更凭证"
  458. labelCol={{ span: 4 }}
  459. wrapperCol={{ span: 18 }}
  460. >
  461. {orgCodeUrl ? <div style={{paddingTop:'10px',paddingBottom:'10px'}}>
  462. <ImgList domId={this.props.domId ? this.props.domId+'1' : 'changeDetailYxy1'} fileList={orgCodeUrl} ItemWidth={'96px'}/>
  463. </div> : <div/>}
  464. <div style={{marginLeft: '-60px'}}>
  465. <Rizhi changeId={this.props.id} />
  466. </div>
  467. </Form.Item>
  468. {/* {this.props.data.type === 0 && this.props.data.processState >= 2 ? (
  469. <div>
  470. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  471. 当前项目进度(咨询师经理填写)
  472. </h3>
  473. {planData.map((item, index) => {
  474. return <Itemlist key={index} pageData={item} />;
  475. })}
  476. </div>
  477. ) : (
  478. ""
  479. )} */}
  480. {/* <h2 style={{ textAlign: "center", marginBottom: 0 }}>变更日志</h2> */}
  481. <ul
  482. style={{
  483. width: "868px",
  484. overflow: "hidden",
  485. paddingLeft: "90px",
  486. position: "relative",
  487. bottom: "20px",
  488. paddingTop: '28px'
  489. }}
  490. >
  491. {/* <span>操作人:</span> */}
  492. {this.props.dataSource.map((item, index) => {
  493. if (item.status == 0) {
  494. item.status = "发起";
  495. } else if (item.status == 1) {
  496. item.status = "审核中";
  497. } else if (item.status == 2) {
  498. item.status = "通过";
  499. } else if (item.status == 3) {
  500. item.status = "驳回";
  501. } else if (item.status == 4) {
  502. item.status = "完成";
  503. }
  504. return (
  505. <li
  506. key={index}
  507. style={{
  508. width: "100%",
  509. height: "auto",
  510. wordBreak: "break-all",
  511. marginBottom: "10px",
  512. }}
  513. >
  514. {item.aname + ":" + "(" + item.status + ")" + item.remarks}
  515. </li>
  516. );
  517. })}
  518. </ul>
  519. <ProAndCuiList id={this.props.id} />
  520. <div className="clearfix">
  521. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  522. 收款情况
  523. </h3>
  524. <div style={{ marginLeft: "90px" }}>
  525. <ul>
  526. {(this.props.proceedsData.bill || []).map((item, index) => (
  527. <li key={index}>
  528. {item.payTime +
  529. " " +
  530. item.aName +
  531. " 收款:" +
  532. item.transactionAmount +
  533. "万元"}
  534. </li>
  535. ))}
  536. </ul>
  537. <div>收款总计:{this.props.proceedsTotal}万元</div>
  538. </div>
  539. <br />
  540. <div style={{ marginLeft: "90px" }}>
  541. <ul>
  542. {(this.props.proceedsData.invoice || []).map((item, index) => (
  543. <li key={index}>
  544. {item.createTime + " " + " 开票:" + item.amount + "万元"}
  545. </li>
  546. ))}
  547. </ul>
  548. <div>开票总计:{this.props.invoiceTotal}万元</div>
  549. </div>
  550. <p style={{ marginLeft: "90px", color: "red" }}>
  551. 系统预估 产生成本(万元):
  552. {this.props.data.estimateCost
  553. ? this.props.data.estimateCost
  554. : "0"}{" "}
  555. &nbsp;应退金额(万元):
  556. {this.props.data.estimateRefundable
  557. ? this.props.data.estimateRefundable
  558. : "0"}
  559. </p>
  560. </div>
  561. {/* {this.props.data.type === 0 ? (
  562. <div>
  563. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  564. 当前项目进度(咨询师经理填写)
  565. </h3>
  566. {planData.map((item, index) => {
  567. return <Itemlist key={index} pageData={item} />;
  568. })}
  569. </div>
  570. ) : (
  571. ""
  572. )} */}
  573. <div
  574. style={{
  575. display:
  576. (this.props.data.processState == 8 ||
  577. this.props.data.processState == 7) &&
  578. (this.props.data.status == 2 || this.props.data.status == 4)
  579. ? "block"
  580. : "none",
  581. }}
  582. >
  583. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  584. 回收退票
  585. </h3>
  586. <Table
  587. size="middle"
  588. pagination={false}
  589. bordered
  590. columns={this.state.ContactsLists}
  591. dataSource={this.state.contactList}
  592. />
  593. </div>
  594. <div
  595. style={{
  596. display: this.props.data.processState > 5 ? "block" : "none",
  597. }}
  598. >
  599. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  600. 当前财务状态(财务填写)
  601. </h3>
  602. {financeData.map((item, index) => {
  603. return <Itemlist key={index} pageData={item} orderUid={this.props.orderUid}/>;
  604. })}
  605. </div>
  606. {/* <ul>
  607. <span>备注</span>
  608. {this.state.dataSource.map((item, index) => (
  609. <li key={index}>{item.remarks}</li>
  610. ))}
  611. </ul> */}
  612. {/* {this.props.data.type === 0 ? (
  613. this.props.data.processState >= 5 ? (
  614. <div style={{ marginTop: "20px" }}>
  615. <h3
  616. style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}
  617. >
  618. 当前财务状态(财务填写)
  619. </h3>
  620. {financeData.map((item, index) => {
  621. return <Itemlist key={index} pageData={item} />;
  622. })}
  623. </div>
  624. ) : (
  625. ""
  626. )
  627. ) : this.props.data.status === 4 ? (
  628. <div>
  629. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  630. 当前财务状态(财务填写)
  631. </h3>
  632. {financeData.map((item, index) => {
  633. return <Itemlist key={index} pageData={item} />;
  634. })}
  635. </div>
  636. ) : (
  637. ""
  638. )} */}
  639. <div
  640. style={{
  641. display:
  642. (this.props.data.processState == 7 ||
  643. this.props.data.processState == 8) &&
  644. this.props.data.status == 4 &&
  645. this.props.data.refundStatus
  646. ? "block"
  647. : "none",
  648. }}
  649. >
  650. <Refund data={this.props.data} id={this.props.id} />
  651. </div>
  652. </div>
  653. {this.props.processState === this.props.data.processState &&
  654. this.props.data.status != 5 ? (
  655. <div
  656. className="clearfix"
  657. style={{ display: "flex", justifyContent: "space-around" }}
  658. >
  659. {buttonData.map((item, index) => {
  660. return (
  661. <AgreeButton
  662. data={item}
  663. key={index}
  664. backData={this.props.data}
  665. processState={this.props.processState}
  666. onCancel={this.props.onCancel}
  667. />
  668. );
  669. })}
  670. </div>
  671. ) : (
  672. ""
  673. )}
  674. <ReactToPrint
  675. trigger={() => (
  676. <Button
  677. type="primary"
  678. style={{
  679. float: "right",
  680. marginTop: 10,
  681. position: "absolute",
  682. top: 0,
  683. right: 30,
  684. display:
  685. (this.props.data.processState == 7 ||
  686. this.props.data.processState == 8) &&
  687. this.props.data.status == 4
  688. ? "block"
  689. : "block",
  690. }}
  691. >
  692. 打印
  693. </Button>
  694. )}
  695. content={() => this.refs}
  696. />
  697. </div>
  698. );
  699. }
  700. }
  701. export { ChangeDetail };