changeDetailYxy.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  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. visible={this.state.previewVisible}
  452. onCancel={() => {
  453. this.setState({ previewVisible: false });
  454. }}
  455. >
  456. <img
  457. alt=""
  458. style={{
  459. width: "100%",
  460. transform: `rotate(${this.state.rotateDeg}deg)`,
  461. }}
  462. src={this.state.previewImage || ""}
  463. />
  464. <Button onClick={this.rotate}>旋转</Button>
  465. <Button onClick={this.upImg}>上一张</Button>
  466. <Button onClick={this.downImg}>下一张</Button>
  467. </Modal>
  468. <Rizhi changeId={this.props.id} />
  469. </Form.Item>
  470. {/* {this.props.data.type === 0 && this.props.data.processState >= 2 ? (
  471. <div>
  472. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  473. 当前项目进度(咨询师经理填写)
  474. </h3>
  475. {planData.map((item, index) => {
  476. return <Itemlist key={index} pageData={item} />;
  477. })}
  478. </div>
  479. ) : (
  480. ""
  481. )} */}
  482. {/* <h2 style={{ textAlign: "center", marginBottom: 0 }}>变更日志</h2> */}
  483. <ul
  484. style={{
  485. width: "868px",
  486. overflow: "hidden",
  487. paddingLeft: "90px",
  488. position: "relative",
  489. bottom: "20px",
  490. }}
  491. >
  492. {/* <span>操作人:</span> */}
  493. {this.props.dataSource.map((item, index) => {
  494. if (item.status == 0) {
  495. item.status = "发起";
  496. } else if (item.status == 1) {
  497. item.status = "审核中";
  498. } else if (item.status == 2) {
  499. item.status = "通过";
  500. } else if (item.status == 3) {
  501. item.status = "驳回";
  502. } else if (item.status == 4) {
  503. item.status = "完成";
  504. }
  505. return (
  506. <li
  507. key={index}
  508. style={{
  509. width: "100%",
  510. height: "auto",
  511. wordBreak: "break-all",
  512. marginBottom: "10px",
  513. }}
  514. >
  515. {item.aname + ":" + "(" + item.status + ")" + item.remarks}
  516. </li>
  517. );
  518. })}
  519. </ul>
  520. <ProAndCuiList id={this.props.id} />
  521. <div className="clearfix">
  522. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  523. 收款情况
  524. </h3>
  525. <div style={{ marginLeft: "90px" }}>
  526. <ul>
  527. {(this.props.proceedsData.bill || []).map((item, index) => (
  528. <li key={index}>
  529. {item.payTime +
  530. " " +
  531. item.aName +
  532. " 收款:" +
  533. item.transactionAmount +
  534. "万元"}
  535. </li>
  536. ))}
  537. </ul>
  538. <div>收款总计:{this.props.proceedsTotal}万元</div>
  539. </div>
  540. <br />
  541. <div style={{ marginLeft: "90px" }}>
  542. <ul>
  543. {(this.props.proceedsData.invoice || []).map((item, index) => (
  544. <li key={index}>
  545. {item.createTime + " " + " 开票:" + item.amount + "万元"}
  546. </li>
  547. ))}
  548. </ul>
  549. <div>开票总计:{this.props.invoiceTotal}万元</div>
  550. </div>
  551. <p style={{ marginLeft: "90px", color: "red" }}>
  552. 系统预估 产生成本(万元):
  553. {this.props.data.estimateCost
  554. ? this.props.data.estimateCost
  555. : "0"}{" "}
  556. &nbsp;应退金额(万元):
  557. {this.props.data.estimateRefundable
  558. ? this.props.data.estimateRefundable
  559. : "0"}
  560. </p>
  561. </div>
  562. {/* {this.props.data.type === 0 ? (
  563. <div>
  564. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  565. 当前项目进度(咨询师经理填写)
  566. </h3>
  567. {planData.map((item, index) => {
  568. return <Itemlist key={index} pageData={item} />;
  569. })}
  570. </div>
  571. ) : (
  572. ""
  573. )} */}
  574. <div
  575. style={{
  576. display:
  577. (this.props.data.processState == 8 ||
  578. this.props.data.processState == 7) &&
  579. (this.props.data.status == 2 || this.props.data.status == 4)
  580. ? "block"
  581. : "none",
  582. }}
  583. >
  584. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  585. 回收退票
  586. </h3>
  587. <Table
  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} />;
  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 };