index.vue 7.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
<template>
  <div class="pad20">
    <div class="filter-container">
      <el-input v-model="params.requestNo" class="filter-item" style="width: 200px;" placeholder="请求号"></el-input>
      <el-input v-model="params.accountNo" class="filter-item" style="width: 200px;" placeholder="账户编号"></el-input>
      <el-input v-model="params.userNo" class="filter-item" style="width: 200px;" placeholder="用户编号"></el-input>
      <br>
      <el-date-picker
        v-model="payTime"
        type="datetimerange"
        :picker-options="timeData"
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
        :default-time="['00:00:00', '23:59:59']"
        align="center"
        @change="changeTime">
      </el-date-picker>

      <el-select value="" v-model="params.fundDirection" placeholder="变动方向">
        <el-option label="请选择" value=""></el-option>
        <el-option label="加款" value="ADD"></el-option>
        <el-option label="减款" value="SUB"></el-option>
      </el-select>
      <div style="float: right">
        <el-button class="filter-item" type="primary" @click="handleCheck">查询</el-button>
        <el-button class="filter-item" @click="handleReset">
          重置
        </el-button>
      </div>
    </div>
    <div>
      <el-table
        v-loading="ctrl.load"
        size="medium"
        :data="page.recordList"
        stripe
        border
        style="width: 100%">
        <el-table-column
          type="index"
          label="序号"
          width="60">
        </el-table-column>
        <el-table-column
          prop="requestNo"
          label="银行名称">
        </el-table-column>
        <el-table-column
          width="230"
          prop="t0SettAmount"
          label="余额(元)">
        </el-table-column>
        <el-table-column
          width="210"
        label="操作"
        fixed="right">
        <template slot-scope="scope">
        <el-button type="primary" size="mini" @click.native="showDetail(scope.row)">渠道详情</el-button>
        <el-button type="primary" size="mini" @click.native="showDetail(scope.row)">商户详情</el-button>
        </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="mgt20">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :page-size="page.numPerPage"
        :page-sizes="[20, 50, 100, 200, 500, 1000]"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.totalCount">
      </el-pagination>
    </div>
    <el-dialog width="70%" top="5vh" :title="rowInfo.userName" :visible.sync="ctrl.detailOn">
      <el-form :inline="true">
        <el-form-item label="创建时间">
          <span class="inline_text">{{rowInfo.createTime}}</span>
        </el-form-item>
        <el-form-item label="请求号">
          <span class="inline_text">{{rowInfo.requestNo}}</span>
        </el-form-item>
        <el-form-item label="账户编号">
          <span class="inline_text">{{rowInfo.accountNo}}</span>
        </el-form-item>
        <el-form-item label="用户编号">
          <span class="inline_text">{{rowInfo.userNo}}</span>
        </el-form-item>
        <el-form-item label="业务类型">
          <span class="inline_text">{{option.trxTypeObj && option.trxTypeObj[rowInfo.trxType]}}</span>
        </el-form-item>
        <el-form-item label="变动金额">
          <span class="inline_text">{{rowInfo.amount}}</span>
        </el-form-item>
        <el-form-item label="变动方向">
          <span class="inline_text c_blue" :class="{c_orange: rowInfo.fundDirection === 'SUB'}">{{rowInfo.fundDirection | fundDirection}}</span>
        </el-form-item>
        <el-form-item label="余额">
          <span class="inline_text">{{rowInfo.balance}}</span>
        </el-form-item>
        <el-form-item label="用户名">
          <span class="inline_text">{{rowInfo.userName}}</span>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
  import * as apis from '@/api/bank'
  import { mapActions } from 'vuex'
  export default {
    filters: {
      fundDirection(value) {
        const fundType = {
          ADD: '加款',
          SUB: '减款'
        }
        return fundType[value]
      },
      fitPrice(val = 0) {
        return ${val.toFixed(2)}`
      }
    },
    data() {
      return {
        ctrl: {
          load: false,
          detailOn: false
        },
        page: {
          beginPageIndex: 1,
          currentPage: 1,
          endPageIndex: 8,
          numPerPage: 20,
          totalCount: 0,
          totalPage: 0,
          recordList: []
        },
        option: {
          trxTypeObj: null
        },
        params: {
          numPerPage: 20
        },
        timeData: {
          shortcuts: [{
            text: '今天',
            onClick: picker => {
              const now = this.getNow('now')
              picker.$emit('pick', now)
            }
          }, {
            text: '昨天',
            onClick: picker => {
              const now = this.getNow('before')
              picker.$emit('pick', now)
            }
          }]
        },
        payTime: '',
        rowInfo: {}
      }
    },
    methods: {
      ...mapActions('account', ['getHistoryList']),
      showDetail(info) {
        this.rowInfo = info
        this.$nextTick(() => {
          this.ctrl.detailOn = true
        })
      },
      getNow(dateType) {
        const now = new Date()
        if (dateType === 'before') {
          now.setTime(now.getTime() - 3600 * 1000 * 24)
        }
        const year = now.getFullYear()
        const month = now.getMonth()
        const day = now.getDate()
        return [new Date(year, month, day), new Date(year, month, day, 23, 59, 59)]
      },
      changeTime() {
        if (this.payTime.length) {
          this.params.beginTime = this.dateToString(this.payTime[0])
          this.params.endTime = this.dateToString(this.payTime[1])
        } else {
          this.params.beginTime = ''
          this.params.endTime = ''
        }
      },
      dateToString(date) {
        const year = date.getFullYear()
        const month = (date.getMonth() + 1).toString().padStart(2, '0')
        const day = date.getDate().toString().padStart(2, '0')
        const hours = date.getHours().toString().padStart(2, '0')
        const minutes = date.getMinutes().toString().padStart(2, '0')
        const seconds = date.getSeconds().toString().padStart(2, '0')
        const timeString = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
        return timeString
      },
      handleCheck() {
        this.params.pageNum = 1
        this.getList()
      },
      handleSizeChange(val) {
        // console.log(`每页 ${val} 条`)
        this.params.numPerPage = val
        this.getList()
      },
      handleCurrentChange(val) {
        this.params.pageNum = val
        this.getList()
        // console.log(`当前页: ${val}`)
      },
      handleReset() {
        this.params = {}
        this.getList()
      },
      getList() {
        this.ctrl.load = true
        apis.bankSumList(this.params).then(res => {
          console.log(res)
          this.ctrl.load = false
          this.page = res.data
        }).catch(() => {
          this.ctrl.load = false
        })
      }
    },
    created() {
      this.$store.dispatch('GetOpts', { name: 'TrxTypeEnum', type: 'obj' }).then(res => {
        this.option.trxTypeObj = res
      })
    },
    mounted() {
      this.getList()
    }
  }
</script>

<style lang="scss">
  .c_blue {
    color: blue;
  }
  .c_orange {
    color: rgb(255, 165, 0);
  }
</style>