changeDetailYxy.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  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 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. }
  141. getOrgCodeUrl(e) {
  142. this.setState({
  143. orgCodeUrl: e
  144. });
  145. }
  146. componentDidMount() {
  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. 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. <ProAndCuiList id={this.props.id}/>
  477. <div className="clearfix">
  478. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  479. 收款情况
  480. </h3>
  481. <div style={{ marginLeft: "90px" }}>
  482. <ul>
  483. {(this.props.proceedsData.bill || []).map((item, index) => (
  484. <li key={index}>
  485. {item.payTime +
  486. " " +
  487. item.aName +
  488. " 收款:" +
  489. item.transactionAmount +
  490. "万元"}
  491. </li>
  492. ))}
  493. </ul>
  494. <div>收款总计:{this.props.proceedsTotal}万元</div>
  495. </div>
  496. <br />
  497. <div style={{ marginLeft: "90px" }}>
  498. <ul>
  499. {(this.props.proceedsData.invoice || []).map((item, index) => (
  500. <li key={index}>
  501. {item.createTime + " " + " 开票:" + item.amount + "万元"}
  502. </li>
  503. ))}
  504. </ul>
  505. <div>开票总计:{this.props.invoiceTotal}万元</div>
  506. </div>
  507. <p style={{ marginLeft: "90px", color: "red" }}>
  508. 系统预估 产生成本(万元):
  509. {this.props.data.estimateCost
  510. ? this.props.data.estimateCost
  511. : "0"}{" "}
  512. &nbsp;应退金额(万元):
  513. {this.props.data.estimateRefundable
  514. ? this.props.data.estimateRefundable
  515. : "0"}
  516. </p>
  517. </div>
  518. {/* {this.props.data.type === 0 ? (
  519. <div>
  520. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  521. 当前项目进度(咨询师经理填写)
  522. </h3>
  523. {planData.map((item, index) => {
  524. return <Itemlist key={index} pageData={item} />;
  525. })}
  526. </div>
  527. ) : (
  528. ""
  529. )} */}
  530. <div
  531. style={{
  532. display:
  533. (this.props.data.processState == 8 ||
  534. this.props.data.processState == 7) &&
  535. (this.props.data.status == 2 || this.props.data.status == 4)
  536. ? "block"
  537. : "none"
  538. }}
  539. >
  540. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  541. 回收退票
  542. </h3>
  543. <Table
  544. pagination={false}
  545. bordered
  546. columns={this.state.ContactsLists}
  547. dataSource={this.state.contactList}
  548. />
  549. </div>
  550. <div
  551. style={{
  552. display: this.props.data.processState > 5 ? "block" : "none"
  553. }}
  554. >
  555. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  556. 当前财务状态(财务填写)
  557. </h3>
  558. {financeData.map((item, index) => {
  559. return <Itemlist key={index} pageData={item} />;
  560. })}
  561. </div>
  562. {/* <ul>
  563. <span>备注</span>
  564. {this.state.dataSource.map((item, index) => (
  565. <li key={index}>{item.remarks}</li>
  566. ))}
  567. </ul> */}
  568. {/* {this.props.data.type === 0 ? (
  569. this.props.data.processState >= 5 ? (
  570. <div style={{ marginTop: "20px" }}>
  571. <h3
  572. style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}
  573. >
  574. 当前财务状态(财务填写)
  575. </h3>
  576. {financeData.map((item, index) => {
  577. return <Itemlist key={index} pageData={item} />;
  578. })}
  579. </div>
  580. ) : (
  581. ""
  582. )
  583. ) : this.props.data.status === 4 ? (
  584. <div>
  585. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  586. 当前财务状态(财务填写)
  587. </h3>
  588. {financeData.map((item, index) => {
  589. return <Itemlist key={index} pageData={item} />;
  590. })}
  591. </div>
  592. ) : (
  593. ""
  594. )} */}
  595. </div>
  596. {this.props.processState === this.props.data.processState ? (
  597. <div
  598. className="clearfix"
  599. style={{ display: "flex", justifyContent: "space-around" }}
  600. >
  601. {buttonData.map((item, index) => {
  602. return (
  603. <AgreeButton
  604. data={item}
  605. key={index}
  606. backData={this.props.data}
  607. processState={this.props.processState}
  608. onCancel={this.props.onCancel}
  609. />
  610. );
  611. })}
  612. </div>
  613. ) : (
  614. ""
  615. )}
  616. {/* <ReactToPrint
  617. trigger={() => (
  618. <div className="clearfix">
  619. <Button type="primary" style={{ float: "right", marginTop: 10 }}>
  620. 打印
  621. </Button>
  622. </div>
  623. )}
  624. content={() => this.refs}
  625. /> */}
  626. </div>
  627. );
  628. }
  629. }
  630. export { ChangeDetail };