changeDetailYxgly.js 19 KB

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