changeDetailYxy.js 21 KB

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