| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <template>
- <div class="app-container">
- <div class="filter-container">
- <div class="filter-view">
- <el-date-picker
- v-model="filters.pageCriteria.dateRange"
- type="daterange"
- value-format="yyyy-MM-dd"
- start-placeholder="Start Date"
- end-placeholder="End Date"
- clearable
- class="filter-view-item"
- @change="toSearch"/>
- <el-select
- class="filter-view-item"
- v-model="filters.pageCriteria.creditActionType"
- placeholder="Credit Action"
- @change="toSearch"
- clearable>
- <el-option
- v-for="item in options.action"
- :key="item"
- :label="item"
- :value="item" />
- </el-select>
- <el-select
- class="filter-view-item"
- v-model="filters.pageCriteria.creditActionStatus"
- placeholder="Status"
- @change="toSearch"
- clearable>
- <el-option
- v-for="item in options.status"
- :key="item"
- :label="item"
- :value="item" />
- </el-select>
- <el-input
- v-model="filters.pageCriteria.criteria"
- placeholder="E-mail, Request ID"
- prefix-icon="el-icon-search"
- style="max-width: 300px;"
- @change="toSearch"
- @keyup.enter.native="toSearch"
- clearable/>
- <div class="filter-flex-button">
- <el-button
- type="primary"
- @click="onClickAdd"
- v-if="!$route.meta.onlyView">
- Amend Credit
- </el-button>
- </div>
- </div>
- </div>
- <el-table
- v-loading="table.loading"
- :data="table.list">
- <el-table-column
- align="center"
- label="Request ID"
- prop="entityName"
- min-width="170">
- <template slot-scope="{row}">
- <div
- class="link-type"
- @click="onClickEdit(row)">
- {{row.creditActionId}}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="User E-mail"
- prop="userEmail"
- min-width="150"/>
- <el-table-column
- align="center"
- label="Current Balance"
- prop="currentBalance"
- min-width="150"/>
- <el-table-column
- align="center"
- label="Credit Action"
- prop="creditActionType"
- min-width="150"/>
- <el-table-column
- align="center"
- label="Amount"
- prop="creditActionAmount"
- min-width="150"/>
- <el-table-column
- align="center"
- label="Remarks"
- prop="creditActionRemarks"
- min-width="150"/>
- <el-table-column
- align="center"
- label="Status"
- prop="creditActionStatus"
- min-width="150">
- <template slot-scope="{row}">
- <div
- :class="'action-status ' + row.creditActionStatus"
- @click="onClickEdit(row)">
- {{row.creditActionStatus}}
- </div>
- </template>
- </el-table-column>
- </el-table>
- <div class="right">
- <pagination
- v-show="table.total > 0"
- :total="table.total"
- :page.sync="filters.pageNum"
- :limit.sync="filters.pageSize"
- @pagination="getTableData" />
- </div>
- <CreditActionDialog
- v-bind="dialog"
- @hide="hideDialog"/>
- </div>
- </template>
- <script>
- import financial from '@/http/api/financial';
- import Pagination from '@/components/Pagination';
- import CreditActionDialog from './CreditActionDialog.vue';
- export default {
- data() {
- return {
- filters: {
- pageNum: 1,
- pageSize: 10,
- pageCriteria: {
- criteria: "",
- dateRange: [],
- creditActionType: "",
- creditActionStatus: ""
- }
- },
- table: {
- list: [],
- total: 0,
- loading: false
- },
- options: {
- action: [],
- status: []
- },
- dialog: {
- visible: false,
- request: ""
- }
- };
- },
- components: {Pagination, CreditActionDialog},
- created() {
- this.getActionOptions();
- this.getStatusOptions();
- this.toSearch();
- },
- methods: {
- toSearch() {
- this.filters.pageNum = 1
- this.getTableData()
- },
- getActionOptions() {
- financial.getCreditActionTypeOptions().then(res => {
- if (res.data) {
- this.options.action = res.data
- } else {
- this.options.action = []
- }
- }).catch(err => {
- this.$message({
- message: err,
- type: 'error'
- })
- this.options.action = []
- })
- },
- getStatusOptions() {
- financial.getCreditStatusOptions().then(res => {
- if (res.data) {
- this.options.status = res.data
- } else {
- this.options.status = []
- }
- }).catch(err => {
- this.$message({
- message: err,
- type: 'error'
- })
- this.options.status = []
- })
- },
- getTableData() {
- this.table.loading = true;
- financial.getCreaitActionPages(this.filters).then(res => {
- if (res.data.totalRow && res.data.records) {
- this.table.total = res.data.totalRow;
- this.table.list = res.data.records;
- } else {
- this.table.total = 0;
- this.table.list = [];
- }
- }).catch(err => {
- this.$message({
- type: 'error',
- message: err
- })
- this.table.total = 0;
- this.table.list = [];
- }).finally(() => {
- this.table.loading = false;
- })
- },
- onClickAdd() {
- this.dialog.request = "";
- this.dialog.visible = true;
- },
- onClickEdit(row) {
- this.dialog.request = row.creditActionId;
- this.dialog.visible = true;
- },
- hideDialog(e) {
- this.dialog.request = "";
- this.dialog.visible = false;
- if (e) {
- this.toSearch();
- }
- }
- }
- }
- </script>
- <style scoped>
- .action-status {
- color: #F8A300;
- font-size: 13px;
- cursor: pointer;
- display: inline-block;
- text-decoration: underline;
- }
- .action-status.Approved {
- color: #1ABD00;
- }
- .action-status.Rejected {
- color: #ED3F3F;
- }
- </style>
|