changeDetailJszj.js 21 KB

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