index.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. use common\helpers\AddonHelper;
  4. ?>
  5. <div id="app" v-cloak>
  6. <el-card shadow="never" style="border:0;min-width: 1000px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  7. <div slot="header">
  8. <span>会员核销码</span>
  9. <el-form size="small" :inline="true" :model="search" style="float: right;margin-top: -5px;">
  10. <el-form-item>
  11. </el-form-item>
  12. </el-form>
  13. </div>
  14. <div class="table-body">
  15. <div class="input-item">
  16. <el-input @keyup.enter.native="getList" size="small" placeholder="请输入用户ID" v-model="search.user_id"
  17. clearable @clear="toSearch">
  18. <el-button slot="append" icon="el-icon-search" @click="toSearch"></el-button>
  19. </el-input>
  20. </div>
  21. <div class="input-item">
  22. <el-input @keyup.enter.native="getList" size="small" placeholder="请输入用户昵称/手机号" v-model="search.keyword"
  23. clearable @clear="toSearch">
  24. <el-button slot="append" icon="el-icon-search" @click="toSearch"></el-button>
  25. </el-input>
  26. </div>
  27. <div class="input-item">
  28. <el-input @keyup.enter.native="getList" size="small" placeholder="核销码ID" v-model="search.code"
  29. clearable @clear="toSearch">
  30. <el-button slot="append" icon="el-icon-search" @click="toSearch"></el-button>
  31. </el-input>
  32. </div>
  33. <el-tabs v-model="activeName" @tab-click="handleClick">
  34. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;"
  35. @selection-change="handleSelectionChange">
  36. <el-table-column align='center' type="selection" width="60" ></el-table-column>
  37. <el-table-column prop="user_id" width="80" label="用户ID" align="center"></el-table-column>
  38. <el-table-column label="基本信息">
  39. <template slot-scope="scope">
  40. <com-image style="float: left;margin-right: 5px;" mode="aspectFill" :src="scope.row.user.avatar_url?scope.row.user.avatar_url:'/resources/img/common/default-avatar.png'"></com-image>
  41. <div>{{scope.row.user.nickname}}</div>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="手机号" prop="mobile" align="center">
  45. <template slot-scope="scope">
  46. <div>{{scope.row.user.mobile}}</div>
  47. </template>
  48. </el-table-column>
  49. <!-- <el-table-column label="核销码" prop="code" align="center">
  50. </el-table-column> -->
  51. <el-table-column label="可核销次数" prop="num" align="center">
  52. </el-table-column>
  53. <el-table-column label="已核销次数" prop="used_num" align="center">
  54. </el-table-column>
  55. <!-- <el-table-column label="二维码" prop="code_url" align="center" style="width: 50px;height: 50px;">
  56. <template slot-scope="scope">
  57. <div>
  58. <el-image :src="scope.row.code_url" :preview-src-list="[scope.row.code_url]">
  59. </el-image>
  60. </div>
  61. </template>
  62. </el-table-column> -->
  63. <el-table-column
  64. fixed="right"
  65. label="操作"
  66. align="center"
  67. width="150">
  68. <template slot-scope="scope">
  69. <el-button @click="toDetails(scope.row.user_id)" type="text" size="small">查看详情</el-button>
  70. </template>
  71. </el-table-column>
  72. </el-table>
  73. <div style="text-align: right;margin: 20px 0;">
  74. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  75. </div>
  76. </el-tabs>
  77. </div>
  78. </el-card>
  79. </div>
  80. <script>
  81. const app = new Vue({
  82. el: '#app',
  83. data: {
  84. activeName: '',
  85. loading: false,
  86. page: 1,
  87. pageCount: 0,
  88. disabledLevel: 0,
  89. list: [],
  90. choose_list: [],
  91. search: {},
  92. },
  93. mounted() {
  94. this.getList();
  95. },
  96. methods: {
  97. toDetails(user_id){
  98. this.$navigate({
  99. r: 'write-off/default/list',
  100. user_id: user_id
  101. })
  102. },
  103. getList() {
  104. let self = this;
  105. self.loading = true;
  106. let params = {
  107. r: 'write-off/default/index',
  108. page: self.page
  109. };
  110. params = Object.assign(params, this.search);
  111. request({
  112. params: params,
  113. method: 'get',
  114. }).then(e => {
  115. self.loading = false;
  116. if (e.data.code == 0) {
  117. self.list = e.data.data.list.list;
  118. self.pageCount = e.data.data.list.page_count;
  119. } else {
  120. self.$message.error(e.data.msg);
  121. }
  122. }).catch(e => {
  123. self.loading = false;
  124. });
  125. },
  126. pagination(currentPage) {
  127. let self = this;
  128. self.page = currentPage;
  129. self.getList();
  130. },
  131. handleClick(tab, event) {
  132. this.search.page = 1;
  133. this.search.status = this.activeName;
  134. this.getList()
  135. },
  136. toSearch() {
  137. this.search.page = 1;
  138. this.getList();
  139. },
  140. handleSelectionChange(val) {
  141. let self = this;
  142. self.choose_list = [];
  143. val.forEach(function (item) {
  144. self.choose_list.push(item.id);
  145. })
  146. },
  147. }
  148. });
  149. </script>
  150. <style>
  151. .el-tabs__header {
  152. font-size: 16px;
  153. }
  154. .table-body {
  155. padding: 20px;
  156. background-color: #fff;
  157. }
  158. .table-body .el-button {
  159. padding: 0 !important;
  160. border: 0;
  161. margin: 0 5px;
  162. }
  163. .input-item {
  164. width: 250px;
  165. margin: 0 0 20px;
  166. display: inline-block;
  167. }
  168. .input-item .el-input__inner {
  169. border-right: 0;
  170. }
  171. .input-item .el-input__inner:hover {
  172. border: 1px solid #dcdfe6;
  173. border-right: 0;
  174. outline: 0;
  175. }
  176. .input-item .el-input__inner:focus {
  177. border: 1px solid #dcdfe6;
  178. border-right: 0;
  179. outline: 0;
  180. }
  181. .input-item .el-input-group__append {
  182. background-color: #fff;
  183. border-left: 0;
  184. width: 10%;
  185. padding: 0;
  186. }
  187. .input-item .el-input-group__append .el-button {
  188. padding: 0;
  189. }
  190. .input-item .el-input-group__append .el-button {
  191. margin: 0;
  192. }
  193. .batch {
  194. margin: 0 0 20px;
  195. display: inline-block;
  196. }
  197. .batch .el-button {
  198. padding: 9px 15px !important;
  199. }
  200. .el-table th>.cell{
  201. color: #333;
  202. font-weight: bold;
  203. font-size: 14px;
  204. }
  205. .el-table__footer-wrapper, .el-table__header-wrapper{
  206. border-bottom: 1.4px solid #D6D6D6;
  207. }
  208. </style>