changeDetailYxy.js 22 KB

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