changeDetailJsy.js 17 KB

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