changeDetailJsy.js 20 KB

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