changeDetailYxy.js 19 KB

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