changeDetailYxgly.js 22 KB

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