changeDetailYxy.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  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. <h2 style={{ textAlign: "center", marginBottom: 0 }}>合同变更记录</h2>
  310. {pageData.map((item, index) => {
  311. return <Itemlist key={index} pageData={item} />;
  312. })}
  313. <Form.Item
  314. label="变更凭证"
  315. labelCol={{ span: 4 }}
  316. wrapperCol={{ span: 18 }}
  317. >
  318. <Upload
  319. className="demandDetailShow-upload"
  320. listType="picture-card"
  321. fileList={orgCodeUrl}
  322. onPreview={file => {
  323. this.setState({
  324. previewImage: file.url || file.thumbUrl,
  325. previewVisible: true
  326. });
  327. }}
  328. />
  329. <Modal
  330. maskClosable={false}
  331. footer={null}
  332. visible={this.state.previewVisible}
  333. onCancel={() => {
  334. this.setState({ previewVisible: false });
  335. }}
  336. >
  337. <img
  338. alt=""
  339. style={{ width: "100%" }}
  340. src={this.state.previewImage || ""}
  341. />
  342. </Modal>
  343. <Rizhi changeId={this.props.data.id} />
  344. </Form.Item>
  345. {/* {this.props.data.type === 0 && this.props.data.processState >= 2 ? (
  346. <div>
  347. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  348. 当前项目进度(咨询师经理填写)
  349. </h3>
  350. {planData.map((item, index) => {
  351. return <Itemlist key={index} pageData={item} />;
  352. })}
  353. </div>
  354. ) : (
  355. ""
  356. )} */}
  357. {/* <h2 style={{ textAlign: "center", marginBottom: 0 }}>变更日志</h2> */}
  358. <ul
  359. style={{
  360. width: "868px",
  361. overflow: "hidden",
  362. paddingLeft: "90px",
  363. position: "relative",
  364. bottom: "20px"
  365. }}
  366. >
  367. {/* <span>操作人:</span> */}
  368. {this.props.dataSource.map((item, index) => {
  369. if (item.status == 0) {
  370. item.status = "发起";
  371. } else if (item.status == 1) {
  372. item.status = "审核中";
  373. } else if (item.status == 2) {
  374. item.status = "通过";
  375. } else if (item.status == 3) {
  376. item.status = "驳回";
  377. } else if (item.status == 4) {
  378. item.status = "完成";
  379. }
  380. return (
  381. <li
  382. key={index}
  383. style={{
  384. width: "100%",
  385. height: "auto",
  386. wordBreak: "break-all",
  387. marginBottom: "10px"
  388. }}
  389. >
  390. {item.aname + ":" + "(" + item.status + ")" + item.remarks}
  391. </li>
  392. );
  393. })}
  394. </ul>
  395. <div className="clearfix">
  396. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  397. 收款情况
  398. </h3>
  399. <div style={{ marginLeft: "90px" }}>
  400. <ul>
  401. {(this.props.proceedsData.bill || []).map((item, index) => (
  402. <li key={index}>
  403. {item.payTime +
  404. " " +
  405. item.aName +
  406. " 收款:" +
  407. item.transactionAmount +
  408. "万元"}
  409. </li>
  410. ))}
  411. </ul>
  412. <div>收款总计:{this.props.proceedsTotal}万元</div>
  413. </div>
  414. <br />
  415. <div style={{ marginLeft: "90px" }}>
  416. <ul>
  417. {(this.props.proceedsData.invoice || []).map((item, index) => (
  418. <li key={index}>
  419. {item.createTime + " " + " 开票:" + item.amount + "万元"}
  420. </li>
  421. ))}
  422. </ul>
  423. <div>开票总计:{this.props.invoiceTotal}万元</div>
  424. </div>
  425. <p style={{ marginLeft: "90px", color: "red" }}>
  426. 系统预估 产生成本(万元):
  427. {this.props.data.estimateCost
  428. ? this.props.data.estimateCost
  429. : "0"}{" "}
  430. &nbsp;应退金额(万元):
  431. {this.props.data.estimateRefundable
  432. ? this.props.data.estimateRefundable
  433. : "0"}
  434. </p>
  435. </div>
  436. {/* {this.props.data.type === 0 ? (
  437. <div>
  438. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  439. 当前项目进度(咨询师经理填写)
  440. </h3>
  441. {planData.map((item, index) => {
  442. return <Itemlist key={index} pageData={item} />;
  443. })}
  444. </div>
  445. ) : (
  446. ""
  447. )} */}
  448. <div
  449. style={{
  450. display:
  451. (this.props.data.processState == 8 ||
  452. this.props.data.processState == 7) &&
  453. (this.props.data.status == 2 || this.props.data.status == 4)
  454. ? "block"
  455. : "none"
  456. }}
  457. >
  458. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  459. 回收退票
  460. </h3>
  461. <Table
  462. pagination={false}
  463. bordered
  464. columns={this.state.ContactsLists}
  465. dataSource={this.state.contactList}
  466. />
  467. </div>
  468. <div style={{ display: this.props.data.processState > 5 ? "block" : "none"}}>
  469. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  470. 当前财务状态(财务填写)
  471. </h3>
  472. {financeData.map((item, index) => {
  473. return <Itemlist key={index} pageData={item} />;
  474. })}
  475. </div>
  476. {/* <ul>
  477. <span>备注</span>
  478. {this.state.dataSource.map((item, index) => (
  479. <li key={index}>{item.remarks}</li>
  480. ))}
  481. </ul> */}
  482. {/* {this.props.data.type === 0 ? (
  483. this.props.data.processState >= 5 ? (
  484. <div style={{ marginTop: "20px" }}>
  485. <h3
  486. style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}
  487. >
  488. 当前财务状态(财务填写)
  489. </h3>
  490. {financeData.map((item, index) => {
  491. return <Itemlist key={index} pageData={item} />;
  492. })}
  493. </div>
  494. ) : (
  495. ""
  496. )
  497. ) : this.props.data.status === 4 ? (
  498. <div>
  499. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  500. 当前财务状态(财务填写)
  501. </h3>
  502. {financeData.map((item, index) => {
  503. return <Itemlist key={index} pageData={item} />;
  504. })}
  505. </div>
  506. ) : (
  507. ""
  508. )} */}
  509. </div>
  510. {this.props.processState === this.props.data.processState ? (
  511. <div
  512. className="clearfix"
  513. style={{ display: "flex", justifyContent: "space-around" }}
  514. >
  515. {buttonData.map((item, index) => {
  516. return (
  517. <AgreeButton
  518. data={item}
  519. key={index}
  520. backData={this.props.data}
  521. processState={this.props.processState}
  522. onCancel={this.props.onCancel}
  523. />
  524. );
  525. })}
  526. </div>
  527. ) : (
  528. ""
  529. )}
  530. {/* <ReactToPrint
  531. trigger={() => (
  532. <div className="clearfix">
  533. <Button type="primary" style={{ float: "right", marginTop: 10 }}>
  534. 打印
  535. </Button>
  536. </div>
  537. )}
  538. content={() => this.refs}
  539. /> */}
  540. </div>
  541. );
  542. }
  543. }
  544. export { ChangeDetail };