recharge.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <div class="recharge">
  3. <!-- 头部细节部分 -->
  4. <div class="title">
  5. <el-row>
  6. <el-col :span="24">
  7. <div class="top">
  8. <el-input placeholder="用户名称" class="input-demo" v-model="userName"></el-input>
  9. <el-input placeholder="手机号" class="input-demo" v-model="userPhone"></el-input>
  10. <el-input placeholder="用户所在公司" class="input-demo" v-model="userCompany"></el-input>
  11. </div>
  12. </el-col>
  13. </el-row>
  14. <el-row>
  15. <el-col :span="24">
  16. <div class="top">
  17. <el-button type="success" style="margin-left: 1%;" @click="queryLook">查询</el-button>
  18. </div>
  19. </el-col>
  20. </el-row>
  21. </div>
  22. <!-- 头部细节部分结束 -->
  23. <!-- 表格部分 -->
  24. <template>
  25. <el-table
  26. v-loading="loading"
  27. ref="multipleTable"
  28. :data="usertable"
  29. border
  30. tooltip-effect="dark">
  31. <el-table-column
  32. label="用户名"
  33. prop="userName"
  34. show-overflow-tooltip>
  35. </el-table-column>
  36. <el-table-column
  37. prop="userPhone"
  38. label="手机号"
  39. show-overflow-tooltip>
  40. </el-table-column>
  41. <el-table-column
  42. prop="userCompany"
  43. label="用户所在公司"
  44. show-overflow-tooltip>
  45. </el-table-column>
  46. <el-table-column
  47. label="创建时间"
  48. show-overflow-tooltip>
  49. <template slot-scope="scope" show-overflow-tooltip>
  50. <span>{{scope.row.createTime | fmtDate}}</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column
  54. label="充值前余额(元)"
  55. show-overflow-tooltip>
  56. <template slot-scope="scope" show-overflow-tooltip>
  57. <span>{{scope.row.beforeMoney / 100}}</span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column
  61. label="充值金额(元)"
  62. show-overflow-tooltip>
  63. <template slot-scope="scope" show-overflow-tooltip>
  64. <span>{{scope.row.money / 100}}</span>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. </template>
  69. <!-- 分页 -->
  70. <div class="block">
  71. <el-pagination
  72. @size-change="handleSizeChange"
  73. @current-change="handleCurrentChange"
  74. :current-page="current"
  75. :page-sizes="[6, 8, 10]"
  76. :page-size="pagesize"
  77. layout="total, sizes, prev, pager, next, jumper"
  78. :total="total">
  79. </el-pagination>
  80. </div>
  81. </div>
  82. </template>
  83. <script type="text/javascript">
  84. import axios from 'axios';
  85. export default{
  86. data() {
  87. return {
  88. loading: true,
  89. usertable: [],
  90. userName: "",
  91. userPhone: "",
  92. userCompany: "",
  93. current: 1,
  94. pagesize: 8,
  95. // 总共有多少条数据
  96. total: 0,
  97. }
  98. },
  99. created() {
  100. this.loadData();
  101. },
  102. methods: {
  103. // 列表展示
  104. async loadData() {
  105. const formData = new FormData();
  106. formData.append('current', this.current);
  107. formData.append('size', this.pagesize);
  108. const response = await this.$http.post(`recharge/list`, formData);
  109. if (response.data.code === 0) {
  110. this.loading = false;
  111. this.usertable = response.data.data.records;
  112. this.total = response.data.data.total;
  113. }
  114. },
  115. //查询
  116. async queryLook() {
  117. const formData = new FormData();
  118. formData.append('current', this.current);
  119. formData.append('size', this.pagesize);
  120. formData.append('userName', this.userName);
  121. formData.append('userPhone', this.userPhone);
  122. formData.append('userCompany', this.userCompany);
  123. const response = await this.$http.post(`recharge/list`, formData);
  124. if (response.data.code === 0) {
  125. this.loading = false;
  126. this.usertable = response.data.data.records;
  127. this.total = response.data.data.total;
  128. }
  129. },
  130. // 分页方法
  131. handleSizeChange(val) {
  132. this.pagesize = val;
  133. if(this.userName !== '' || this.userPhone !== '' || this.userCompany !== '') {
  134. this.queryLook();
  135. }else{
  136. this.loadData();
  137. };
  138. console.log(`每页 ${val} 条`);
  139. },
  140. handleCurrentChange(val) {
  141. this.current = val;
  142. if(this.userName !== '' || this.userPhone !== '' || this.userCompany !== '') {
  143. this.queryLook();
  144. }else{
  145. this.loadData();
  146. };
  147. console.log(`当前页: ${val}`);
  148. },
  149. }
  150. };
  151. </script>
  152. <style>
  153. .recharge {
  154. border: 1px solid #d9d9d9;
  155. border-radius: 10px;
  156. }
  157. .recharge .title {
  158. font-size: 5px;
  159. margin-bottom: 20px;
  160. }
  161. .recharge .top {
  162. padding-top: 20px;
  163. padding-left: 20px;
  164. }
  165. .recharge .text {
  166. display: inline-block;
  167. color: #000;
  168. font-size: 16px ;
  169. margin-left: 1%;
  170. }
  171. .recharge .input-demo {
  172. display: inline-block;
  173. width: 20%;
  174. margin-left: 1%;
  175. }
  176. .recharge .block {
  177. font-size: 5px;
  178. text-align: center;
  179. margin-top: 15px;
  180. margin-bottom: 20px;
  181. }
  182. .recharge .tou {
  183. font-size: 20px;
  184. height: 30px;
  185. line-height: 30px;
  186. padding-top: 15px;
  187. }
  188. .recharge .line {
  189. margin-top: 15px;
  190. margin-bottom: 15px;
  191. width: 100%;
  192. height: 2px;
  193. background-color: #d9d9d9;
  194. }
  195. .recharge .xinxi {
  196. text-align: center;
  197. margin: 15px auto;
  198. font-size: 18px;
  199. }
  200. </style>