index.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <?php
  2. /**
  3. * 核销统计
  4. */
  5. ?>
  6. <div id="app" v-cloak>
  7. <el-card shadow="never" style="border:0;min-width: 1000px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  8. <div slot="header">
  9. <span>核销统计</span>
  10. </div>
  11. <div class="table-body">
  12. <div class="input-item">
  13. <el-input size="small" placeholder="请输入用户id" v-model="search.user_id"
  14. clearable @clear="toSearch">
  15. </el-input>
  16. </div>
  17. <div class="input-item">
  18. <el-input size="small" placeholder="请输入手机号" v-model="search.keyword"
  19. clearable @clear="toSearch">
  20. </el-input>
  21. </div>
  22. <div class="input-item2">
  23. <el-date-picker el-date-picker
  24. v-model="time"
  25. type="daterange"
  26. range-separator="至"
  27. start-placeholder="开始日期"
  28. end-placeholder="结束日期" @change="timechange" value-format="yyyy-MM-dd" >
  29. </el-date-picker>
  30. </div>
  31. <el-button type="primary" size="small" style="padding: 9px 15px !important;" icon="el-icon-search" @click="toSearch">搜索</el-button>
  32. <el-button size="small" style="padding: 9px 15px !important;" icon="el-icon-refresh-right" @click="reset">重置</el-button>
  33. <el-table :data="list" :default-sort = "{prop: 'time'}">
  34. <el-table-column el-table-column label="核销员ID" prop="user_id" align="center">
  35. </el-table-column>
  36. <el-table-column el-table-column label="核销员名称" prop="nickname" align="center">
  37. </el-table-column>
  38. <el-table-column el-table-column label="联系电话" prop="mobile" align="center">
  39. </el-table-column>
  40. <el-table-column el-table-column label="所属门店" prop="store_name" align="center">
  41. </el-table-column>
  42. <el-table-column el-table-column label="电子劵名称" prop="title" align="center">
  43. </el-table-column>
  44. <el-table-column el-table-column label="佣金" prop="commission" align="center">
  45. </el-table-column>
  46. <el-table-column el-table-column label="核销时间" prop="created_at" align="center" sortable>
  47. <template slot-scope="scope">
  48. {{timeformat(scope.row.created_at)}}
  49. </template>
  50. </el-table-column>
  51. </el-table>
  52. <!-- 分页 -->
  53. <div flex="box:last cross:center">
  54. <div></div>
  55. <div>
  56. <el-pagination
  57. v-if="list.length > 0"
  58. style="display: inline-block;float: right;"
  59. background :page-size="pageSize"
  60. @current-change="pageChange"
  61. layout="prev, pager, next" :current-page="current_page"
  62. :total="totalCount">
  63. </el-pagination>
  64. </div>
  65. </div>
  66. </div>
  67. </el-card>
  68. </div>
  69. <script>
  70. const app = new Vue({
  71. el: '#app',
  72. data: {
  73. search: {
  74. start:'',
  75. end:'',
  76. keyword:'',
  77. user_id:'',
  78. page: this.current_page
  79. },
  80. time:[],
  81. list:[],
  82. page_count:0,
  83. pageSize:10,
  84. totalCount:0,
  85. current_page:1
  86. },
  87. mounted() {
  88. this.getDataList()
  89. },
  90. methods: {
  91. // 获取数据
  92. getDataList(search = {}) {
  93. request({
  94. params: {
  95. r: 'clerk/clerk-log/index',
  96. ...search
  97. },
  98. method: 'get',
  99. }).then(e => {
  100. console.log(e.data.data);
  101. this.list = e.data.data.list
  102. this.page_count = e.data.data.page_count
  103. this.pageSize = e.data.data.page_size
  104. this.totalCount = e.data.data.count
  105. }).catch(e => {
  106. this.dialogLoading = false;
  107. this.$message.error('未知错误');
  108. });
  109. },
  110. loadData() {
  111. this.getDataList(this.search)
  112. },
  113. // 搜索
  114. toSearch() {
  115. this.getDataList(this.search)
  116. },
  117. // 重置
  118. reset() {
  119. this.search = {
  120. user_id: '',
  121. keyword:'',
  122. start:'',
  123. end:'',
  124. page:1
  125. },
  126. this.getDataList(this.search)
  127. },
  128. // 分页
  129. pageChange(v) {
  130. this.search.page = v
  131. this.getDataList(this.search)
  132. },
  133. timechange(v) {
  134. if(v == null) {
  135. v = ['','']
  136. this.time = ['','']
  137. this.search.start = null
  138. this.search.end = null
  139. }else {
  140. this.search.start = v[0] + ' 00:00:00'
  141. this.search.end = v[1] + ' 00:00:00'
  142. }
  143. this.getDataList(this.search)
  144. },
  145. timeformat(v) {
  146. let time = new Date(v*1000)
  147. return time.getFullYear() +'/'+(time.getUTCMonth()+1)+'/'+time.getDate() + ' '+ (time.getHours()<10?'0' +time.getHours():time.getHours()) +':'+ (time.getMinutes()<10?'0'+time.getMinutes():time.getMinutes()) + ':'+ (time.getSeconds()<10?'0'+time.getSeconds():time.getSeconds())
  148. }
  149. }
  150. });
  151. </script>
  152. <style>
  153. .table-body{
  154. padding: 20px;
  155. background-color: #fff;
  156. }
  157. .input-item {
  158. width: 250px;
  159. margin: 0 10px 20px;
  160. display: inline-block;
  161. }
  162. .input-item2 {
  163. width: 350px;
  164. margin: 0 10px 20px;
  165. display: inline-block;
  166. }
  167. </style>