changeDetailJsjl.js 22 KB

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