changeDetailYxy.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  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: 0 }}>合同变更记录</h2>
  383. {pageData.map((item, index) => {
  384. return <Itemlist key={index} pageData={item} />;
  385. })}
  386. <Form.Item
  387. label="变更凭证"
  388. labelCol={{ span: 4 }}
  389. wrapperCol={{ span: 18 }}
  390. >
  391. <Upload
  392. className="demandDetailShow-upload"
  393. listType="picture-card"
  394. fileList={orgCodeUrl}
  395. onPreview={file => {
  396. console.log(file);
  397. console.log(this.props.pictureUrl);
  398. this.setState({
  399. previewImage: file.url || file.thumbUrl,
  400. previewVisible: true
  401. });
  402. }}
  403. />
  404. <Modal
  405. maskClosable={false}
  406. footer={null}
  407. visible={this.state.previewVisible}
  408. onCancel={() => {
  409. this.setState({ previewVisible: false });
  410. }}
  411. >
  412. <img
  413. alt=""
  414. style={{
  415. width: "100%",
  416. transform: `rotate(${this.state.rotateDeg}deg)`
  417. }}
  418. src={this.state.previewImage || ""}
  419. />
  420. <Button onClick={this.rotate}>旋转</Button>
  421. <Button onClick={this.upImg}>上一张</Button>
  422. <Button onClick={this.downImg}>下一张</Button>
  423. </Modal>
  424. <Rizhi changeId={this.props.data.id} />
  425. </Form.Item>
  426. {/* {this.props.data.type === 0 && this.props.data.processState >= 2 ? (
  427. <div>
  428. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  429. 当前项目进度(咨询师经理填写)
  430. </h3>
  431. {planData.map((item, index) => {
  432. return <Itemlist key={index} pageData={item} />;
  433. })}
  434. </div>
  435. ) : (
  436. ""
  437. )} */}
  438. {/* <h2 style={{ textAlign: "center", marginBottom: 0 }}>变更日志</h2> */}
  439. <ul
  440. style={{
  441. width: "868px",
  442. overflow: "hidden",
  443. paddingLeft: "90px",
  444. position: "relative",
  445. bottom: "20px"
  446. }}
  447. >
  448. {/* <span>操作人:</span> */}
  449. {this.props.dataSource.map((item, index) => {
  450. if (item.status == 0) {
  451. item.status = "发起";
  452. } else if (item.status == 1) {
  453. item.status = "审核中";
  454. } else if (item.status == 2) {
  455. item.status = "通过";
  456. } else if (item.status == 3) {
  457. item.status = "驳回";
  458. } else if (item.status == 4) {
  459. item.status = "完成";
  460. }
  461. return (
  462. <li
  463. key={index}
  464. style={{
  465. width: "100%",
  466. height: "auto",
  467. wordBreak: "break-all",
  468. marginBottom: "10px"
  469. }}
  470. >
  471. {item.aname + ":" + "(" + item.status + ")" + item.remarks}
  472. </li>
  473. );
  474. })}
  475. </ul>
  476. <div className="clearfix">
  477. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  478. 收款情况
  479. </h3>
  480. <div style={{ marginLeft: "90px" }}>
  481. <ul>
  482. {(this.props.proceedsData.bill || []).map((item, index) => (
  483. <li key={index}>
  484. {item.payTime +
  485. " " +
  486. item.aName +
  487. " 收款:" +
  488. item.transactionAmount +
  489. "万元"}
  490. </li>
  491. ))}
  492. </ul>
  493. <div>收款总计:{this.props.proceedsTotal}万元</div>
  494. </div>
  495. <br />
  496. <div style={{ marginLeft: "90px" }}>
  497. <ul>
  498. {(this.props.proceedsData.invoice || []).map((item, index) => (
  499. <li key={index}>
  500. {item.createTime + " " + " 开票:" + item.amount + "万元"}
  501. </li>
  502. ))}
  503. </ul>
  504. <div>开票总计:{this.props.invoiceTotal}万元</div>
  505. </div>
  506. <p style={{ marginLeft: "90px", color: "red" }}>
  507. 系统预估 产生成本(万元):
  508. {this.props.data.estimateCost
  509. ? this.props.data.estimateCost
  510. : "0"}{" "}
  511. &nbsp;应退金额(万元):
  512. {this.props.data.estimateRefundable
  513. ? this.props.data.estimateRefundable
  514. : "0"}
  515. </p>
  516. </div>
  517. {/* {this.props.data.type === 0 ? (
  518. <div>
  519. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  520. 当前项目进度(咨询师经理填写)
  521. </h3>
  522. {planData.map((item, index) => {
  523. return <Itemlist key={index} pageData={item} />;
  524. })}
  525. </div>
  526. ) : (
  527. ""
  528. )} */}
  529. <div
  530. style={{
  531. display:
  532. (this.props.data.processState == 8 ||
  533. this.props.data.processState == 7) &&
  534. (this.props.data.status == 2 || this.props.data.status == 4)
  535. ? "block"
  536. : "none"
  537. }}
  538. >
  539. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  540. 回收退票
  541. </h3>
  542. <Table
  543. pagination={false}
  544. bordered
  545. columns={this.state.ContactsLists}
  546. dataSource={this.state.contactList}
  547. />
  548. </div>
  549. <div
  550. style={{
  551. display: this.props.data.processState > 5 ? "block" : "none"
  552. }}
  553. >
  554. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  555. 当前财务状态(财务填写)
  556. </h3>
  557. {financeData.map((item, index) => {
  558. return <Itemlist key={index} pageData={item} />;
  559. })}
  560. </div>
  561. {/* <ul>
  562. <span>备注</span>
  563. {this.state.dataSource.map((item, index) => (
  564. <li key={index}>{item.remarks}</li>
  565. ))}
  566. </ul> */}
  567. {/* {this.props.data.type === 0 ? (
  568. this.props.data.processState >= 5 ? (
  569. <div style={{ marginTop: "20px" }}>
  570. <h3
  571. style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}
  572. >
  573. 当前财务状态(财务填写)
  574. </h3>
  575. {financeData.map((item, index) => {
  576. return <Itemlist key={index} pageData={item} />;
  577. })}
  578. </div>
  579. ) : (
  580. ""
  581. )
  582. ) : this.props.data.status === 4 ? (
  583. <div>
  584. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  585. 当前财务状态(财务填写)
  586. </h3>
  587. {financeData.map((item, index) => {
  588. return <Itemlist key={index} pageData={item} />;
  589. })}
  590. </div>
  591. ) : (
  592. ""
  593. )} */}
  594. </div>
  595. {this.props.processState === this.props.data.processState ? (
  596. <div
  597. className="clearfix"
  598. style={{ display: "flex", justifyContent: "space-around" }}
  599. >
  600. {buttonData.map((item, index) => {
  601. return (
  602. <AgreeButton
  603. data={item}
  604. key={index}
  605. backData={this.props.data}
  606. processState={this.props.processState}
  607. onCancel={this.props.onCancel}
  608. />
  609. );
  610. })}
  611. </div>
  612. ) : (
  613. ""
  614. )}
  615. {/* <ReactToPrint
  616. trigger={() => (
  617. <div className="clearfix">
  618. <Button type="primary" style={{ float: "right", marginTop: 10 }}>
  619. 打印
  620. </Button>
  621. </div>
  622. )}
  623. content={() => this.refs}
  624. /> */}
  625. </div>
  626. );
  627. }
  628. }
  629. export { ChangeDetail };