changeDetailYxgly.js 22 KB

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