changeDetailYxgly.js 22 KB

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