changeDetailYxy.js 21 KB

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