changeDetailYxy.js 19 KB

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