changeDetailYxgly.js 19 KB

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