changeDetailJszj.js 20 KB

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