changeDetailJszj.js 20 KB

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