orderDetail.js 16 KB

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