CreditAmendment.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <div class="filter-view">
  5. <el-date-picker
  6. v-model="filters.pageCriteria.dateRange"
  7. type="daterange"
  8. value-format="yyyy-MM-dd"
  9. start-placeholder="Start Date"
  10. end-placeholder="End Date"
  11. clearable
  12. class="filter-view-item"
  13. @change="toSearch"/>
  14. <el-select
  15. class="filter-view-item"
  16. v-model="filters.pageCriteria.creditActionType"
  17. placeholder="Credit Action"
  18. @change="toSearch"
  19. clearable>
  20. <el-option
  21. v-for="item in options.action"
  22. :key="item"
  23. :label="item"
  24. :value="item" />
  25. </el-select>
  26. <el-select
  27. class="filter-view-item"
  28. v-model="filters.pageCriteria.creditActionStatus"
  29. placeholder="Status"
  30. @change="toSearch"
  31. clearable>
  32. <el-option
  33. v-for="item in options.status"
  34. :key="item"
  35. :label="item"
  36. :value="item" />
  37. </el-select>
  38. <el-input
  39. v-model="filters.pageCriteria.criteria"
  40. placeholder="E-mail, Request ID"
  41. prefix-icon="el-icon-search"
  42. style="max-width: 300px;"
  43. @change="toSearch"
  44. @keyup.enter.native="toSearch"
  45. clearable/>
  46. <div class="filter-flex-button">
  47. <el-button
  48. type="primary"
  49. @click="onClickAdd"
  50. v-if="!$route.meta.onlyView">
  51. Amend Credit
  52. </el-button>
  53. </div>
  54. </div>
  55. </div>
  56. <el-table
  57. v-loading="table.loading"
  58. :data="table.list">
  59. <el-table-column
  60. align="center"
  61. label="Request ID"
  62. prop="entityName"
  63. min-width="170">
  64. <template slot-scope="{row}">
  65. <div
  66. class="link-type"
  67. @click="onClickEdit(row)">
  68. {{row.creditActionId}}
  69. </div>
  70. </template>
  71. </el-table-column>
  72. <el-table-column
  73. align="center"
  74. label="User E-mail"
  75. prop="userEmail"
  76. min-width="150"/>
  77. <el-table-column
  78. align="center"
  79. label="Current Balance"
  80. prop="currentBalance"
  81. min-width="150"/>
  82. <el-table-column
  83. align="center"
  84. label="Credit Action"
  85. prop="creditActionType"
  86. min-width="150"/>
  87. <el-table-column
  88. align="center"
  89. label="Amount"
  90. prop="creditActionAmount"
  91. min-width="150"/>
  92. <el-table-column
  93. align="center"
  94. label="Remarks"
  95. prop="creditActionRemarks"
  96. min-width="150"/>
  97. <el-table-column
  98. align="center"
  99. label="Status"
  100. prop="creditActionStatus"
  101. min-width="150">
  102. <template slot-scope="{row}">
  103. <div
  104. :class="'action-status ' + row.creditActionStatus"
  105. @click="onClickEdit(row)">
  106. {{row.creditActionStatus}}
  107. </div>
  108. </template>
  109. </el-table-column>
  110. </el-table>
  111. <div class="right">
  112. <pagination
  113. v-show="table.total > 0"
  114. :total="table.total"
  115. :page.sync="filters.pageNum"
  116. :limit.sync="filters.pageSize"
  117. @pagination="getTableData" />
  118. </div>
  119. <CreditActionDialog
  120. v-bind="dialog"
  121. @hide="hideDialog"/>
  122. </div>
  123. </template>
  124. <script>
  125. import financial from '@/http/api/financial';
  126. import Pagination from '@/components/Pagination';
  127. import CreditActionDialog from './CreditActionDialog.vue';
  128. export default {
  129. data() {
  130. return {
  131. filters: {
  132. pageNum: 1,
  133. pageSize: 10,
  134. pageCriteria: {
  135. criteria: "",
  136. dateRange: [],
  137. creditActionType: "",
  138. creditActionStatus: ""
  139. }
  140. },
  141. table: {
  142. list: [],
  143. total: 0,
  144. loading: false
  145. },
  146. options: {
  147. action: [],
  148. status: []
  149. },
  150. dialog: {
  151. visible: false,
  152. request: ""
  153. }
  154. };
  155. },
  156. components: {Pagination, CreditActionDialog},
  157. created() {
  158. this.getActionOptions();
  159. this.getStatusOptions();
  160. this.toSearch();
  161. },
  162. methods: {
  163. toSearch() {
  164. this.filters.pageNum = 1
  165. this.getTableData()
  166. },
  167. getActionOptions() {
  168. financial.getCreditActionTypeOptions().then(res => {
  169. if (res.data) {
  170. this.options.action = res.data
  171. } else {
  172. this.options.action = []
  173. }
  174. }).catch(err => {
  175. this.$message({
  176. message: err,
  177. type: 'error'
  178. })
  179. this.options.action = []
  180. })
  181. },
  182. getStatusOptions() {
  183. financial.getCreditStatusOptions().then(res => {
  184. if (res.data) {
  185. this.options.status = res.data
  186. } else {
  187. this.options.status = []
  188. }
  189. }).catch(err => {
  190. this.$message({
  191. message: err,
  192. type: 'error'
  193. })
  194. this.options.status = []
  195. })
  196. },
  197. getTableData() {
  198. this.table.loading = true;
  199. financial.getCreaitActionPages(this.filters).then(res => {
  200. if (res.data.totalRow && res.data.records) {
  201. this.table.total = res.data.totalRow;
  202. this.table.list = res.data.records;
  203. } else {
  204. this.table.total = 0;
  205. this.table.list = [];
  206. }
  207. }).catch(err => {
  208. this.$message({
  209. type: 'error',
  210. message: err
  211. })
  212. this.table.total = 0;
  213. this.table.list = [];
  214. }).finally(() => {
  215. this.table.loading = false;
  216. })
  217. },
  218. onClickAdd() {
  219. this.dialog.request = "";
  220. this.dialog.visible = true;
  221. },
  222. onClickEdit(row) {
  223. this.dialog.request = row.creditActionId;
  224. this.dialog.visible = true;
  225. },
  226. hideDialog(e) {
  227. this.dialog.request = "";
  228. this.dialog.visible = false;
  229. if (e) {
  230. this.toSearch();
  231. }
  232. }
  233. }
  234. }
  235. </script>
  236. <style scoped>
  237. .action-status {
  238. color: #F8A300;
  239. font-size: 13px;
  240. cursor: pointer;
  241. display: inline-block;
  242. text-decoration: underline;
  243. }
  244. .action-status.Approved {
  245. color: #1ABD00;
  246. }
  247. .action-status.Rejected {
  248. color: #ED3F3F;
  249. }
  250. </style>