changeDetailYxgly.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  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. }
  197. render() {
  198. const pageData = [
  199. {
  200. labelA: "客户名称",
  201. formItemLayoutA: formItemLayout,
  202. dataA: this.props.data.userName,
  203. labelB: "合同编号",
  204. formItemLayoutB: formItemLayout,
  205. dataB: this.props.data.contractNo
  206. },
  207. {
  208. labelA: "时间",
  209. formItemLayoutA: formItemLayout,
  210. dataA: this.props.data.createTimes,
  211. labelB: "发起人",
  212. formItemLayoutB: formItemLayout,
  213. dataB: this.props.data.applicant
  214. },
  215. {
  216. labelA: "当前进度",
  217. formItemLayoutA: formItemLayout,
  218. // 当前是咨询师以及咨询师经理时使用shenhePeo函数,其他流程正常显示
  219. dataA:
  220. this.props.data.processState == 2 || this.props.data.processState == 3
  221. ? shenghePeo(
  222. this.props.data.processState == 2
  223. ? this.props.data.consultantExamine
  224. : this.props.data.managerExamine,
  225. this.props.data.processState
  226. )
  227. : getProcessStatusNew(
  228. this.props.data.processState,
  229. this.props.data.status
  230. ),
  231. labelB: "变更类型",
  232. formItemLayoutB: formItemLayout,
  233. dataB: getChangeType(this.props.data.type)
  234. },
  235. {
  236. labelA: "合同额(万元)",
  237. formItemLayoutA: formItemLayout,
  238. dataA: this.props.data.totalAmount,
  239. labelB: "已收款(万元)",
  240. formItemLayoutB: formItemLayout,
  241. dataB: this.props.data.settlementAmount
  242. },
  243. {
  244. labelA: "欠款(万元)",
  245. formItemLayoutA: formItemLayout,
  246. dataA: this.props.data.arrears,
  247. labelB: "申请退款(万元)",
  248. formItemLayoutB: formItemLayout,
  249. dataB: this.props.data.changeAmount
  250. },
  251. {
  252. labelA: "变更原因",
  253. formItemLayoutA: formItemLayout,
  254. dataA: this.props.data.remarks
  255. }
  256. ];
  257. const planData = [
  258. {
  259. labelA: "项目进度",
  260. formItemLayoutA: formItemLayout,
  261. dataA: this.props.data.projectState,
  262. labelB: "发生成本费用(万元)",
  263. formItemLayoutB: formItemLayout,
  264. dataB: this.props.data.zxsCost
  265. },
  266. {
  267. labelA: "变更原因",
  268. formItemLayoutA: formItemLayout,
  269. dataA: this.props.data.zxsRemarks
  270. }
  271. ];
  272. const financeData = [
  273. {
  274. labelA: "发生成本(万元)",
  275. formItemLayoutA: formItemLayout,
  276. dataA: this.props.data.cwCost,
  277. labelB: "应退金额(万元)",
  278. formItemLayoutB: formItemLayout,
  279. dataB: this.props.data.refundableAmount
  280. }
  281. ];
  282. const buttonData = [
  283. {
  284. name: "同意",
  285. title: "理由",
  286. placeholder: "请输入理由",
  287. type: "primary",
  288. status: 2,
  289. onChange: value => {
  290. this.setState({
  291. remarks: value
  292. });
  293. }
  294. },
  295. {
  296. name: "拒绝",
  297. title: "理由",
  298. placeholder: "请输入理由",
  299. type: "danger",
  300. status: 3,
  301. onChange: value => {
  302. this.setState({
  303. remarks: value
  304. });
  305. }
  306. }
  307. ];
  308. const orgCodeUrl = this.props.pictureUrl;
  309. return (
  310. <div className="clearfix changeDetail">
  311. <div
  312. className="clearfix"
  313. ref={e => {
  314. this.refs = e;
  315. }}
  316. >
  317. <div
  318. style={{
  319. borderRadius: "50%",
  320. width: 300,
  321. height: 300,
  322. position: "absolute",
  323. top: 230,
  324. left: 525,
  325. transform: "rotate(-5deg)",
  326. zIndex: 1,
  327. display:
  328. (this.props.data.processState == 7 ||
  329. this.props.data.processState == 8) &&
  330. this.props.data.status == 4
  331. ? "block"
  332. : "none"
  333. }}
  334. >
  335. {/* <span
  336. style={{
  337. fontSize: 29,
  338. position: "absolute",
  339. left: "50%",
  340. top: "50%",
  341. transform: "translate(-50%,-50%)",
  342. color: "red"
  343. }}
  344. >
  345. 通过
  346. </span> */}
  347. <img src={tongguo} style={{ width: "100%" }} />
  348. </div>
  349. <h2 style={{ textAlign: "center", marginBottom: 10 }}>
  350. 合同变更记录
  351. </h2>
  352. {pageData.map((item, index) => {
  353. return <Itemlist key={index} pageData={item} />;
  354. })}
  355. <Form.Item
  356. label="变更凭证"
  357. labelCol={{ span: 4 }}
  358. wrapperCol={{ span: 18 }}
  359. >
  360. <Upload
  361. className="demandDetailShow-upload"
  362. listType="picture-card"
  363. fileList={orgCodeUrl}
  364. onPreview={file => {
  365. this.setState({
  366. previewImage: file.url || file.thumbUrl,
  367. previewVisible: true
  368. });
  369. }}
  370. />
  371. <Modal
  372. maskClosable={false}
  373. footer={null}
  374. visible={this.state.previewVisible}
  375. onCancel={() => {
  376. this.setState({ previewVisible: false });
  377. }}
  378. >
  379. <img
  380. alt=""
  381. style={{ width: "100%" }}
  382. src={this.state.previewImage || ""}
  383. />
  384. </Modal>
  385. <Rizhi changeId={this.props.data.id} />
  386. </Form.Item>
  387. {/* <h2 style={{ textAlign: "center", marginBottom: 0 }}>变更日志</h2> */}
  388. <ul
  389. style={{
  390. width: "868px",
  391. overflow: "hidden",
  392. paddingLeft: "90px",
  393. position: "relative",
  394. bottom: "20px"
  395. }}
  396. >
  397. {/* <span>操作人:</span> */}
  398. {this.props.dataSource.map((item, index) => {
  399. if (item.status == 0) {
  400. item.status = "发起";
  401. } else if (item.status == 1) {
  402. item.status = "审核中";
  403. } else if (item.status == 2) {
  404. item.status = "通过";
  405. } else if (item.status == 3) {
  406. item.status = "驳回";
  407. } else if (item.status == 4) {
  408. item.status = "完成";
  409. }
  410. return (
  411. <li
  412. key={index}
  413. style={{
  414. width: "100%",
  415. height: "auto",
  416. wordBreak: "break-all",
  417. marginBottom: "10px"
  418. }}
  419. >
  420. {item.aname + ":" + "(" + item.status + ")" + item.remarks}
  421. </li>
  422. );
  423. })}
  424. </ul>
  425. <div className="clearfix">
  426. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  427. 收款情况
  428. </h3>
  429. <div style={{ marginLeft: "90px" }}>
  430. <ul>
  431. {(this.props.proceedsData.bill || []).map((item, index) => (
  432. <li key={index}>
  433. {item.payTime +
  434. " " +
  435. item.aName +
  436. " 收款:" +
  437. item.transactionAmount +
  438. "万元"}
  439. </li>
  440. ))}
  441. </ul>
  442. <div>收款总计:{this.props.proceedsTotal}万元</div>
  443. </div>
  444. <br />
  445. <div style={{ marginLeft: "90px" }}>
  446. <ul>
  447. {(this.props.proceedsData.invoice || []).map((item, index) => (
  448. <li key={index}>
  449. {item.createTime + " " + " 开票:" + item.amount + "万元"}
  450. </li>
  451. ))}
  452. </ul>
  453. <div>开票总计:{this.props.invoiceTotal}万元</div>
  454. </div>
  455. <p style={{ marginLeft: "90px", color: "red" }}>
  456. 系统预估 产生成本(万元):
  457. {this.props.data.estimateCost
  458. ? this.props.data.estimateCost
  459. : "0"}{" "}
  460. &nbsp;应退金额(万元):
  461. {this.props.data.estimateRefundable
  462. ? this.props.data.estimateRefundable
  463. : "0"}
  464. </p>
  465. </div>
  466. <div
  467. style={{
  468. display:
  469. (this.props.data.processState == 8 ||
  470. this.props.data.processState == 7) &&
  471. (this.props.data.status == 2 || this.props.data.status == 4)
  472. ? "block"
  473. : "none"
  474. }}
  475. >
  476. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  477. 回收退票
  478. </h3>
  479. <Table
  480. pagination={false}
  481. bordered
  482. columns={this.state.ContactsLists}
  483. dataSource={this.state.contactList}
  484. />
  485. </div>
  486. <div
  487. style={{
  488. display: this.props.data.processState > 5 ? "block" : "none"
  489. }}
  490. >
  491. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  492. 当前财务状态(财务填写)
  493. </h3>
  494. {financeData.map((item, index) => {
  495. return <Itemlist key={index} pageData={item} />;
  496. })}
  497. </div>
  498. {/* {this.props.data.type === 0 && this.props.data.processState >= 2 ? (
  499. <div>
  500. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  501. 当前项目进度(咨询师经理填写)
  502. </h3>
  503. {planData.map((item, index) => {
  504. return <Itemlist key={index} pageData={item} />;
  505. })}
  506. </div>
  507. ) : (
  508. ""
  509. )}
  510. {this.props.data.type === 0 ? (
  511. this.props.data.processState >= 5 ? (
  512. <div>
  513. <h3
  514. style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}
  515. >
  516. 当前财务状态(财务填写)
  517. </h3>
  518. {financeData.map((item, index) => {
  519. return <Itemlist key={index} pageData={item} />;
  520. })}
  521. </div>
  522. ) : (
  523. ""
  524. )
  525. ) : this.props.data.status === 4 ? (
  526. <div>
  527. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  528. 当前财务状态(财务填写)
  529. </h3>
  530. {financeData.map((item, index) => {
  531. return <Itemlist key={index} pageData={item} />;
  532. })}
  533. </div>
  534. ) : (
  535. ""
  536. )} */}
  537. </div>
  538. {this.props.processState === this.props.data.processState ? (
  539. this.state.buttonStatus ? (
  540. <div>
  541. <div className="clearfix">
  542. <FormItem
  543. style={{ height: "auto" }}
  544. labelCol={{ span: 4 }}
  545. wrapperCol={{ span: 18 }}
  546. label="备注"
  547. >
  548. <TextArea
  549. rows={4}
  550. placeholder="请输入备注信息"
  551. style={{ width: "95%" }}
  552. value={this.state.reason}
  553. onChange={e => {
  554. let reason = e.target.value;
  555. this.setState({ reason });
  556. }}
  557. />
  558. </FormItem>
  559. </div>
  560. <div
  561. className="clearfix"
  562. style={{ display: "flex", justifyContent: "space-around" }}
  563. >
  564. {buttonData.map((item, index) => {
  565. return (
  566. <AgreeButton
  567. data={item}
  568. key={index}
  569. backData={this.props.data}
  570. processState={this.props.processState}
  571. visible={this.changeButtonStatus}
  572. loadData={this.props.loadData}
  573. reason={this.state.reason}
  574. ajaxData={this.state}
  575. rejectState={this.state.rejectState}
  576. onCancel={this.props.onCancel}
  577. />
  578. );
  579. })}
  580. </div>
  581. </div>
  582. ) : (
  583. ""
  584. )
  585. ) : (
  586. ""
  587. )}
  588. {/* <ReactToPrint
  589. trigger={() => (
  590. <div className="clearfix">
  591. <Button type="primary" style={{ float: "right", marginTop: 10 }}>
  592. 打印
  593. </Button>
  594. </div>
  595. )}
  596. content={() => this.refs}
  597. /> */}
  598. </div>
  599. );
  600. }
  601. }
  602. export { ChangeDetail, changeType, getChangeType };