changeDetailJsy.js 17 KB

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