log-index.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <style>
  2. .table-body {
  3. padding: 20px;
  4. background-color: #fff;
  5. }
  6. .input-item {
  7. width: 250px;
  8. margin: 0 0 20px;
  9. }
  10. .input-item .el-input__inner {
  11. border-right: 0;
  12. }
  13. .input-item .el-input__inner:hover{
  14. border: 1px solid #dcdfe6;
  15. border-right: 0;
  16. outline: 0;
  17. }
  18. .input-item .el-input__inner:focus{
  19. border: 1px solid #dcdfe6;
  20. border-right: 0;
  21. outline: 0;
  22. }
  23. .input-item .el-input-group__append {
  24. background-color: #fff;
  25. border-left: 0;
  26. width: 10%;
  27. padding: 0;
  28. }
  29. .input-item .el-input-group__append .el-button {
  30. padding: 0;
  31. }
  32. .input-item .el-input-group__append .el-button {
  33. margin: 0;
  34. }
  35. .table-body .el-button {
  36. padding: 0!important;
  37. border: 0;
  38. margin: 0 5px;
  39. }
  40. </style>
  41. <div id="app" v-cloak>
  42. <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  43. <div slot="header">
  44. <span>抽奖记录</span>
  45. </div>
  46. <div class="table-body">
  47. <el-form size="small" :inline="true" :model="search">
  48. <el-form-item>
  49. <el-select style="width: 100px" @change="scratchSearch()" v-model="search.type">
  50. <el-option label="全部" value="0"></el-option>
  51. <el-option :key="index" :label="item" :value="index"
  52. v-for="(item, index) in types"></el-option>
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item>
  56. <div class="input-item">
  57. <el-input @keyup.enter.native="scratchSearch()"
  58. size="small" placeholder="请输入用户名"
  59. v-model="search.user_id" clearable @clear='scratchSearch()'>
  60. <el-button slot="append" icon="el-icon-search" @click="scratchSearch()"></el-button>
  61. </el-input>
  62. </div>
  63. </el-form-item>
  64. <el-form-item>
  65. <div class="input-item">
  66. <el-input @keyup.enter.native="scratchSearch()"
  67. size="small" placeholder="请输入用户手机号/昵称"
  68. v-model="search.keyword" clearable @clear='scratchSearch()'>
  69. <el-button slot="append" icon="el-icon-search" @click="scratchSearch()"></el-button>
  70. </el-input>
  71. </div>
  72. </el-form-item>
  73. </el-form>
  74. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;">
  75. <el-table-column prop="id" label="ID" width="100"></el-table-column>
  76. <el-table-column prop="nickname" label="用户">
  77. <template slot-scope="scope">
  78. <span v-if="scope.row.user">
  79. <span v-if="scope.row.user.nickname != ''">{{scope.row.user.nickname}}</span>
  80. <span v-else>{{scope.row.user.mobile}}</span>
  81. </span>
  82. <span v-else>-</span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column prop="type" label="奖品分类" width="100">
  86. <template slot-scope="scope">
  87. <span v-if="scope.row.type == 1">
  88. 红包
  89. </span>
  90. <span v-else-if="scope.row.type == 2">
  91. 余额
  92. </span>
  93. <span v-else-if="scope.row.type == 3">
  94. 优惠券
  95. </span>
  96. <span v-else-if="scope.row.type == 4">
  97. 积分
  98. </span>
  99. <span v-else-if="scope.row.type == 5">
  100. 实物
  101. </span>
  102. <span v-else-if="scope.row.type == 6">
  103. 谢谢参与
  104. </span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column prop="scratch.name" label="奖品明细" width="350">
  108. <template slot-scope="scope">
  109. <samp v-if="scope.row.scratch">
  110. <span v-if="scope.row.scratch.type == 1">{{ scope.row.scratch.price }}元</span>
  111. <span v-if="scope.row.scratch.type == 2">{{ scope.row.scratch.balance }}元</span>
  112. <span v-if="scope.row.scratch.type == 3">{{ scope.row.coupon_data.name}}</span>
  113. <span v-if="scope.row.scratch.type == 4">{{ scope.row.scratch.num}}积分</span>
  114. <span v-if="scope.row.scratch.type == 5">{{ scope.row.goods.goods_name }}</span>
  115. </samp>
  116. <span v-else>-</span>
  117. </template>
  118. </el-table-column>
  119. <el-table-column prop="status" label="领取状态" width="150">
  120. <template slot-scope="scope">
  121. <span v-if="scope.row.status == 0">预领取</span>
  122. <span v-if="scope.row.status == 1">未领取</span>
  123. <span v-if="scope.row.status == 2">已领取</span>
  124. </template>
  125. </el-table-column>
  126. <el-table-column prop="created_at" label="抽奖时间" width="250">
  127. <template slot-scope="scope">
  128. {{scope.row.created_at | dateTimeFormat("Y-m-d H:i:s")}}
  129. </template>
  130. </el-table-column>
  131. <el-table-column prop="raffled_at" label="领取时间" width="250">
  132. <template slot-scope="scope">
  133. <span v-if="scope.row.raffled_at > scope.row.created_at">
  134. {{scope.row.raffled_at | dateTimeFormat("Y-m-d H:i:s")}}
  135. </span>
  136. <span v-else>
  137. {{scope.row.created_at | dateTimeFormat("Y-m-d H:i:s")}}
  138. </span>
  139. </template>
  140. </el-table-column>
  141. </el-table>
  142. <div flex="box:last cross:center">
  143. <div></div>
  144. <div>
  145. <el-pagination
  146. v-if="list.length > 0"
  147. style="display: inline-block;float: right;"
  148. background :page-size="pageSize"
  149. @current-change="pageChange"
  150. layout="prev, pager, next" :current-page="current_page"
  151. :total="pagination.totalCount">
  152. </el-pagination>
  153. </div>
  154. </div>
  155. </div>
  156. </el-card>
  157. </div>
  158. <script>
  159. const app = new Vue({
  160. el: '#app',
  161. data() {
  162. return {
  163. pageSize: 10,
  164. current_page: 1,
  165. pagination: null,
  166. types: [],
  167. search: {
  168. keyword: '',
  169. type: '0',
  170. page: 1,
  171. user_id:'',
  172. },
  173. loading: false,
  174. list: [],
  175. };
  176. },
  177. methods: {
  178. //分页
  179. pageChange(page) {
  180. this.search.page = page;
  181. this.getList();
  182. },
  183. // 搜索
  184. scratchSearch() {
  185. this.getList();
  186. },
  187. getList() {
  188. this.loading = true;
  189. request({
  190. params: {
  191. r: 'scratch/scratch/get-log-list',
  192. page: this.search.page,
  193. keyword: this.search.keyword,
  194. type: this.search.type,
  195. user_id:this.search.user_id,
  196. },
  197. }).then(e => {
  198. if (e.data.code == 0) {
  199. this.loading = false;
  200. this.list = e.data.data.list;
  201. this.types = e.data.data.types;
  202. this.pagination = e.data.data.pagination;
  203. this.pageSize = e.data.data.page_size;
  204. this.current_page = e.data.data.page;
  205. }
  206. }).catch(e => {
  207. });
  208. },
  209. },
  210. created() {
  211. this.getList();
  212. }
  213. })
  214. </script>