orderDetail.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. import React, { Component } from "react";
  2. import { Form, Upload, Modal, Button, Table, Col, message, Tag } from "antd";
  3. import {
  4. splitUrl,
  5. getProcessStatus,
  6. getjiedian,
  7. getLiquidationStatus,
  8. getboutique,
  9. getCuikuan,
  10. getApprovedState,
  11. getProjectStatus
  12. } from "@/tools.js";
  13. import img from "./img.png"
  14. import ResolutionDetail from "@/resolutionDetail";
  15. const FormItem = Form.Item;
  16. class OrderDetail extends Component {
  17. constructor(props) {
  18. super(props);
  19. this.state = {
  20. newContactsLists: [
  21. {
  22. title: "项目名称",
  23. dataIndex: "commodityName",
  24. key: "commodityName",
  25. render: text => {
  26. return <span>{text}</span>;
  27. }
  28. },
  29. {
  30. title: "项目分类",
  31. dataIndex: "projectType",
  32. key: "projectType",
  33. render: text => {
  34. let arr = this.props.dataSourceX || [];
  35. let str = "";
  36. for (let i = 0; i < arr.length; i++) {
  37. if (this.props.dataSourceX[i].sort == text) {
  38. str = this.props.dataSourceX[i].cname;
  39. return <span>{str}</span>;
  40. }
  41. }
  42. }
  43. },
  44. {
  45. title: "催款科目",
  46. dataIndex: "dunTypeName",
  47. key: "dunTypeName",
  48. render: text => {
  49. return <span>{text}</span>;
  50. }
  51. },
  52. {
  53. title: "时间",
  54. dataIndex: "waitDay",
  55. key: "waitDay",
  56. render: (text, record) => {
  57. if (record.dunTypeName) {
  58. return <span>{text}</span>;
  59. }
  60. }
  61. },
  62. {
  63. title: "金额(万元)",
  64. dataIndex: "money",
  65. key: "money",
  66. render: (text, record) => {
  67. if (record.dunTypeName) {
  68. if (record.appropriationRatio && !record.money) {
  69. return <span>{record.appropriationRatio}(拨款比例)</span>;
  70. } else if (record.appropriationRatio && record.money) {
  71. return (
  72. <span>
  73. {text}(比例:{record.appropriationRatio})
  74. </span>
  75. );
  76. } else {
  77. return <span>{text}</span>;
  78. }
  79. }
  80. }
  81. },
  82. {
  83. title: "服务年限",
  84. dataIndex: "startDate",
  85. key: "startDate",
  86. render: (text, record) => {
  87. if (record.dunTypeName) {
  88. return <span>{text}</span>;
  89. }
  90. }
  91. },
  92. {
  93. title: "催款状态",
  94. dataIndex: "status",
  95. key: "status",
  96. render: text => {
  97. return <span>{text == 1 ? "已启动" : "未启动"}</span>;
  98. }
  99. }
  100. ],
  101. ContactsLists: [
  102. {
  103. title: "催款科目",
  104. dataIndex: "dunSubject",
  105. key: "dunSubject",
  106. render: text => {
  107. return getjiedian(text);
  108. }
  109. },
  110. {
  111. title: "金额(万元)",
  112. dataIndex: "money",
  113. key: "money"
  114. },
  115. {
  116. title: "催款状态",
  117. dataIndex: "dunStatus",
  118. key: "dunStatus",
  119. render: text => {
  120. return getCuikuan(text);
  121. }
  122. }
  123. ],
  124. resVisible: false,
  125. columnsX: [
  126. {
  127. title: "业务项目名称",
  128. dataIndex: "commodityName",
  129. key: "commodityName"
  130. },
  131. {
  132. title: "项目类别",
  133. dataIndex: "cname",
  134. key: "cname"
  135. },
  136. {
  137. title: "项目数量",
  138. dataIndex: "commodityQuantity",
  139. key: "commodityQuantity",
  140. render: (text, record) => {
  141. if (record.splitStatus == 1) {
  142. return (
  143. <span>
  144. {text}{" "}
  145. <Tag
  146. color="#108ee9"
  147. onClick={e => {
  148. e.stopPropagation();
  149. this.showRes(record);
  150. }}
  151. >
  152. 已拆
  153. </Tag>
  154. </span>
  155. );
  156. } else {
  157. return text;
  158. }
  159. }
  160. },
  161. {
  162. title: "金额(万元)",
  163. dataIndex: "commodityPrice",
  164. key: "commodityPrice",
  165. render: text => {
  166. return this.props.processState === 2 ? "***" : text;
  167. }
  168. },
  169. {
  170. title: "负责人",
  171. dataIndex: "contacts",
  172. key: "contacts"
  173. },
  174. {
  175. title: "负责人电话",
  176. dataIndex: "contactsMobile",
  177. key: "contactsMobile"
  178. },
  179. {
  180. title: "项目状态",
  181. dataIndex: "projectStatus",
  182. key: "projectStatus",
  183. render: text => {
  184. return getProjectStatus(text);
  185. }
  186. },
  187. {
  188. title: "主要项目",
  189. dataIndex: "main",
  190. key: "main",
  191. render: text => {
  192. return text ? "是" : "否";
  193. }
  194. },
  195. {
  196. title: "项目说明",
  197. dataIndex: "taskComment",
  198. key: "taskComment",
  199. render: text => {
  200. return text && text.length > 8 ? text.substr(0, 8) + "…" : text;
  201. }
  202. }
  203. ],
  204. rotateDeg: 0
  205. };
  206. this.tableRowClickX = this.tableRowClickX.bind(this);
  207. this.nextCancel = this.nextCancel.bind(this);
  208. this.rotate = this.rotate.bind(this);
  209. this.downImg = this.downImg.bind(this);
  210. this.upImg = this.upImg.bind(this);
  211. this.showRes = this.showRes.bind(this);
  212. this.resCancel = this.resCancel.bind(this);
  213. }
  214. rotate() {
  215. let rotateDeg = this.state.rotateDeg + 90;
  216. this.setState({
  217. rotateDeg
  218. });
  219. }
  220. //项目详情关闭
  221. nextCancel() {
  222. this.setState({
  223. visible: false
  224. });
  225. }
  226. //点击打卡项目详情
  227. tableRowClickX(record) {
  228. this.setState({
  229. jid: record.id, //项目ID
  230. kid: record.commodityId, //商品ID
  231. commodityName: record.commodityName, //金额
  232. commodityPrice: record.commodityPrice, //金额
  233. commodityQuantity: record.commodityQuantity, //数量
  234. taskComment: record.taskComment, //备注
  235. main: record.main.toString(), //是否为主要
  236. visible: true,
  237. addState: 0
  238. });
  239. }
  240. downImg() {
  241. console.log(this.props.pictureUrl);
  242. const data = this.props.orderData;
  243. let num = 0;
  244. for (
  245. let i = 0;
  246. i <
  247. splitUrl(
  248. data.contractPictureUrl,
  249. ",",
  250. globalConfig.avatarHost + "/upload"
  251. ).length;
  252. i++
  253. ) {
  254. if (
  255. splitUrl(
  256. data.contractPictureUrl,
  257. ",",
  258. globalConfig.avatarHost + "/upload"
  259. )[i].url == this.state.previewImage
  260. ) {
  261. num = i;
  262. }
  263. }
  264. if (
  265. num ==
  266. splitUrl(
  267. data.contractPictureUrl,
  268. ",",
  269. globalConfig.avatarHost + "/upload"
  270. ).length -
  271. 1
  272. ) {
  273. return message.warning("已经是最后一张了哦");
  274. }
  275. this.state.previewImage = splitUrl(
  276. data.contractPictureUrl,
  277. ",",
  278. globalConfig.avatarHost + "/upload"
  279. )[num + 1].url;
  280. this.setState({
  281. previewImage: this.state.previewImage,
  282. rotateDeg: 0
  283. });
  284. }
  285. upImg() {
  286. const data = this.props.orderData;
  287. let num = 0;
  288. for (
  289. let i = 0;
  290. i <
  291. splitUrl(
  292. data.contractPictureUrl,
  293. ",",
  294. globalConfig.avatarHost + "/upload"
  295. ).length;
  296. i++
  297. ) {
  298. if (
  299. splitUrl(
  300. data.contractPictureUrl,
  301. ",",
  302. globalConfig.avatarHost + "/upload"
  303. )[i].url == this.state.previewImage
  304. ) {
  305. num = i;
  306. }
  307. }
  308. if (num == 0) {
  309. return message.warning("已经是第一张了哦");
  310. }
  311. this.state.previewImage = splitUrl(
  312. data.contractPictureUrl,
  313. ",",
  314. globalConfig.avatarHost + "/upload"
  315. )[num - 1].url;
  316. this.setState({
  317. previewImage: this.state.previewImage,
  318. rotateDeg: 0
  319. });
  320. }
  321. // 拆分详细
  322. showRes(record) {
  323. this.setState({
  324. resVisible: true,
  325. resRecord: record
  326. })
  327. }
  328. resCancel() {
  329. this.setState({
  330. resVisible: false
  331. })
  332. }
  333. render() {
  334. const formItemLayout = {
  335. labelCol: { span: 8 },
  336. wrapperCol: { span: 14 }
  337. };
  338. const data = this.props.orderData;
  339. const propsList = this.props.contactList || [];
  340. return (
  341. <div
  342. className="clearfix"
  343. ref={e => {
  344. this.refs = e;
  345. }}
  346. >
  347. {this.state.resVisible ? (
  348. <ResolutionDetail
  349. cancel={this.resCancel}
  350. detail={this.state.resRecord}
  351. visible={this.state.resVisible}
  352. id={this.state.resRecord.orderNo}
  353. />
  354. ) : (
  355. ""
  356. )}
  357. <FormItem className="half-item" {...formItemLayout} label="订单编号">
  358. <span>{data.orderNo}</span>
  359. </FormItem>
  360. <FormItem className="half-item" {...formItemLayout} label="合同编号">
  361. <span>{data.contractNo}</span>
  362. </FormItem>
  363. <FormItem className="half-item" {...formItemLayout} label="客户名称">
  364. <span>{data.userName}</span>
  365. </FormItem>
  366. <FormItem
  367. className="half-item"
  368. {...formItemLayout}
  369. label="合同签订时间"
  370. >
  371. <span>{data.signDate}</span>
  372. </FormItem>
  373. <FormItem className="half-item" {...formItemLayout} label="流程状态">
  374. <span>{getProcessStatus(data.processStatus)}</span>
  375. </FormItem>
  376. <FormItem className="half-item" {...formItemLayout} label="结算状态">
  377. <span>{getLiquidationStatus(data.liquidationStatus)}</span>
  378. </FormItem>
  379. <FormItem className="half-item" {...formItemLayout} label="企业联系人">
  380. {/* <span>{data.contacts}</span> */}
  381. <span>{this.props.isCaiWu ? "***" : data.contacts}</span>
  382. </FormItem>
  383. <FormItem className="half-item" {...formItemLayout} label="联系人电话">
  384. {/* <span>{data.contactMobile}</span> */}
  385. <span>{this.props.isCaiWu ? "***" : data.contactMobile}</span>
  386. </FormItem>
  387. <FormItem className="half-item" {...formItemLayout} label="企业法人">
  388. <span>{this.props.isCaiWu ? "***" : data.legalPerson}</span>
  389. </FormItem>
  390. <FormItem className="half-item" {...formItemLayout} label="法人电话">
  391. {/* <span>{data.legalPersonTel}</span> */}
  392. <span>{this.props.isCaiWu ? "***" : data.legalPersonTel}</span>
  393. </FormItem>
  394. <FormItem
  395. className="half-item"
  396. {...formItemLayout}
  397. label="签单金额(万元)"
  398. >
  399. <span>
  400. {this.props.processState === 2 ? "***" : data.totalAmount}
  401. </span>
  402. </FormItem>
  403. <FormItem
  404. className="half-item"
  405. {...formItemLayout}
  406. label="首付金额(万元)"
  407. >
  408. <span>
  409. {this.props.processState === 2 ? "***" : data.firstAmount}
  410. </span>
  411. </FormItem>
  412. <FormItem className="half-item" {...formItemLayout} label="特批立项">
  413. <span>{getApprovedState(data.approval)}</span>
  414. </FormItem>
  415. <FormItem
  416. className="half-item"
  417. {...formItemLayout}
  418. label="已收款项(万元)"
  419. >
  420. <span>
  421. {this.props.processState === 2 ? "***" : data.settlementAmount}
  422. </span>
  423. </FormItem>
  424. <FormItem className="half-item" {...formItemLayout} label="订单部门">
  425. <span>{data.depName}</span>
  426. </FormItem>
  427. <FormItem className="half-item" {...formItemLayout} label="是否外包">
  428. {data.outsource == 0 ? "否" : "是"}
  429. </FormItem>
  430. <div className="clearfix">
  431. <FormItem
  432. labelCol={{ span: 4 }}
  433. wrapperCol={{ span: 16 }}
  434. label="订单留言"
  435. >
  436. <p style={{ width: 500, wordWrap: "break-word" }}>
  437. {data.orderRemarks}
  438. </p>
  439. </FormItem>
  440. </div>
  441. <div className="clearfix">
  442. <FormItem
  443. labelCol={{ span: 4 }}
  444. wrapperCol={{ span: 18 }}
  445. label="合同扫描件"
  446. >
  447. <Upload
  448. className="demandDetailShow-upload"
  449. listType="picture-card"
  450. fileList={
  451. data.contractPictureUrl
  452. ? splitUrl(
  453. data.contractPictureUrl,
  454. ",",
  455. globalConfig.avatarHost + "/upload"
  456. )
  457. : []
  458. }
  459. onPreview={file => {
  460. this.setState({
  461. previewImage: file.url || file.thumbUrl,
  462. previewVisible: true
  463. });
  464. }}
  465. />
  466. <Modal
  467. maskClosable={false}
  468. footer={null}
  469. visible={this.state.previewVisible}
  470. onCancel={() => {
  471. this.state.rotateDeg = 0;
  472. this.setState({
  473. previewVisible: false,
  474. rotateDeg: this.state.rotateDeg
  475. });
  476. }}
  477. >
  478. <img
  479. alt=""
  480. style={{
  481. width: "100%",
  482. transform: `rotate(${this.state.rotateDeg}deg)`
  483. }}
  484. src={this.state.previewImage || ""}
  485. />
  486. <Button
  487. onClick={this.rotate}
  488. style={{
  489. position: "relative",
  490. left: "50%",
  491. transform: "translateX(-50%)"
  492. }}
  493. >
  494. 旋转
  495. </Button>
  496. <Button
  497. onClick={this.upImg}
  498. style={{
  499. position: "absolute",
  500. left: -81,
  501. top: "50%",
  502. transform: "translateY(-50%)"
  503. }}
  504. >
  505. 上一张
  506. </Button>
  507. <Button
  508. onClick={this.downImg}
  509. style={{
  510. position: "absolute",
  511. right: -81,
  512. top: "50%",
  513. transform: "translateY(-50%)"
  514. }}
  515. >
  516. 下一张
  517. </Button>
  518. </Modal>
  519. <Button
  520. style={{
  521. float: "right",
  522. marginRight: "140px",
  523. marginTop: "20px"
  524. }}
  525. onClick={() => {
  526. this.props.getOrderLog(data.orderNo);
  527. }}
  528. >
  529. 查看订单日志
  530. </Button>
  531. </FormItem>
  532. </div>
  533. <div className="clearfix">
  534. <FormItem
  535. className="half-item"
  536. {...formItemLayout}
  537. label="订单负责人"
  538. >
  539. <span>{data.salesmanName}</span>
  540. </FormItem>
  541. <FormItem
  542. className="half-item"
  543. {...formItemLayout}
  544. label="订单负责人电话"
  545. >
  546. <span>{data.salesmanMobile}</span>
  547. </FormItem>
  548. </div>
  549. <div className="clearfix">
  550. <FormItem
  551. className="half-item"
  552. {...formItemLayout}
  553. label="当前财务负责人"
  554. >
  555. <span>{data.nowFinance}</span>
  556. </FormItem>
  557. <FormItem
  558. className="half-item"
  559. {...formItemLayout}
  560. label="当前财务负责人电话"
  561. >
  562. <span>{data.nowFinanceMobile}</span>
  563. </FormItem>
  564. </div>
  565. <div className="clearfix">
  566. <FormItem
  567. className="half-item"
  568. {...formItemLayout}
  569. style={{ opacity: ".5" }}
  570. label="原订单负责人"
  571. >
  572. <span>{data.oldSalesmanName}</span>
  573. </FormItem>
  574. <FormItem
  575. className="half-item"
  576. {...formItemLayout}
  577. style={{ opacity: ".5" }}
  578. label="原订单负责人电话"
  579. >
  580. <span>{data.oldSalesmanMobile}</span>
  581. </FormItem>
  582. </div>
  583. <div className="clearfix">
  584. <FormItem
  585. className="half-item"
  586. style={{ opacity: ".5" }}
  587. {...formItemLayout}
  588. label="实际财务操作人"
  589. >
  590. <span>{data.financeName}</span>
  591. </FormItem>
  592. <FormItem
  593. className="half-item"
  594. {...formItemLayout}
  595. style={{ opacity: ".5" }}
  596. label="实际财务操作人电话"
  597. >
  598. <span>{data.financeMobile}</span>
  599. </FormItem>
  600. </div>
  601. <div>
  602. <span style={{ marginLeft: "50px", fontSize: "20px" }}>项目业务</span>
  603. </div>
  604. <div className="patent-table">
  605. <Table
  606. columns={this.state.columnsX}
  607. pagination={false}
  608. dataSource={this.props.dataSourceX}
  609. onRowClick={this.tableRowClickX}
  610. bordered
  611. size="small"
  612. />
  613. </div>
  614. <div>
  615. <span style={{ marginLeft: "50px", fontSize: "20px" }}>催款节点</span>
  616. <span
  617. style={{
  618. display: propsList.length ? "none" : "inline-block",
  619. marginLeft: 10,
  620. color: "red"
  621. }}
  622. >
  623. 金额总计(万元): {this.props.totalCui}
  624. </span>
  625. </div>
  626. <div className="clearfix">
  627. <Form layout="horizontal" id="demand-form">
  628. <Table
  629. pagination={false}
  630. bordered
  631. size="small"
  632. // columns={this.state.ContactsLists}
  633. columns={
  634. propsList.length
  635. ? this.state.ContactsLists
  636. : this.state.newContactsLists
  637. }
  638. dataSource={
  639. propsList.length
  640. ? this.props.contactList
  641. : this.props.contactListNew
  642. }
  643. />
  644. <Col span={24} offset={9} style={{ marginTop: "15px" }}></Col>
  645. </Form>
  646. </div>
  647. <Modal
  648. maskClosable={false}
  649. visible={this.state.visible}
  650. onOk={this.nextCancel}
  651. onCancel={this.nextCancel}
  652. width="800px"
  653. title={"项目任务详情"}
  654. footer=""
  655. className="admin-desc-content"
  656. >
  657. <Form layout="horizontal" id="demand-form">
  658. <div className="clearfix">
  659. <FormItem
  660. className="half-item"
  661. {...formItemLayout}
  662. label="项目名称"
  663. >
  664. <span>{this.state.commodityName}</span>
  665. </FormItem>
  666. <FormItem
  667. className="half-item"
  668. {...formItemLayout}
  669. label="项目数量"
  670. >
  671. <span>{this.state.commodityQuantity}</span>
  672. </FormItem>
  673. <FormItem
  674. className="half-item"
  675. {...formItemLayout}
  676. label="金额(万元)"
  677. >
  678. <span>{this.state.commodityPrice}</span>
  679. </FormItem>
  680. <FormItem
  681. className="half-item"
  682. {...formItemLayout}
  683. label="主要项目"
  684. >
  685. <span>{getboutique(this.state.main)}</span>
  686. </FormItem>
  687. <div className="clearfix">
  688. <FormItem
  689. labelCol={{ span: 4 }}
  690. wrapperCol={{ span: 16 }}
  691. label="服务说明"
  692. >
  693. <span>{this.state.taskComment}</span>
  694. </FormItem>
  695. </div>
  696. </div>
  697. </Form>
  698. </Modal>
  699. </div>
  700. );
  701. }
  702. }
  703. export default OrderDetail;