changeDetailYxy.js 19 KB

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