changeDetailJsjl.js 21 KB

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