refund.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. import React, { Component } from "react";
  2. import { Modal, Table, Button, message, Spin, Upload } from "antd";
  3. import $ from "jquery/src/ajax";
  4. import "./table.less";
  5. import {
  6. splitUrl,
  7. } from "@/tools.js";
  8. import ImgList from "../../../../common/imgList";
  9. class Refund extends Component {
  10. constructor(props) {
  11. super(props);
  12. this.state = {
  13. visible: false,
  14. dataSource: [],
  15. loading: false,
  16. columns: [
  17. {
  18. title: "退款金额(万元)",
  19. dataIndex: "refundAmount",
  20. key: "refundAmount",
  21. },
  22. {
  23. title: "退款时间",
  24. dataIndex: "refundDate",
  25. key: "refundDate"
  26. },
  27. {
  28. title: "备注",
  29. dataIndex: "remarks",
  30. key: "remarks"
  31. },
  32. ],
  33. };
  34. }
  35. componentDidMount() {
  36. if (this.props.dataSource) {
  37. return
  38. }
  39. this.loadData()
  40. }
  41. loadData() {
  42. this.setState({
  43. loading: true
  44. });
  45. $.ajax({
  46. method: "get",
  47. dataType: "json",
  48. crossDomain: false,
  49. url: globalConfig.context + "/api/admin/orderChange/listRefund",
  50. data: {
  51. id: this.props.id
  52. },
  53. success: function (data) {
  54. if (data.error.length || data.data.list == "") {
  55. if (data.error && data.error.length) {
  56. message.warning(data.error[0].message);
  57. }
  58. } else {
  59. this.setState({
  60. dataSource: data.data
  61. });
  62. }
  63. }.bind(this)
  64. }).always(
  65. function () {
  66. this.setState({
  67. loading: false
  68. });
  69. }.bind(this)
  70. );
  71. }
  72. render() {
  73. const urlStr = this.props.data.refundUrl
  74. const orgCodeUrl = urlStr ? splitUrl(
  75. urlStr,
  76. ",",
  77. globalConfig.avatarHost + "/upload"
  78. )
  79. : []
  80. return (
  81. <div
  82. style={{
  83. position: "relative",
  84. display:
  85. (this.props.data.processState == 8 ||
  86. this.props.data.processState == 9) &&
  87. this.props.data.status == 4
  88. ? "block"
  89. : "none",
  90. marginTop: 10
  91. }}
  92. >
  93. <hr style={{ marginTop: 12, marginBottom: 10, backgroundColor: "black", height: 1, border: "none" }} />
  94. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10, display: "inline-block" }}>
  95. 执行退款 <span style={{ fontSize: 12, fontWeight: "normal", color: "red" }}>(注:执行退款,系统将从已收款金额中直接减款)</span>
  96. </h3>
  97. <Table
  98. pagination={false}
  99. bordered
  100. columns={this.state.columns}
  101. dataSource={this.props.dataSource ? this.props.dataSource : this.state.dataSource}
  102. size="small"
  103. scroll={{ x: "max-content", y: 0 }}
  104. />
  105. <div className="clearfix">
  106. <h3 style={{ marginLeft: 20, fontWeight: 800, marginBottom: 10 }}>
  107. 退款凭证
  108. </h3>
  109. <div style={{ marginLeft: 20 }}>
  110. {/*<Upload*/}
  111. {/* className="demandDetailShow-upload"*/}
  112. {/* listType="picture-card"*/}
  113. {/* fileList={orgCodeUrl}*/}
  114. {/* onPreview={file => {*/}
  115. {/* this.setState({*/}
  116. {/* previewImage: file.url || file.thumbUrl,*/}
  117. {/* previewVisible: true*/}
  118. {/* });*/}
  119. {/* }}*/}
  120. {/*/>*/}
  121. {orgCodeUrl ? <div style={{paddingTop:'10px',paddingBottom:'10px'}}>
  122. <ImgList fileList={orgCodeUrl} domId={'refund1'}/>
  123. </div> : <div/>}
  124. <Modal
  125. maskClosable={false}
  126. footer={null}
  127. visible={this.state.previewVisible}
  128. onCancel={() => {
  129. this.setState({ previewVisible: false, rotateDeg: 0 }, () => {
  130. });
  131. }}
  132. >
  133. <img
  134. alt=""
  135. style={{
  136. width: "100%",
  137. transform: `rotate(${this.state.rotateDeg}deg)`
  138. }}
  139. src={this.state.previewImage || ""}
  140. />
  141. {/* <Button
  142. onClick={this.rotate}
  143. style={{
  144. position: "relative",
  145. left: "50%",
  146. transform: "translateX(-50%)"
  147. }}
  148. >
  149. 旋转
  150. </Button>
  151. <Button
  152. onClick={this.upImg}
  153. style={{
  154. position: "absolute",
  155. left: -81,
  156. top: "50%",
  157. transform: "translateY(-50%)"
  158. }}
  159. >
  160. 上一张
  161. </Button>
  162. <Button
  163. onClick={this.downImg}
  164. style={{
  165. position: "absolute",
  166. right: -81,
  167. top: "50%",
  168. transform: "translateY(-50%)"
  169. }}
  170. >
  171. 下一张
  172. </Button> */}
  173. </Modal>
  174. </div>
  175. </div>
  176. </div>
  177. );
  178. }
  179. }
  180. export default Refund;