| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- <template>
- <div v-loading="loading">
- <div class="white-box">
- <div class="filter-box">
- <filter-user :filter-types="filterTypes" @select-value="handleFilterUser"></filter-user>
- </div>
- <el-table class="table-box" ref="multipleTable" :data="tableData" stripe style="width: 100%;" :height="tool.getTableHeight()" @selection-change="handleSelectionChange">
- <!-- <el-table-column fixed type="selection" width="55" v-if="tableHeaders" :selectable="checkSelectable"></el-table-column>-->
- <el-table-column v-for="(tableHeader, key) in tableHeaders" :key="key" :label="tableHeader.header" :width="tableHeader.other.width ? tableHeader.other.width : ''" :prop="tableHeader.other.prop ? tableHeader.other.prop : null">
- <template slot-scope="scope">
- <template v-if="scope.row[tableHeader.index].other.tag" >
- <el-tag :type="scope.row[tableHeader.index].other.tag.type ? scope.row[tableHeader.index].other.tag.type : null" :size="scope.row[tableHeader.index].other.tag.size ? scope.row[tableHeader.index].other.tag.size : null" :class="scope.row[tableHeader.index].other.tag.class ? scope.row[tableHeader.index].other.tag.class : null" >{{scope.row[tableHeader.index].value}}</el-tag>
- </template>
- <template v-else>
- <div v-html="scope.row[tableHeader.index].value"></div>
- </template>
- </template>
- </el-table-column>
- <el-table-column min-width="150" :label="$t('common.action')"> <!-- 操作 -->
- <template slot-scope="scope">
- <el-button type="success" size="small" @click="handleGroupManage(scope.row)" >
- {{ $t('financial.statusManagement') }}<!-- 状态管理 -->
- </el-button>
- </template></el-table-column>
- <!-- <el-table-column min-width="150" :label="$t('financial.typeManagement')"> <!– 操作 –>-->
- <!-- <template slot-scope="scope">-->
- <!-- <el-button type="success" size="small" @click="handleTypeManagement(scope.row)" >-->
- <!-- {{ $t('financial.typeManagement') }}<!– 状态管理 –>-->
- <!-- </el-button>-->
- <!-- </template></el-table-column>-->
- <el-table-column min-width="150" :label="$t('financial.viewVoucher')"><!-- 查看凭证 -->
- <template slot-scope="scope">
- <el-button type="success" size="small" @click="handleInvoiceShow(scope.row)"
- v-if="scope.row.AUDIT_STATUS!=='0'">{{ $t('financial.viewVoucher') }}<!-- 查看凭证 -->
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div class="white-box-footer">
- <el-button type="success" size="small" @click="handleExport"
- v-show="permission.hasPermission(`finance/recharge-export`)">{{ $t('common.exportExcel') }}
- </el-button>
- <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
- </div>
- <el-dialog :title="$t('financial.checkRechargeVoucher')" :visible.sync="dialogInvoiceVisible"> <!-- 查看充值凭证 -->
- <div v-loading="dialogInvoiceLoading">
- <a :href="invoiceUrl" target="_blank"><img :src="urlimg" alt="" style="max-width: 100%"></a>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogInvoiceVisible = false">{{ $t('common.confirm') }}</el-button> <!-- 确 定 -->
- </div>
- </el-dialog>
- <el-dialog width="30%" :title="$t('financial.typeManagement')" :visible.sync="dialogTypeVisible"> <!-- 查看充值凭证 -->
- <el-form ref="form" :model="form">
- <el-form-item :label="$t('financial.type')" prop="rechargeType">
- <el-select v-model="form.rechargeType" clearable filterable style="width: 100%">
- <el-option v-for="(item,key) in typeList" :key="key" :label="item" :value="item" />
- </el-select>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="onCancel">{{ $t('table.cancel') }}<!-- 取 消 --></el-button>
- <el-button type="primary" @click.native="handleSave">{{ $t('common.save') }}<!-- 发货 --></el-button>
- </div>
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- import tool from '@/utils/tool'
- import FilterUser from '@/components/FilterUser'
- import permission from '@/utils/permission'
- import Pagination from '@/components/Pagination'
- import filterHelper from '@/utils/filterHelper'
- import {rechargeList, rechargeExport, fetchRechargeTypeList, saveRechargeType} from '@/api/finance'
- export default {
- name: 'recharge',
- components: {FilterUser,Pagination},
- mounted () {
- this.getData()
- this.fetchRechargeTypeList()
- },
- data () {
- return {
- tableHeaders: null,
- tableData: null,
- loading: true,
- currentPage: 1,
- totalPages: 1,
- totalCount: 1,
- pageSize: 20,
- multipleSelection: [],
- tool: tool,
- permission: permission,
- filterTypes: {},
- filterModel: {},
- value:[],
- selectedIds:'',
- dialogInvoiceVisible: false,
- dialogInvoiceLoading: false,
- dialogTypeVisible: false,
- typeList: [],
- invoiceUrl:'',
- form: {
- id: null,
- rechargeType: '',
- },
- urlimg:''
- }
- },
- methods: {
- handleSelectionChange(val) {
- this.multipleSelection = val
- },
- handleCurrentChange (page) {
- this.getData(page, this.pageSize)
- },
- handleSizeChange (pageSize) {
- this.getData(this.currentPage, pageSize)
- },
- handleFilterUser(filterData){
- filterHelper.handleFilterUser(this, filterData)
- },
- handleFilter() {
- this.getData()
- },
- checkSelectable(row) {
- return row.DONT_DEL !== '1'
- },
- getData (page, pageSize) {
- let filterData = this.filterModel
- let vueObj = this
- const paramsData = Object.assign({
- page: (page === null || page == undefined) ? 1 : page,
- pageSize: (pageSize === null || pageSize == undefined) ? vueObj.pageSize : pageSize
- }, filterData)
- rechargeList(paramsData).then(response => {
- vueObj.tableHeaders = response.data.columnsShow ? response.data.columnsShow : []
- vueObj.tableData = response.data.list
- vueObj.filterTypes = response.data.filterTypes
- vueObj.currentPage = page
- vueObj.totalPages = parseInt(response.data.totalPages)
- vueObj.totalCount = parseInt(response.data.totalCount)
- vueObj.pageSize = pageSize
- // vueObj.selectedIds = vueObj.tableData.ID;
- let settingObj=vueObj.tableData;
- let settingArr = Object.keys(settingObj).map(key => {
- //console.log(key); //为每个键名
- return settingObj[key]; //把每个对象返回出去生成一个新的数组中相当于0:{id:1}
- } );
- this.tableData=settingArr;
- this.loading = false
- }).catch(err => {
- this.$message({
- message: err,
- type: 'error'
- })
- this.loading = false
- })
- },
- handleExport(){
- this.$confirm(this.$t('financial.exportNotice'), this.$t('common.hint'), {
- confirmButtonText: this.$t('common.confirm'), // 确定
- cancelButtonText: this.$t('common.cancel'), // 取消
- type: 'warning'
- }).then(() => {
- rechargeExport(this.filterModel).then(response => {
- this.$message({
- message: response.data,
- type: 'success'
- })
- }).catch(error => {
- this.$message({
- message: error,
- type: 'error'
- })
- })
- })
- },
- handleInvoiceShow(row) {
- this.dialogInvoiceLoading = true
- this.uploadId = row.ID
- this.dialogInvoiceVisible = true
- this.dialogInvoiceLoading = false
- this.urlimg = tool.getArImage(row.BANK_PROVE, '/files/');
- },
- fetchRechargeTypeList() {
- fetchRechargeTypeList().then(response => {
- this.typeList = response.data.type
- })
- },
- onCancel() {
- this.dialogTypeVisible = false
- this.$refs['form'].resetFields()
- },
- handleTypeManagement(row) {
- console.log(row)
- this.form.id = row.ID
- this.form.rechargeType = row.TYPE.value
- this.dialogTypeVisible = true
- },
- handleSave() {
- saveRechargeType(this.form).then(response => {
- this.$message({
- message: response.data,
- type: 'success'
- })
- this.getData()
- }).finally(() => {
- this.dialogTypeVisible = false
- this.$refs['form'].resetFields()
- })
- },
- /* handlestate(){
- this.$router.push({path: `/finance/recharge-status`})
- },*/
- handleGroupManage(row) {
- /* if (this.multipleSelection.length < 1) {
- this.$message({
- message: '请勾选要操作的会员',
- type: 'warning'
- })
- return
- }else{
- if(this.multipleSelection.length > 1){
- this.$message({
- message: '只能选择一个',
- type: 'warning'
- })
- return
- }
- }*/
- this.$router.push({
- path: `/finance/recharge-status`,
- query: {
- mallCode: row
- }
- })
- },
- },
- }
- </script>
- <style scoped>
- .table-box .el-form-item__label {
- width: 100px;
- color: #99a9bf;
- }
- .table-box .el-form-item {
- width: 30%;
- margin-right: 0;
- margin-bottom: 0;
- }
- .el-button--small, .el-button--small.is-round {
- padding: 9px 5px;
- }
- </style>
|