No Description

index.vue 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <div class="app-container calendar-list-container">
  3. <div class="app-container" v-show="visible.firstLayer">
  4. <div class="app-container">
  5. <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="莊家" v-model="listQuery.bookie">
  6. </el-input>
  7. <el-date-picker
  8. v-model="date"
  9. type="datetimerange"
  10. :picker-options="pickerOptions"
  11. range-separator="至"
  12. start-placeholder="開始日期"
  13. end-placeholder="结束日期"
  14. align="right">
  15. </el-date-picker>
  16. <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">搜尋</el-button>
  17. </div>
  18. <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row
  19. style="width: 100%">
  20. <el-table-column label="ID" align="center">
  21. <template slot-scope="scope">
  22. {{scope.row.id}}
  23. </template>
  24. </el-table-column>
  25. <el-table-column prop="GambleMember.name" label="莊家" align="center">
  26. <!-- <template slot-scope="scope">
  27. <span>{{scope.row.GambleMember.id}}</span>
  28. </template> -->
  29. </el-table-column>
  30. <el-table-column align="center" label="時間" >
  31. <template slot-scope="scope">
  32. <span>{{moment(scope.row.createdAt)}}</span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column align="center" label="操作">
  36. <template slot-scope="scope">
  37. <router-link to="/gambleGameBucket/index/detail">
  38. <el-button type="primary" size="mini" @click="handlePage(scope.row)">查 看</el-button>
  39. </router-link>
  40. </template>
  41. </el-table-column>
  42. </el-table>
  43. <div v-show="!listLoading" class="pagination-container">
  44. <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.page"
  45. :page-sizes="[10,20,30, 50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
  46. </el-pagination>
  47. </div>
  48. </div>
  49. <router-view :bucket="bucket"></router-view>
  50. </div>
  51. </template>
  52. <script>
  53. import { mapGetters, mapActions } from 'vuex'
  54. import { fetchList, fetchGameBid } from '@/api/gambleGameBucket'
  55. import waves from '@/directive/waves' // 水波纹指令
  56. import moment from 'moment-timezone'
  57. export default {
  58. directives: {
  59. waves
  60. },
  61. data() {
  62. return {
  63. list: null,
  64. listLoading: true,
  65. total: null,
  66. bucket: '',
  67. listQuery: {
  68. page: 1,
  69. limit: 20,
  70. startAt: null,
  71. endAt: null,
  72. bookie: null
  73. },
  74. temp: {},
  75. pickerOptions: {
  76. shortcuts: [{
  77. text: '本週',
  78. onClick(picker) {
  79. const end = moment().day(7).hour(11).minute(59).second(59)
  80. const start = moment().subtract(1, 'weeks').day(7).hour(16).minute(0).second(0)
  81. picker.$emit('pick', [start, end])
  82. }
  83. }, {
  84. text: '上週',
  85. onClick(picker) {
  86. const end = moment().subtract(1, 'weeks').day(7).hour(11).minute(59).second(59)
  87. const start = moment().subtract(2, 'weeks').day(7).hour(16).minute(0).second(0)
  88. picker.$emit('pick', [start, end])
  89. }
  90. }]
  91. },
  92. date: null
  93. }
  94. },
  95. created() {
  96. this.getList()
  97. this.SetVisible(1)
  98. },
  99. computed: {
  100. ...mapGetters([
  101. 'visible'
  102. ])
  103. },
  104. methods: {
  105. ...mapActions([
  106. 'SetVisible'
  107. ]),
  108. getList() {
  109. this.listLoading = true
  110. fetchList(this.listQuery).then(response => {
  111. this.list = response.data.rows
  112. this.total = response.data.count
  113. this.listLoading = false
  114. })
  115. },
  116. handlePage(row) {
  117. this.temp = Object.assign({}, row) // copy obj
  118. fetchGameBid(row).then(response => {
  119. this.temp.bidChips = response.data
  120. })
  121. this.SetVisible(2)
  122. this.bucket = this.temp
  123. // fetchMemberRecords(row).then(response => {
  124. // console.log(response.data)
  125. // })
  126. // fetchDealingRecords(row).then(response => {
  127. // console.log(response.data)
  128. // })
  129. },
  130. handleFilter() {
  131. this.listQuery.page = 1
  132. if (this.date) {
  133. this.listQuery.startAt = moment.utc(this.date[0]).format()
  134. this.listQuery.endAt = moment.utc(this.date[1]).format()
  135. } else {
  136. this.listQuery.startAt = null
  137. this.listQuery.endAt = null
  138. }
  139. this.getList()
  140. },
  141. handleSizeChange(val) {
  142. this.listQuery.limit = val
  143. this.getList()
  144. },
  145. handleCurrentChange(val) {
  146. this.listQuery.page = val
  147. this.getList()
  148. },
  149. moment(time) {
  150. return moment(time).tz('Asia/Taipei').format('YYYY-MM-DD HH:mm:ss')
  151. }
  152. }
  153. }
  154. </script>