123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <template>
- <div class="app-container calendar-list-container">
- <div class="app-container" v-show="visible.firstLayer">
- <div class="app-container">
- <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="莊家" v-model="listQuery.bookie">
- </el-input>
- <el-date-picker
- v-model="date"
- type="datetimerange"
- :picker-options="pickerOptions"
- range-separator="至"
- start-placeholder="開始日期"
- end-placeholder="结束日期"
- align="right">
- </el-date-picker>
- <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">搜尋</el-button>
- </div>
- <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row
- style="width: 100%">
- <el-table-column label="ID" align="center">
- <template slot-scope="scope">
- {{scope.row.id}}
- </template>
- </el-table-column>
- <el-table-column prop="GambleMember.name" label="莊家" align="center">
- <!-- <template slot-scope="scope">
- <span>{{scope.row.GambleMember.id}}</span>
- </template> -->
- </el-table-column>
- <el-table-column align="center" label="時間" >
- <template slot-scope="scope">
- <span>{{moment(scope.row.createdAt)}}</span>
- </template>
- </el-table-column>
- <el-table-column align="center" label="操作">
- <template slot-scope="scope">
- <router-link to="/gambleGameBucket/index/detail">
- <el-button type="primary" size="mini" @click="handlePage(scope.row)">查 看</el-button>
- </router-link>
- </template>
- </el-table-column>
- </el-table>
- <div v-show="!listLoading" class="pagination-container">
- <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.page"
- :page-sizes="[10,20,30, 50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
- </el-pagination>
- </div>
- </div>
- <router-view :bucket="bucket"></router-view>
- </div>
- </template>
- <script>
- import { mapGetters, mapActions } from 'vuex'
- import { fetchList, fetchGameBid } from '@/api/gambleGameBucket'
- import waves from '@/directive/waves' // 水波纹指令
- import moment from 'moment-timezone'
- export default {
- directives: {
- waves
- },
- data() {
- return {
- list: null,
- listLoading: true,
- total: null,
- bucket: '',
- listQuery: {
- page: 1,
- limit: 20,
- startAt: null,
- endAt: null,
- bookie: null
- },
- temp: {},
- pickerOptions: {
- shortcuts: [{
- text: '本週',
- onClick(picker) {
- const end = moment().day(7).hour(11).minute(59).second(59)
- const start = moment().subtract(1, 'weeks').day(7).hour(16).minute(0).second(0)
- picker.$emit('pick', [start, end])
- }
- }, {
- text: '上週',
- onClick(picker) {
- const end = moment().subtract(1, 'weeks').day(7).hour(11).minute(59).second(59)
- const start = moment().subtract(2, 'weeks').day(7).hour(16).minute(0).second(0)
- picker.$emit('pick', [start, end])
- }
- }]
- },
- date: null
- }
- },
- created() {
- this.getList()
- this.SetVisible(1)
- },
- computed: {
- ...mapGetters([
- 'visible'
- ])
- },
- methods: {
- ...mapActions([
- 'SetVisible'
- ]),
- getList() {
- this.listLoading = true
- fetchList(this.listQuery).then(response => {
- this.list = response.data.rows
- this.total = response.data.count
- this.listLoading = false
- })
- },
- handlePage(row) {
- this.temp = Object.assign({}, row) // copy obj
- fetchGameBid(row).then(response => {
- this.temp.bidChips = response.data
- })
- this.SetVisible(2)
- this.bucket = this.temp
- // fetchMemberRecords(row).then(response => {
- // console.log(response.data)
- // })
- // fetchDealingRecords(row).then(response => {
- // console.log(response.data)
- // })
- },
- handleFilter() {
- this.listQuery.page = 1
- if (this.date) {
- this.listQuery.startAt = moment.utc(this.date[0]).format()
- this.listQuery.endAt = moment.utc(this.date[1]).format()
- } else {
- this.listQuery.startAt = null
- this.listQuery.endAt = null
- }
- this.getList()
- },
- handleSizeChange(val) {
- this.listQuery.limit = val
- this.getList()
- },
- handleCurrentChange(val) {
- this.listQuery.page = val
- this.getList()
- },
- moment(time) {
- return moment(time).tz('Asia/Taipei').format('YYYY-MM-DD HH:mm:ss')
- }
- }
- }
- </script>
|