orderDetail.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  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. </FormItem>
  257. <FormItem className="half-item" {...formItemLayout} label="联系人电话">
  258. <span>{data.contactMobile}</span>
  259. </FormItem>
  260. <FormItem className="half-item" {...formItemLayout} label="企业法人">
  261. <span>{data.legalPerson}</span>
  262. </FormItem>
  263. <FormItem className="half-item" {...formItemLayout} label="法人电话">
  264. <span>{data.legalPersonTel}</span>
  265. </FormItem>
  266. <FormItem
  267. className="half-item"
  268. {...formItemLayout}
  269. label="签单金额(万元)"
  270. >
  271. <span>
  272. {this.props.processState === 2 ? "***" : data.totalAmount}
  273. </span>
  274. </FormItem>
  275. <FormItem
  276. className="half-item"
  277. {...formItemLayout}
  278. label="首付金额(万元)"
  279. >
  280. <span>
  281. {this.props.processState === 2 ? "***" : data.firstAmount}
  282. </span>
  283. </FormItem>
  284. <FormItem className="half-item" {...formItemLayout} label="特批立项">
  285. <span>{getApprovedState(data.approval)}</span>
  286. </FormItem>
  287. <FormItem
  288. className="half-item"
  289. {...formItemLayout}
  290. label="已收款项(万元)"
  291. >
  292. <span>
  293. {this.props.processState === 2 ? "***" : data.settlementAmount}
  294. </span>
  295. </FormItem>
  296. <FormItem className="half-item" {...formItemLayout} label="订单部门">
  297. <span>{data.depName}</span>
  298. </FormItem>
  299. <div className="clearfix">
  300. <FormItem
  301. labelCol={{ span: 4 }}
  302. wrapperCol={{ span: 16 }}
  303. label="订单留言"
  304. >
  305. <p style={{ width: 500, wordWrap: "break-word" }}>
  306. {data.orderRemarks}
  307. </p>
  308. </FormItem>
  309. </div>
  310. <div className="clearfix">
  311. <FormItem
  312. labelCol={{ span: 4 }}
  313. wrapperCol={{ span: 18 }}
  314. label="合同扫描件"
  315. >
  316. <Upload
  317. className="demandDetailShow-upload"
  318. listType="picture-card"
  319. fileList={
  320. data.contractPictureUrl
  321. ? splitUrl(
  322. data.contractPictureUrl,
  323. ",",
  324. globalConfig.avatarHost + "/upload"
  325. )
  326. : []
  327. }
  328. onPreview={file => {
  329. this.setState({
  330. previewImage: file.url || file.thumbUrl,
  331. previewVisible: true
  332. });
  333. }}
  334. />
  335. <Modal
  336. maskClosable={false}
  337. footer={null}
  338. visible={this.state.previewVisible}
  339. onCancel={() => {
  340. this.state.rotateDeg = 0;
  341. this.setState({
  342. previewVisible: false,
  343. rotateDeg: this.state.rotateDeg
  344. });
  345. }}
  346. >
  347. <img
  348. alt=""
  349. style={{
  350. width: "100%",
  351. transform: `rotate(${this.state.rotateDeg}deg)`
  352. }}
  353. src={this.state.previewImage || ""}
  354. />
  355. <Button
  356. onClick={this.rotate}
  357. style={{
  358. position: "relative",
  359. left: "50%",
  360. transform: "translateX(-50%)"
  361. }}
  362. >
  363. 旋转
  364. </Button>
  365. <Button
  366. onClick={this.upImg}
  367. style={{
  368. position: "absolute",
  369. left: -81,
  370. top: "50%",
  371. transform: "translateY(-50%)"
  372. }}
  373. >
  374. 上一张
  375. </Button>
  376. <Button
  377. onClick={this.downImg}
  378. style={{
  379. position: "absolute",
  380. right: -81,
  381. top: "50%",
  382. transform: "translateY(-50%)"
  383. }}
  384. >
  385. 下一张
  386. </Button>
  387. </Modal>
  388. <Button
  389. style={{
  390. float: "right",
  391. marginRight: "140px",
  392. marginTop: "20px"
  393. }}
  394. onClick={() => {
  395. this.props.getOrderLog(data.orderNo);
  396. }}
  397. >
  398. 查看订单日志
  399. </Button>
  400. </FormItem>
  401. </div>
  402. <div className="clearfix">
  403. <FormItem
  404. className="half-item"
  405. {...formItemLayout}
  406. label="订单负责人"
  407. >
  408. <span>{data.salesmanName}</span>
  409. </FormItem>
  410. <FormItem
  411. className="half-item"
  412. {...formItemLayout}
  413. label="订单负责人电话"
  414. >
  415. <span>{data.salesmanMobile}</span>
  416. </FormItem>
  417. </div>
  418. <div className="clearfix">
  419. <FormItem
  420. className="half-item"
  421. {...formItemLayout}
  422. label="当前财务负责人"
  423. >
  424. <span>{data.nowFinance}</span>
  425. </FormItem>
  426. <FormItem
  427. className="half-item"
  428. {...formItemLayout}
  429. label="当前财务负责人电话"
  430. >
  431. <span>{data.nowFinanceMobile}</span>
  432. </FormItem>
  433. </div>
  434. <div className="clearfix">
  435. <FormItem
  436. className="half-item"
  437. {...formItemLayout}
  438. style={{ opacity: ".5" }}
  439. label="原订单负责人"
  440. >
  441. <span>{data.oldSalesmanName}</span>
  442. </FormItem>
  443. <FormItem
  444. className="half-item"
  445. {...formItemLayout}
  446. style={{ opacity: ".5" }}
  447. label="原订单负责人电话"
  448. >
  449. <span>{data.oldSalesmanMobile}</span>
  450. </FormItem>
  451. </div>
  452. <div className="clearfix">
  453. <FormItem
  454. className="half-item"
  455. style={{ opacity: ".5" }}
  456. {...formItemLayout}
  457. label="实际财务操作人"
  458. >
  459. <span>{data.financeName}</span>
  460. </FormItem>
  461. <FormItem
  462. className="half-item"
  463. {...formItemLayout}
  464. style={{ opacity: ".5" }}
  465. label="实际财务操作人电话"
  466. >
  467. <span>{data.financeMobile}</span>
  468. </FormItem>
  469. </div>
  470. <div>
  471. <span style={{ marginLeft: "50px", fontSize: "20px" }}>催款节点</span>
  472. </div>
  473. <div className="clearfix">
  474. <Form layout="horizontal" id="demand-form">
  475. <Table
  476. pagination={false}
  477. columns={this.state.ContactsLists}
  478. dataSource={this.props.contactList}
  479. />
  480. <Col span={24} offset={9} style={{ marginTop: "15px" }}></Col>
  481. </Form>
  482. </div>
  483. <div>
  484. <span style={{ marginLeft: "50px", fontSize: "20px" }}>项目业务</span>
  485. </div>
  486. <div className="patent-table">
  487. <Table
  488. columns={this.state.columnsX}
  489. pagination={false}
  490. dataSource={this.props.dataSourceX}
  491. onRowClick={this.tableRowClickX}
  492. />
  493. </div>
  494. <Modal
  495. maskClosable={false}
  496. visible={this.state.visible}
  497. onOk={this.nextCancel}
  498. onCancel={this.nextCancel}
  499. width="800px"
  500. title={"项目任务详情"}
  501. footer=""
  502. className="admin-desc-content"
  503. >
  504. <Form layout="horizontal" id="demand-form">
  505. <div className="clearfix">
  506. <FormItem
  507. className="half-item"
  508. {...formItemLayout}
  509. label="项目名称"
  510. >
  511. <span>{this.state.commodityName}</span>
  512. </FormItem>
  513. <FormItem
  514. className="half-item"
  515. {...formItemLayout}
  516. label="项目数量"
  517. >
  518. <span>{this.state.commodityQuantity}</span>
  519. </FormItem>
  520. <FormItem
  521. className="half-item"
  522. {...formItemLayout}
  523. label="金额(万元)"
  524. >
  525. <span>{this.state.commodityPrice}</span>
  526. </FormItem>
  527. <FormItem
  528. className="half-item"
  529. {...formItemLayout}
  530. label="主要项目"
  531. >
  532. <span>{getboutique(this.state.main)}</span>
  533. </FormItem>
  534. <div className="clearfix">
  535. <FormItem
  536. labelCol={{ span: 4 }}
  537. wrapperCol={{ span: 16 }}
  538. label="服务说明"
  539. >
  540. <span>{this.state.taskComment}</span>
  541. </FormItem>
  542. </div>
  543. </div>
  544. </Form>
  545. </Modal>
  546. </div>
  547. );
  548. }
  549. }
  550. export default OrderDetail;