暂无描述

index.vue 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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="query.firstLayer.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="query.firstLayer.page"
  45. :page-sizes="[10,20,30, 50]" :page-size="query.firstLayer.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
  46. </el-pagination>
  47. </div>
  48. </div>
  49. <router-view></router-view>
  50. </div>
  51. </template>
  52. <script>
  53. import { mapGetters, mapActions } from 'vuex'
  54. import { fetchList, fetchGameBid, fetchRoundRecord } 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: []
  93. }
  94. },
  95. created() {
  96. this.date = this.p_date
  97. this.getList()
  98. this.SetVisible(1)
  99. },
  100. computed: {
  101. ...mapGetters([
  102. 'visible',
  103. 'query',
  104. 'data',
  105. 'p_date'
  106. ])
  107. },
  108. methods: {
  109. ...mapActions([
  110. 'SetVisible',
  111. 'SetData',
  112. 'SetQuery',
  113. 'SetDate'
  114. ]),
  115. getList() {
  116. this.listLoading = true
  117. fetchList(this.query.firstLayer).then(response => {
  118. this.list = response.data.rows
  119. this.total = response.data.count
  120. this.listLoading = false
  121. })
  122. },
  123. handlePage(row) {
  124. let temp = Object.assign({}, row) // copy obj
  125. // fetchRoundRecord(row).then(response => {
  126. // temp.door = response.data
  127. // })
  128. // fetchGameBid(row).then(response => {
  129. // temp.bidChips = response.data
  130. // })
  131. console.log('eeeee', temp)
  132. this.SetVisible(2)
  133. this.SetData({layer:2, data: temp})
  134. },
  135. handleFilter() {
  136. if (this.p_date) {
  137. this.SetQuery({layer:1, query: {page: 1, bookie: this.query.firstLayer.bookie, startAt: moment.utc(this.p_date[0]).format(), endAt: moment.utc(this.p_date[1]).format()}})
  138. } else {
  139. this.SetQuery({layer:1, query: {page: 1, bookie: this.query.firstLayer.bookie,startAt: null, endAt: null}})
  140. }
  141. this.getList()
  142. },
  143. handleSizeChange(val) {
  144. if (this.p_date) {
  145. this.SetQuery({layer:1, query: {limit: val, bookie: this.query.firstLayer.bookie, startAt: moment.utc(this.p_date[0]).format(), endAt: moment.utc(this.p_date[1]).format()}})
  146. } else {
  147. this.SetQuery({layer:1, query: {limit: val, bookie: this.query.firstLayer.bookie,startAt: null, endAt: null}})
  148. }
  149. this.getList()
  150. },
  151. handleCurrentChange(val) {
  152. if (this.p_date) {
  153. this.SetQuery({layer:1, query: {page: val, bookie: this.query.firstLayer.bookie, startAt: moment.utc(this.p_date[0]).format(), endAt: moment.utc(this.p_date[1]).format()}})
  154. } else {
  155. this.SetQuery({layer:1, query: {page: val, bookie: this.query.firstLayer.bookie,startAt: null, endAt: null}})
  156. }
  157. this.getList()
  158. },
  159. moment(time) {
  160. return moment(time).tz('Asia/Taipei').format('YYYY-MM-DD HH:mm:ss')
  161. }
  162. },
  163. watch: {
  164. 'date': function(val) {
  165. this.SetDate(val)
  166. }
  167. }
  168. }
  169. </script>