changeDetailJsjl.js 23 KB

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