TopUp.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="filter.pageVo"
  5. class="filter-container"
  6. label-position="right">
  7. <div class="filter-view">
  8. <el-form-item>
  9. <el-input
  10. clearable
  11. v-model="filter.pageVo.criteria"
  12. placeholder="Search by Number/Email"
  13. @keyup.enter.native="handleFilter" />
  14. </el-form-item>
  15. <el-form-item>
  16. <el-date-picker
  17. v-model="filter.pageVo.date"
  18. type="month"
  19. format="yyyy-MM"
  20. value-format="yyyy-MM"
  21. placeholder="Filter Date"/>
  22. </el-form-item>
  23. <div>
  24. <el-button
  25. type="primary"
  26. icon="el-icon-search"
  27. @click="getTableData">
  28. Search
  29. </el-button>
  30. </div>
  31. </div>
  32. </el-form>
  33. <el-table
  34. :data="table.list"
  35. v-loading="loading">
  36. <el-table-column
  37. label="Transaction ID"
  38. align="center"
  39. prop="creditHistoryPk"/>
  40. <el-table-column
  41. label="User ID"
  42. align="center"
  43. width="80">
  44. <template slot-scope="{row}">
  45. <span>{{ row.userPk }}</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column
  49. label="Email"
  50. align="center">
  51. <template slot-scope="{row}">
  52. <span :title="row.email">{{ row.email }}</span>
  53. </template>
  54. </el-table-column>
  55. <el-table-column
  56. label="Platform"
  57. align="center"
  58. prop="paymentPlatform"/>
  59. <el-table-column
  60. label="Top Up Type"
  61. align="center"
  62. prop="payType"/>
  63. <el-table-column
  64. label="Amount"
  65. align="center"
  66. prop="amount"/>
  67. <el-table-column
  68. label="Creation Time"
  69. align="center"
  70. prop="creationTime"/>
  71. <el-table-column
  72. label="Payment Status"
  73. align="center"
  74. prop="paymentStatus"/>
  75. <el-table-column
  76. label="Payment Reference"
  77. align="center"
  78. prop="paymentReference"
  79. width="150px">
  80. <template v-slot="{ row }">
  81. <div @dblclick="copyReference(row.paymentReference)">
  82. <el-input
  83. type="textarea"
  84. readonly
  85. v-model="row.paymentReference"
  86. class="payment-reference"
  87. :title="row.paymentReference"/>
  88. </div>
  89. </template>
  90. <template slot="header">
  91. <div title="Double click to copy">Payment Reference</div>
  92. </template>
  93. </el-table-column>
  94. <el-table-column
  95. label="Update Time"
  96. align="center"
  97. prop="updateTime"/>
  98. </el-table>
  99. <div class="right">
  100. <Pagination
  101. v-show="table.total > 0"
  102. :total="table.total"
  103. :page.sync="filter.pageNo"
  104. :limit.sync="filter.pageSize"
  105. @pagination="getTableData" />
  106. </div>
  107. </div>
  108. </template>
  109. <script>
  110. import site from '@/http/api/site'
  111. import ocpp from '@/http/api/ocpp'
  112. import financial from '@/http/api/financial'
  113. import Pagination from '@/components/Pagination'
  114. import handleClipboard from '@/utils/clipboard'
  115. export default {
  116. data() {
  117. return {
  118. loading: false,
  119. listLoading: false,
  120. siteOptions: [],
  121. stationOptions: [],
  122. table: {
  123. list: [],
  124. total: 0
  125. },
  126. filter: {
  127. pageNo: 1,
  128. pageSize: 10,
  129. pageVo: {
  130. date: "",
  131. sitePk: "",
  132. criteria: "",
  133. chargeBoxId: ""
  134. }
  135. },
  136. }
  137. },
  138. components: { Pagination },
  139. created() {
  140. //this.getSiteOptions()
  141. this.getTableData()
  142. },
  143. methods: {
  144. getSiteOptions(search) {
  145. site.getAllSiteList({siteName: search ?? ""}).then(res => {
  146. if (res.data && res.data.length > 0) {
  147. this.siteOptions = res.data
  148. }
  149. });
  150. },
  151. getStationOptions() {
  152. this.listLoading = true;
  153. ocpp.getStationPages({
  154. pageNo: 1,
  155. pageSize: 20,
  156. pageVo: {
  157. date: "",
  158. sitePk: this.filter.pageVo.sitePk
  159. }
  160. }).then(res => {
  161. if (res.data) {
  162. this.stationOptions = res.data;
  163. }
  164. }).finally(() => {
  165. this.listLoading = false;
  166. })
  167. },
  168. getTableData() {
  169. this.loading = true;
  170. financial.getTopUpPages(this.filter).then(res => {
  171. this.loading = false;
  172. if (res.data) {
  173. this.table.total = res.total
  174. this.table.list = res.data
  175. }
  176. }).catch(err => {
  177. this.loading = false;
  178. this.$message({
  179. message: err,
  180. type: 'error'
  181. })
  182. })
  183. },
  184. copyReference(data) {
  185. handleClipboard(data)
  186. }
  187. }
  188. }
  189. </script>
  190. <style>
  191. .payment-reference {
  192. width: 100%;
  193. }
  194. .payment-reference .el-textarea__inner {
  195. border: none;
  196. }
  197. </style>