changeDetailYxgly.js 18 KB

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