Plat Admin

blackList.vue 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="app-container">
  3. <div class="box-container">
  4. <div class="contain-title">黑名单用户</div>
  5. <div class="contain-search">
  6. <el-input placeholder="搜索用户名/手机账号" v-model="searchText" maxlength="20" class="input-with-select" @keyup.enter.native="pageQueryUser">
  7. <el-button slot="append" icon="el-icon-search" @click="pageQueryUser"></el-button>
  8. </el-input>
  9. </div>
  10. </div>
  11. <div class="content-container">
  12. <el-table
  13. :data="tableData"
  14. height="630"
  15. v-loading="tableLoading"
  16. border>
  17. <el-table-column
  18. v-for="item in tableItem"
  19. :key="item.index"
  20. :prop="item.prop ? item.prop : ''"
  21. :label="item.tit ? item.tit : ''"
  22. :width="item.width ? item.width : ''"
  23. align="center">
  24. <template slot-scope="scope">
  25. <div v-if="scope.row[item.prop]">
  26. <el-button v-if="item.link" type="text"
  27. @click="queryInfo(scope.row.id)">{{scope.row[item.prop]}}</el-button>
  28. <el-button v-else-if="item.reason" type="text"
  29. @click="blackReason(scope.row.id)">{{scope.row[item.prop]}}</el-button>
  30. <span v-else>{{scope.row[item.prop]}}</span>
  31. </div>
  32. <div class="operate-row" v-if="item.operate && typeof scope.row === 'object'">
  33. <el-button
  34. size="mini"
  35. type="primary"
  36. @click="handleRenew(scope.row.id)">恢复</el-button>
  37. </div>
  38. </template>
  39. </el-table-column>
  40. </el-table>
  41. <div class="pagination-container">
  42. <el-pagination
  43. background
  44. @current-change="handleCurrentChange"
  45. :current-page.sync="pageNo"
  46. :page-size="pageSize"
  47. layout="prev, pager, next, jumper"
  48. :total="total">
  49. </el-pagination>
  50. </div>
  51. </div>
  52. <baseInfo ref="baseInfo" :type="blackType"></baseInfo>
  53. <pullBlack ref="pullBlack"></pullBlack>
  54. </div>
  55. </template>
  56. <script>
  57. import {
  58. pageBlackUser,
  59. cancelBlackUser
  60. } from '@/api/userInfo'
  61. import { parseTime } from '@/utils'
  62. import comTable from '@/utils/comTable'
  63. import queryBase from '@/utils/queryBase'
  64. import baseInfo from './baseInfo'
  65. import pullBlack from './pullBlack'
  66. export default {
  67. data() {
  68. return {
  69. AllCitys: [],
  70. blackType: true,
  71. searchText: '',
  72. pageSize: 10,
  73. pageNo: 1,
  74. total: 0,
  75. tableData: [],
  76. tableLoading: true,
  77. tableItem: [
  78. {
  79. prop: 'loginPhone',
  80. tit: '手机账号',
  81. width: '120',
  82. link: true
  83. },
  84. {
  85. prop: 'account',
  86. tit: '用户名'
  87. },
  88. {
  89. prop: 'linkPhone',
  90. tit: '联系电话',
  91. width: '120'
  92. },
  93. {
  94. prop: 'email',
  95. tit: '联系邮箱',
  96. width: '160'
  97. },
  98. {
  99. prop: 'invalidTime',
  100. tit: '最后拉黑时间',
  101. width: '160'
  102. },
  103. {
  104. prop: 'invalidReason',
  105. tit: '最后拉黑理由',
  106. width: '240',
  107. reason: true
  108. },
  109. {
  110. prop: 'invalidOperator',
  111. tit: '操作人'
  112. },
  113. {
  114. operate: true,
  115. width: '100'
  116. }
  117. ]
  118. }
  119. },
  120. components: {
  121. baseInfo,
  122. pullBlack
  123. },
  124. created() {
  125. this.pageQueryUser()
  126. },
  127. methods: {
  128. pageQueryUser() {
  129. var that = this
  130. this.$http.get(pageBlackUser, {
  131. key: that.searchText,
  132. pageSize: that.pageSize,
  133. pageNo: that.pageNo
  134. }, function(res) {
  135. that.tableLoading = false
  136. if (res.success && res.data) {
  137. const obj = res.data.data
  138. for (let i = 0; i < obj.length; ++i) {
  139. if (obj[i].invalidTime) {
  140. obj[i].invalidTime = parseTime(obj[i].invalidTime)
  141. }
  142. if (obj[i].invalidOperator) {
  143. queryBase.getAdminUser(obj[i].invalidOperator, function(sc, value) {
  144. if (sc) {
  145. obj[i].invalidOperator = value.name
  146. }
  147. })
  148. }
  149. }
  150. that.total = res.data.total
  151. that.tableData = obj
  152. comTable.gapFilling(that.tableData)
  153. } else {
  154. that.total = 0
  155. that.tableData = []
  156. }
  157. })
  158. },
  159. handleCurrentChange(val) {
  160. this.pageNo = val
  161. this.pageQueryUser()
  162. },
  163. queryInfo(id) {
  164. this.$refs.baseInfo.queryBlackOne(id)
  165. },
  166. blackReason(id) {
  167. this.$refs.pullBlack.queryBlackOne(id)
  168. },
  169. handleRenew(id) {
  170. var that = this
  171. this.$http.get(cancelBlackUser, {
  172. id: id
  173. }, function(res) {
  174. if (res.success) {
  175. that.pageQueryUser()
  176. }
  177. })
  178. }
  179. }
  180. }
  181. </script>