changeDetailYxgly.js 17 KB

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