orderDetail.jsx 25 KB

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