changeDetailYxy.js 17 KB

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