changeDetailJsy.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  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 ReactToPrint from "react-to-print";
  9. const FormItem = Form.Item;
  10. const { TextArea } = Input;
  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. changeType: 1,
  86. dataSource: [],
  87. reason: "",
  88. // 累计回收退票
  89. refundInvoice: 0,
  90. // 退票数组
  91. contactList: [],
  92. rejectState: 0,
  93. // 收款信息
  94. proceedsData: [],
  95. proceedsTotal: this.props.proceedsTotal,
  96. // 开票信息
  97. invoiceData: [],
  98. invoiceTotal: this.props.invoiceTotal,
  99. cost: 10,
  100. refund: 8,
  101. // 测试添加退票
  102. contactList: this.props.contactList,
  103. ContactsLists: [
  104. {
  105. title: "金额(万)",
  106. dataIndex: "amount",
  107. key: "amount",
  108. render: (text, record) => {
  109. return (
  110. <div>
  111. 实际回收退票(万元)
  112. <Input
  113. value={record.amount}
  114. placeholder="请输入金额(必填项)"
  115. disabled={record.load}
  116. key={record.id}
  117. required="required"
  118. onChange={e => {
  119. record.amount = e.target.value;
  120. this.setState({ contactList: this.state.contactList });
  121. }}
  122. style={{ width: "120px" }}
  123. />
  124. </div>
  125. );
  126. }
  127. },
  128. {
  129. title: "时间",
  130. dataIndex: "createTimes",
  131. key: "createTimes",
  132. render: (text, record) => {
  133. return <div>{record.createTimes}</div>;
  134. }
  135. }
  136. ]
  137. };
  138. this.getOrgCodeUrl = this.getOrgCodeUrl.bind(this);
  139. this.changeButtonStatus = this.changeButtonStatus.bind(this);
  140. // this.shenghePeo = this.shenghePeo.bind(this)
  141. }
  142. getOrgCodeUrl(e) {
  143. this.setState({
  144. orgCodeUrl: e
  145. });
  146. }
  147. changeButtonStatus() {
  148. this.setState({
  149. buttonStatus: !this.state.buttonStatus
  150. });
  151. }
  152. // loadData() {
  153. // $.ajax({
  154. // method: "get",
  155. // dataType: "json",
  156. // async: false,
  157. // crossDomain: false,
  158. // url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  159. // data: {
  160. // changeId: this.props.data.id
  161. // },
  162. // success: function(data) {
  163. // if (data.error.length || data.data.list == "") {
  164. // if (data.error && data.error.length) {
  165. // message.warning(data.error[0].message);
  166. // }
  167. // } else {
  168. // this.setState({
  169. // dataSource: data.data
  170. // });
  171. // }
  172. // }.bind(this)
  173. // });
  174. // }
  175. componentDidMount() {
  176. // this.loadData();
  177. window.setTimeout(() => {
  178. console.log(this.props);
  179. }, 1000);
  180. }
  181. render() {
  182. const pageData = [
  183. {
  184. labelA: "客户名称",
  185. formItemLayoutA: formItemLayout,
  186. dataA: this.props.data.userName,
  187. labelB: "合同编号",
  188. formItemLayoutB: formItemLayout,
  189. dataB: this.props.data.contractNo
  190. },
  191. {
  192. labelA: "时间",
  193. formItemLayoutA: formItemLayout,
  194. dataA: this.props.data.createTimes,
  195. labelB: "发起人",
  196. formItemLayoutB: formItemLayout,
  197. dataB: this.props.data.applicant
  198. },
  199. {
  200. labelA: "当前进度",
  201. formItemLayoutA: formItemLayout,
  202. // 当前是咨询师以及咨询师经理时使用shenhePeo函数,其他流程正常显示
  203. dataA:
  204. this.props.data.processState == 2 || this.props.data.processState == 3
  205. ? shenghePeo(
  206. this.props.data.processState == 2
  207. ? this.props.data.consultantExamine
  208. : this.props.data.managerExamine,
  209. this.props.data.processState
  210. )
  211. : getProcessStatusNew(
  212. this.props.data.processState,
  213. this.props.data.status
  214. ),
  215. labelB: "变更类型",
  216. formItemLayoutB: formItemLayout,
  217. dataB: getChangeType(this.props.data.type)
  218. },
  219. {
  220. labelA: "合同额(万元)",
  221. formItemLayoutA: formItemLayout,
  222. dataA: "***",
  223. labelB: "已收款(万元)",
  224. formItemLayoutB: formItemLayout,
  225. dataB: "***"
  226. },
  227. {
  228. labelA: "欠款(万元)",
  229. formItemLayoutA: formItemLayout,
  230. dataA: "***",
  231. labelB: "申请退款(万元)",
  232. formItemLayoutB: formItemLayout,
  233. dataB: "***"
  234. },
  235. {
  236. labelA: "变更原因",
  237. formItemLayoutA: formItemLayout,
  238. dataA: this.props.data.remarks
  239. }
  240. ];
  241. const planData = [
  242. {
  243. labelA: "项目进度",
  244. formItemLayoutA: formItemLayout,
  245. dataA: this.props.data.projectState,
  246. labelB: "发生成本费用(万元)",
  247. formItemLayoutB: formItemLayout,
  248. dataB: "***"
  249. },
  250. {
  251. labelA: "备注",
  252. formItemLayoutA: formItemLayout,
  253. dataA: this.props.data.zxsRemarks
  254. }
  255. ];
  256. const financeData = [
  257. {
  258. labelA: "收款时间",
  259. formItemLayoutA: formItemLayout,
  260. dataA: this.props.data.paymentTimes,
  261. labelB: "收款金额(万元)",
  262. formItemLayoutB: formItemLayout,
  263. dataB: "***"
  264. },
  265. {
  266. labelA: "开票时间",
  267. formItemLayoutA: formItemLayout,
  268. dataA: this.props.data.invoiceTimes,
  269. labelB: "已开票金额(万元)",
  270. formItemLayoutB: formItemLayout,
  271. dataB: "***"
  272. },
  273. {
  274. labelA: "发生成本(万元)",
  275. formItemLayoutA: formItemLayout,
  276. dataA: "***",
  277. labelB: "应退金额(万元)",
  278. formItemLayoutB: formItemLayout,
  279. dataB: "***"
  280. },
  281. {
  282. labelA: "补充资料/备注",
  283. formItemLayoutA: formItemLayout,
  284. dataA: this.props.data.cwRemarks
  285. }
  286. ];
  287. const buttonData = [
  288. {
  289. name: "同意",
  290. title: "理由",
  291. placeholder: "请输入理由",
  292. type: "primary",
  293. status: 2,
  294. onChange: value => {
  295. this.setState({
  296. remarks: value
  297. });
  298. }
  299. },
  300. {
  301. name: "拒绝",
  302. title: "理由",
  303. placeholder: "请输入理由",
  304. type: "danger",
  305. status: 3,
  306. onChange: value => {
  307. this.setState({
  308. remarks: value
  309. });
  310. }
  311. }
  312. ];
  313. const orgCodeUrl = this.props.pictureUrl;
  314. return (
  315. <div className="clearfix changeDetail">
  316. <div
  317. className="clearfix"
  318. ref={e => {
  319. this.refs = e;
  320. }}
  321. >
  322. <h2 style={{ textAlign: "center", marginBottom: 10 }}>
  323. 合同变更记录
  324. </h2>
  325. {pageData.map((item, index) => {
  326. return <Itemlist key={index} pageData={item} />;
  327. })}
  328. <Form.Item
  329. label="变更凭证"
  330. labelCol={{ span: 4 }}
  331. wrapperCol={{ span: 18 }}
  332. >
  333. <Upload
  334. className="demandDetailShow-upload"
  335. listType="picture-card"
  336. fileList={orgCodeUrl}
  337. onPreview={file => {
  338. this.setState({
  339. previewImage: file.url || file.thumbUrl,
  340. previewVisible: true
  341. });
  342. }}
  343. />
  344. <Modal
  345. maskClosable={false}
  346. footer={null}
  347. visible={this.state.previewVisible}
  348. onCancel={() => {
  349. this.setState({ previewVisible: false });
  350. }}
  351. >
  352. <img
  353. alt=""
  354. style={{ width: "100%" }}
  355. src={this.state.previewImage || ""}
  356. />
  357. </Modal>
  358. <Rizhi changeId={this.props.data.id} />
  359. </Form.Item>
  360. {/* <ul>
  361. {this.props.data.consultantExamine.map((item, index) => {
  362. return (
  363. <li>
  364. )
  365. })}
  366. </ul> */}
  367. {/* <h2 style={{ textAlign: "center", marginBottom: 0 }}>变更日志</h2> */}
  368. <ul
  369. style={{
  370. width: "868px",
  371. overflow: "hidden",
  372. paddingLeft: "90px",
  373. position: "relative",
  374. bottom: "0px"
  375. }}
  376. >
  377. {/* <span>操作人:</span> */}
  378. {this.props.dataSource.map((item, index) => {
  379. if (item.status == 0) {
  380. item.status = "发起";
  381. } else if (item.status == 1) {
  382. item.status = "审核中";
  383. } else if (item.status == 2) {
  384. item.status = "通过";
  385. } else if (item.status == 3) {
  386. item.status = "驳回";
  387. } else if (item.status == 4) {
  388. item.status = "完成";
  389. }
  390. return (
  391. <li
  392. key={index}
  393. style={{
  394. width: "100%",
  395. height: "auto",
  396. wordBreak: "break-all",
  397. marginBottom: "10px"
  398. }}
  399. >
  400. {item.aname + ":" + "(" + item.status + ")" + item.remarks}
  401. </li>
  402. );
  403. })}
  404. </ul>
  405. {/* {this.props.data.processState >= 3 ? (
  406. <div>
  407. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  408. 当前项目进度(咨询师填写)
  409. </h3>
  410. {planData.map((item, index) => {
  411. return <Itemlist key={index} pageData={item} />;
  412. })}
  413. </div>
  414. ) : (
  415. ""
  416. )} */}
  417. {/* {this.props.data.processState >= 5 ? (
  418. <div>
  419. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  420. 当前财务状态(财务填写)
  421. </h3>
  422. {financeData.map((item, index) => {
  423. return <Itemlist key={index} pageData={item} />;
  424. })}
  425. </div>
  426. ) : (
  427. ""
  428. )} */}
  429. </div>
  430. {this.props.processState === this.props.data.processState ? (
  431. <div style={{ display: this.props.data.isExamine == 0 ? "block" : "none" }}>
  432. <div className="clearfix">
  433. <FormItem
  434. style={{ height: "auto" }}
  435. labelCol={{ span: 4 }}
  436. wrapperCol={{ span: 18 }}
  437. label="备注"
  438. >
  439. <TextArea
  440. rows={4}
  441. placeholder="请输入备注信息"
  442. style={{ width: "95%" }}
  443. value={this.state.reason}
  444. onChange={e => {
  445. let reason = e.target.value;
  446. this.setState({ reason });
  447. }}
  448. />
  449. </FormItem>
  450. </div>
  451. <div
  452. className="clearfix"
  453. style={{ display: "flex", justifyContent: "space-around" }}
  454. >
  455. {buttonData.map((item, index) => {
  456. return (
  457. <AgreeButton
  458. data={item}
  459. key={index}
  460. backData={this.props.data}
  461. processState={this.props.processState}
  462. visible={this.changeButtonStatus}
  463. ajaxData={this.state}
  464. loadData={this.props.loadData}
  465. rejectState={this.state.rejectState}
  466. reason={this.state.reason}
  467. onCancel={this.props.onCancel}
  468. />
  469. );
  470. })}
  471. </div>
  472. <Select
  473. defaultValue="0"
  474. style={{
  475. width: 120,
  476. float: "left",
  477. position: "relative",
  478. bottom: "28px",
  479. right: "-600px"
  480. }}
  481. onChange={val => {
  482. this.setState({ rejectState: val });
  483. }}
  484. >
  485. <Option
  486. value="0"
  487. style={{
  488. display: this.props.processState >= 1 ? "block" : "none"
  489. }}
  490. >
  491. 营销员
  492. </Option>
  493. <Option
  494. value="1"
  495. style={{
  496. display: this.props.processState >= 2 ? "block" : "none"
  497. }}
  498. >
  499. 营销管理员
  500. </Option>
  501. <Option
  502. value="2"
  503. style={{
  504. display: this.props.processState >= 3 ? "block" : "none"
  505. }}
  506. >
  507. 咨询师
  508. </Option>
  509. <Option
  510. value="3"
  511. style={{
  512. display: this.props.processState >= 4 ? "block" : "none"
  513. }}
  514. >
  515. 咨询师经理
  516. </Option>
  517. <Option
  518. value="4"
  519. style={{
  520. display: this.props.processState >= 5 ? "block" : "none"
  521. }}
  522. >
  523. 咨询师总监
  524. </Option>
  525. <Option
  526. value="5"
  527. style={{
  528. display: this.props.processState >= 6 ? "block" : "none"
  529. }}
  530. >
  531. 财务专员(退单)
  532. </Option>
  533. <Option
  534. value="6"
  535. style={{
  536. display: this.props.processState >= 7 ? "block" : "none"
  537. }}
  538. >
  539. 财务总监
  540. </Option>
  541. <Option
  542. value="7"
  543. style={{
  544. display: this.props.processState >= 8 ? "block" : "none"
  545. }}
  546. >
  547. 总裁
  548. </Option>
  549. </Select>
  550. </div>
  551. ) : (
  552. ""
  553. )}
  554. {/* <ReactToPrint
  555. trigger={() => (
  556. <div className="clearfix">
  557. <Button type="primary" style={{ float: "right", marginTop: 10 }}>
  558. 打印
  559. </Button>
  560. </div>
  561. )}
  562. content={() => this.refs}
  563. /> */}
  564. </div>
  565. );
  566. }
  567. }
  568. export { ChangeDetail };