changeDetailJszj.js 20 KB

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