changeDetailJszj.js 21 KB

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