changeDetailYxgly.js 18 KB

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