changeDetailCwzy.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. import React, { Component } from "react";
  2. import { Form, Upload, Modal, Input, DatePicker } from "antd";
  3. import AgreeButton from "./agreeButton.js";
  4. import Rizhi from "./rizhi.js";
  5. import moment from "moment";
  6. import { getProcessStatusNew } from "@/tools.js";
  7. const formItemLayout = {
  8. labelCol: { span: 8 },
  9. wrapperCol: { span: 14 }
  10. };
  11. const changeType = [
  12. {
  13. value: "0",
  14. key: "退单退款"
  15. },
  16. {
  17. value: "1",
  18. key: "项目及金额变更"
  19. },
  20. {
  21. value: "2",
  22. key: "仅项目变更"
  23. },
  24. {
  25. value: "3",
  26. key: "仅金额变更"
  27. },
  28. {
  29. value: "4",
  30. key: "重报"
  31. },
  32. {
  33. value: "5",
  34. key: "赠送"
  35. }
  36. ];
  37. const getChangeType = function(e) {
  38. if (e || e == 0) {
  39. let str = e.toString();
  40. let theType = "";
  41. changeType.map(function(item) {
  42. if (item.value == str) {
  43. theType = item.key;
  44. }
  45. });
  46. return theType;
  47. }
  48. };
  49. class Itemlist extends Component {
  50. constructor(props) {
  51. super(props);
  52. }
  53. render() {
  54. let pageData = this.props.pageData;
  55. return (
  56. <div className="clearfix">
  57. <Form.Item
  58. label={pageData.labelA}
  59. {...pageData.formItemLayoutA}
  60. className="half-item"
  61. >
  62. <span>{pageData.dataA}</span>
  63. </Form.Item>
  64. <Form.Item
  65. label={pageData.labelB}
  66. {...pageData.formItemLayoutB}
  67. className="half-item"
  68. >
  69. <span>{pageData.dataB}</span>
  70. </Form.Item>
  71. </div>
  72. );
  73. }
  74. }
  75. class ItemInput extends Component {
  76. constructor(props) {
  77. super(props);
  78. this.state = {
  79. valueA: "",
  80. valueB: ""
  81. };
  82. }
  83. componentWillReceiveProps(nextProps) {
  84. if (!nextProps.reset) {
  85. this.reset();
  86. }
  87. }
  88. reset() {
  89. this.setState({
  90. valueA: "",
  91. valueB: ""
  92. });
  93. }
  94. render() {
  95. let pageData = this.props.pageData;
  96. return (
  97. <div className="clearfix">
  98. <Form.Item
  99. label={pageData.labelA}
  100. {...pageData.formItemLayoutA}
  101. className="half-item"
  102. >
  103. <Input
  104. value={this.state.valueA}
  105. placeholder={"请输入" + pageData.labelA}
  106. style={{ width: 160 }}
  107. onChange={e => {
  108. this.setState({ valueA: e.target.value });
  109. pageData.onChangeA(e.target.value);
  110. }}
  111. />
  112. </Form.Item>
  113. <Form.Item
  114. label={pageData.labelB}
  115. {...pageData.formItemLayoutB}
  116. className="half-item"
  117. >
  118. {pageData.mark ? (
  119. <Input
  120. value={this.state.valueB}
  121. placeholder={"请输入" + pageData.labelB}
  122. style={{ width: 160 }}
  123. onChange={e => {
  124. this.setState({ valueB: e.target.value });
  125. pageData.onChangeB(e.target.value);
  126. }}
  127. />
  128. ) : (
  129. ""
  130. )}
  131. </Form.Item>
  132. </div>
  133. );
  134. }
  135. }
  136. class ChangeDetail extends Component {
  137. constructor(props) {
  138. super(props);
  139. this.state = {
  140. previewVisible: false,
  141. buttonStatus: true,
  142. changeType: 2
  143. };
  144. this.getOrgCodeUrl = this.getOrgCodeUrl.bind(this);
  145. this.changeButtonStatus = this.changeButtonStatus.bind(this);
  146. this.reset = this.reset.bind(this);
  147. }
  148. componentWillReceiveProps(nextProps) {
  149. this.setState({
  150. paymentTimes: nextProps.data.paymentTimes,
  151. paymentAmount: nextProps.data.paymentAmount,
  152. invoiceTimes: nextProps.data.invoiceTimes,
  153. invoiceAmount: nextProps.data.invoiceAmount,
  154. cwCost: nextProps.data.cwCost,
  155. refundableAmount: nextProps.data.refundableAmount,
  156. cwRemarks: nextProps.data.cwRemarks
  157. });
  158. if (!nextProps.reset) {
  159. this.reset();
  160. }
  161. }
  162. reset() {
  163. this.setState({
  164. paymentTimes: null,
  165. paymentAmount: "",
  166. invoiceTimes: null,
  167. invoiceAmount: "",
  168. cwCost: "",
  169. refundableAmount: "",
  170. cwRemarks: ""
  171. });
  172. }
  173. getOrgCodeUrl(e) {
  174. this.setState({
  175. orgCodeUrl: e
  176. });
  177. }
  178. //同意拒绝按钮的有无
  179. changeButtonStatus() {
  180. this.setState({
  181. buttonStatus: !this.state.buttonStatus
  182. });
  183. }
  184. onRef(ref) {
  185. this.fun = ref;
  186. }
  187. render() {
  188. const pageData = [
  189. {
  190. labelA: "客户名称",
  191. formItemLayoutA: formItemLayout,
  192. dataA: this.props.data.userName,
  193. labelB: "合同编号",
  194. formItemLayoutB: formItemLayout,
  195. dataB: this.props.data.contractNo
  196. },
  197. {
  198. labelA: "时间",
  199. formItemLayoutA: formItemLayout,
  200. dataA: this.props.data.createTimes,
  201. labelB: "发起人",
  202. formItemLayoutB: formItemLayout,
  203. dataB: this.props.data.applicant
  204. },
  205. {
  206. labelA: "当前进度",
  207. formItemLayoutA: formItemLayout,
  208. dataA: this.props.data.processStateText,
  209. labelB: "变更类型",
  210. formItemLayoutB: formItemLayout,
  211. dataB: getChangeType(this.props.data.type)
  212. },
  213. {
  214. labelA: "合同额(万元)",
  215. formItemLayoutA: formItemLayout,
  216. dataA: this.props.data.totalAmount,
  217. labelB: "已收款(万元)",
  218. formItemLayoutB: formItemLayout,
  219. dataB: this.props.data.settlementAmount
  220. },
  221. {
  222. labelA: "欠款(万元)",
  223. formItemLayoutA: formItemLayout,
  224. dataA: this.props.data.arrears,
  225. labelB: "申请退款(万元)",
  226. formItemLayoutB: formItemLayout,
  227. dataB: this.props.data.changeAmount
  228. },
  229. {
  230. labelA: "备注",
  231. formItemLayoutA: formItemLayout,
  232. dataA: this.props.data.remarks
  233. }
  234. ];
  235. const planData = [
  236. {
  237. labelA: "项目进度",
  238. formItemLayoutA: formItemLayout,
  239. dataA: this.props.data.projectState,
  240. onChangeA: value => {
  241. this.setState({
  242. projectState: value
  243. });
  244. },
  245. labelB: "发生成本费用(万元)",
  246. formItemLayoutB: formItemLayout,
  247. dataB: this.props.data.zxsCost,
  248. onChangeB: value => {
  249. this.setState({
  250. zxsCost: value
  251. });
  252. }
  253. },
  254. {
  255. labelA: "备注",
  256. formItemLayoutA: formItemLayout,
  257. dataA: this.props.data.zxsRemarks,
  258. onChangeA: value => {
  259. this.setState({
  260. zxsRemarks: value
  261. });
  262. }
  263. }
  264. ];
  265. const financeData = [
  266. {
  267. labelA: "发生成本(万元)",
  268. formItemLayoutA: formItemLayout,
  269. dataA: this.props.data.cwCost,
  270. onChangeA: value => {
  271. this.setState({
  272. cwCost: value
  273. });
  274. },
  275. labelB: "应退金额(万元)",
  276. formItemLayoutB: formItemLayout,
  277. dataB: this.props.data.refundableAmount,
  278. onChangeB: value => {
  279. this.setState({
  280. refundableAmount: value
  281. });
  282. },
  283. mark: true
  284. },
  285. {
  286. labelA: "补充资料/备注",
  287. formItemLayoutA: formItemLayout,
  288. dataA: this.props.data.cwRemarks,
  289. onChangeA: value => {
  290. this.setState({
  291. cwRemarks: value
  292. });
  293. },
  294. mark: false
  295. }
  296. ];
  297. const buttonData = [
  298. {
  299. name: "同意",
  300. title: "理由",
  301. placeholder: "请输入理由",
  302. type: "primary",
  303. status: 2,
  304. onChange: value => {
  305. this.setState({
  306. remarks: value
  307. });
  308. }
  309. },
  310. {
  311. name: "拒绝",
  312. title: "理由",
  313. placeholder: "请输入理由",
  314. type: "danger",
  315. status: 3,
  316. onChange: value => {
  317. this.setState({
  318. remarks: value
  319. });
  320. }
  321. }
  322. ];
  323. const orgCodeUrl = this.props.pictureUrl;
  324. return (
  325. <div>
  326. {pageData.map((item, index) => {
  327. return <Itemlist key={index} pageData={item} />;
  328. })}
  329. <Form.Item
  330. label="变更凭证"
  331. labelCol={{ span: 4 }}
  332. wrapperCol={{ span: 18 }}
  333. >
  334. <Upload
  335. className="demandDetailShow-upload"
  336. listType="picture-card"
  337. fileList={orgCodeUrl}
  338. onPreview={file => {
  339. this.setState({
  340. previewImage: file.url || file.thumbUrl,
  341. previewVisible: true
  342. });
  343. }}
  344. />
  345. <Modal
  346. maskClosable={false}
  347. footer={null}
  348. visible={this.state.previewVisible}
  349. onCancel={() => {
  350. this.setState({ previewVisible: false }, () => {
  351. this.foo.reset();
  352. });
  353. }}
  354. >
  355. <img
  356. alt=""
  357. style={{ width: "100%" }}
  358. src={this.state.previewImage || ""}
  359. />
  360. </Modal>
  361. <Rizhi changeId={this.props.data.id} />
  362. </Form.Item>
  363. {this.props.data.type === 0 ? (
  364. <div>
  365. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  366. 当前项目进度(咨询师经理填写)
  367. </h3>
  368. {planData.map((item, index) => {
  369. return <Itemlist key={index} pageData={item} />;
  370. })}
  371. </div>
  372. ) : (
  373. ""
  374. )}
  375. {(this.props.data.processState > 5 &&
  376. this.props.data.processState <= 8) ||
  377. (this.props.data.processState === 9 && this.props.data.status === 4) ? (
  378. <div>
  379. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  380. 当前财务状态(财务填写)
  381. </h3>
  382. <div className="clearfix">
  383. <Form.Item
  384. className="half-item"
  385. label="收款时间"
  386. labelCol={{ span: 8 }}
  387. wrapperCol={{ span: 14 }}
  388. >
  389. <span>{this.props.data.paymentTimes}</span>
  390. </Form.Item>
  391. <Form.Item
  392. className="half-item"
  393. label="收款金额(万元)"
  394. labelCol={{ span: 8 }}
  395. wrapperCol={{ span: 14 }}
  396. >
  397. <span>{this.props.data.paymentAmount}</span>
  398. </Form.Item>
  399. </div>
  400. <div className="clearfix">
  401. <Form.Item
  402. className="half-item"
  403. label="开票时间"
  404. labelCol={{ span: 8 }}
  405. wrapperCol={{ span: 14 }}
  406. >
  407. <span>{this.props.data.invoiceTimes}</span>
  408. </Form.Item>
  409. <Form.Item
  410. className="half-item"
  411. label="开票金额(万元)"
  412. labelCol={{ span: 8 }}
  413. wrapperCol={{ span: 14 }}
  414. >
  415. <span>{this.props.data.invoiceAmount}</span>
  416. </Form.Item>
  417. </div>
  418. {financeData.map((item, index) => {
  419. return <Itemlist key={index} pageData={item} />;
  420. })}
  421. </div>
  422. ) : (
  423. <div style={{ marginBottom: 10 }}>
  424. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  425. 当前财务状态(财务填写)
  426. </h3>
  427. <div className="clearfix">
  428. <Form.Item
  429. className="half-item"
  430. label="收款时间"
  431. labelCol={{ span: 8 }}
  432. wrapperCol={{ span: 14 }}
  433. >
  434. <DatePicker
  435. style={{ width: 160 }}
  436. value={
  437. this.state.paymentTimes
  438. ? moment(this.state.paymentTimes)
  439. : null
  440. }
  441. onChange={(_data, dataString) => {
  442. this.setState({
  443. paymentTimes: dataString
  444. });
  445. }}
  446. />
  447. </Form.Item>
  448. <Form.Item
  449. className="half-item"
  450. label="收款金额(万元)"
  451. labelCol={{ span: 8 }}
  452. wrapperCol={{ span: 14 }}
  453. >
  454. <Input
  455. style={{ width: 160 }}
  456. value={this.state.paymentAmount}
  457. placeholder="请输入收款金额"
  458. onChange={e => {
  459. this.setState({
  460. paymentAmount: e.target.value
  461. });
  462. }}
  463. />
  464. </Form.Item>
  465. </div>
  466. <div className="clearfix">
  467. <Form.Item
  468. className="half-item"
  469. label="开票时间"
  470. labelCol={{ span: 8 }}
  471. wrapperCol={{ span: 14 }}
  472. >
  473. <DatePicker
  474. style={{ width: 160 }}
  475. value={
  476. this.state.invoiceTimes
  477. ? moment(this.state.invoiceTimes)
  478. : null
  479. }
  480. onChange={(_data, dataString) => {
  481. this.setState({
  482. invoiceTimes: dataString
  483. });
  484. }}
  485. />
  486. </Form.Item>
  487. <Form.Item
  488. className="half-item"
  489. label="开票金额(万元)"
  490. labelCol={{ span: 8 }}
  491. wrapperCol={{ span: 14 }}
  492. >
  493. <Input
  494. style={{ width: 160 }}
  495. value={this.state.invoiceAmount}
  496. placeholder="请输入开票金额"
  497. onChange={e => {
  498. this.setState({
  499. invoiceAmount: e.target.value
  500. });
  501. }}
  502. />
  503. </Form.Item>
  504. <Form.Item
  505. className="half-item"
  506. label="发生成本(万元)"
  507. labelCol={{ span: 8 }}
  508. wrapperCol={{ span: 14 }}
  509. >
  510. <Input
  511. style={{ width: 160 }}
  512. value={this.state.cwCost}
  513. placeholder="请输入发生成本"
  514. onChange={e => {
  515. this.setState({
  516. cwCost: e.target.value
  517. });
  518. }}
  519. />
  520. </Form.Item>
  521. <Form.Item
  522. className="half-item"
  523. label="应退金额(万元)"
  524. labelCol={{ span: 8 }}
  525. wrapperCol={{ span: 14 }}
  526. >
  527. <Input
  528. style={{ width: 160 }}
  529. value={this.state.refundableAmount}
  530. placeholder="请输入应退金额"
  531. onChange={e => {
  532. this.setState({
  533. refundableAmount: e.target.value
  534. });
  535. }}
  536. />
  537. </Form.Item>
  538. </div>
  539. <div>
  540. <Form.Item
  541. label="补充资料/备注"
  542. labelCol={{ span: 4 }}
  543. wrapperCol={{ span: 14 }}
  544. >
  545. <Input.TextArea
  546. rows={4}
  547. value={this.state.cwRemarks}
  548. placeholder="请输入补充资料/备注"
  549. onChange={e => {
  550. this.setState({
  551. cwRemarks: e.target.value
  552. });
  553. }}
  554. />
  555. </Form.Item>
  556. </div>
  557. </div>
  558. )}
  559. {!(
  560. (this.props.data.processState > 5 &&
  561. this.props.data.processState <= 8) ||
  562. (this.props.data.processState === 9 && this.props.data.status === 4)
  563. ) ? (
  564. this.state.buttonStatus ? (
  565. <div
  566. className="clearfix"
  567. style={{ display: "flex", justifyContent: "space-around" }}
  568. >
  569. {buttonData.map((item, index) => {
  570. return (
  571. <AgreeButton
  572. data={item}
  573. key={index}
  574. backData={this.props.data}
  575. processState={this.props.processState}
  576. visible={this.changeButtonStatus}
  577. ajaxData={this.state}
  578. loadData={this.props.loadData}
  579. />
  580. );
  581. })}
  582. </div>
  583. ) : (
  584. ""
  585. )
  586. ) : (
  587. ""
  588. )}
  589. </div>
  590. );
  591. }
  592. }
  593. export { ChangeDetail };