changeDetailYxgly.js 18 KB

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