index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="手机号" label-width="60px">
  5. <el-input
  6. v-model="queryParams.mobile"
  7. placeholder="请输入手机号"
  8. clearable
  9. style="width: 160px;"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="身份证号码">
  14. <el-input
  15. v-model="queryParams.cardId"
  16. placeholder="请输入身份证号码"
  17. clearable
  18. style="width: 200px;"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label-width="40px" label="姓名">
  23. <el-input
  24. v-model="queryParams.realName"
  25. placeholder="请输入姓名"
  26. clearable
  27. style="width: 140px;"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label-width="120px" label="是否加入黑名单">
  32. <el-select
  33. v-model="queryParams.isBlackList"
  34. placeholder="是否加入黑名单"
  35. clearable
  36. style="width: 240px"
  37. >
  38. <el-option
  39. v-for="dict in dict.type.user_is_black_list"
  40. :key="dict.value"
  41. :label="dict.label"
  42. :value="dict.value"
  43. />
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item>
  47. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  48. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  49. </el-form-item>
  50. </el-form>
  51. <el-row :gutter="10" class="mb8">
  52. <el-col :span="1.5">
  53. </el-col>
  54. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  55. </el-row>
  56. <el-table ref="tables" v-loading="loading" :data="dataList" border>
  57. <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
  58. <el-table-column label="用户昵称" align="center" prop="name" />
  59. <el-table-column label="手机号" align="center" prop="mobile" />
  60. <el-table-column label="真实姓名" align="center" prop="realName" />
  61. <el-table-column label="身份证号码" align="center" prop="cardId" />
  62. <el-table-column label="累计消费" align="center" prop="consumeTotal" />
  63. <el-table-column label="是否实名" align="center">
  64. <template slot-scope="scope">
  65. <dict-tag :options="dict.type.user_certification" :value="scope.row.isAuth"/>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="是否加入黑名单" align="center">
  69. <template slot-scope="scope">
  70. <dict-tag :options="dict.type.user_is_black_list" :value="scope.row.isBlackList"/>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="注册渠道" align="center" prop="onlineTime" width="160">
  74. <template slot-scope="scope">
  75. <dict-tag :options="dict.type.user_source_type" :value="scope.row.regSource"/>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="注册时间" align="center" prop="createTime" width="160">
  79. <template slot-scope="scope">
  80. <span>{{ parseTime(scope.row.createTime) }}</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  84. <template slot-scope="scope">
  85. <el-button
  86. size="mini"
  87. type="text"
  88. @click="openDetails(scope.row)"
  89. v-hasPermi="['userMr:userMr:details']"
  90. >详情</el-button>
  91. <span v-hasPermi="['userMr:userMr:authentication']" style="display: inline-block;">
  92. <el-button
  93. size="mini"
  94. type="text"
  95. style="margin-left: 10px;"
  96. v-if="scope.row.isAuth == 1"
  97. @click="updateAuthStatusEven(scope.row)"
  98. >取消实名认证</el-button>
  99. </span>
  100. <el-button
  101. size="mini"
  102. type="text"
  103. v-hasPermi="['userMr:userMr:blacklist']"
  104. @click="addBlackListEven(scope.row)"
  105. >{{scope.row.isBlackList == 1?'取消黑名单':'加入黑名单'}}</el-button>
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. <pagination
  110. v-show="total>0"
  111. :total="total"
  112. :page.sync="queryParams.pageNum"
  113. :limit.sync="queryParams.pageSize"
  114. @pagination="getList"
  115. />
  116. <!-- 详情 -->
  117. <!-- 新增/编辑弹框 -->
  118. <data-box
  119. ref="addAndEdit"
  120. @getList="getList"
  121. />
  122. </div>
  123. </template>
  124. <script>
  125. import { pageList, updateAuthStatus, addBlackList } from '@/api/userMr/userMr'
  126. import dataBox from "./dialog/dataBox";
  127. export default {
  128. name: "UserMr",
  129. components: { dataBox },
  130. dicts:['user_source_type','user_is_black_list','user_certification'],
  131. data() {
  132. return {
  133. // 遮罩层
  134. loading: true,
  135. // 选中数组
  136. ids: [],
  137. // 非单个禁用
  138. single: true,
  139. // 非多个禁用
  140. multiple: true,
  141. // 显示搜索条件
  142. showSearch: true,
  143. // 总条数
  144. total: 0,
  145. // 用户表格数据
  146. dataList: null,
  147. // 弹出层标题
  148. title: "",
  149. // 是否显示弹出层
  150. open: false,
  151. // 日期范围
  152. dateRange: [],
  153. // 查询参数
  154. queryParams: {
  155. pageNum: 1,
  156. pageSize: 10,
  157. type: undefined
  158. },
  159. visibleStatus: false,
  160. newObj: {},
  161. visibleType: '',
  162. };
  163. },
  164. created() {
  165. this.getList();
  166. },
  167. methods: {
  168. /** 查询列表 */
  169. getList() {
  170. this.loading = true;
  171. pageList(this.addDateRange(this.queryParams, this.dateRange))
  172. .then(response => {
  173. this.dataList = response.data.rows;
  174. this.total = response.data.total;
  175. this.loading = false;
  176. }
  177. );
  178. },
  179. // 取消按钮
  180. cancel() {
  181. this.open = false;
  182. },
  183. /** 搜索按钮操作 */
  184. handleQuery() {
  185. this.queryParams.pageNum = 1;
  186. this.getList();
  187. },
  188. /** 重置按钮操作 */
  189. resetQuery() {
  190. this.dateRange = [];
  191. this.$set(this.queryParams, 'realName', '');
  192. this.$set(this.queryParams, 'cardId', '');
  193. this.$set(this.queryParams, 'mobile', '');
  194. this.$set(this.queryParams, 'isBlackList', '')
  195. this.queryParams.pageNum = 1;
  196. this.handleQuery();
  197. },
  198. /** 详情按钮操作 */
  199. openDetails(row, type) {
  200. this.$refs["addAndEdit"].openDialog("详情", row,3);
  201. },
  202. /** 取消实名认证按钮操作 */
  203. updateAuthStatusEven(row) {
  204. this.$confirm("取消认证后,用户在小程序端会成为未实名状态,您确定要取消该用户的的认证吗?", '提示', {
  205. confirmButtonText: '确定',
  206. cancelButtonText: '取消',
  207. type: 'warning'
  208. }).then(() => {
  209. updateAuthStatus({ id: row.id}).then((res) => {
  210. if (res.code == 200) {
  211. this.$message({
  212. type: 'success',
  213. message: '操作成功!'
  214. });
  215. this.getList();
  216. }
  217. });
  218. }).catch(() => {});
  219. },
  220. /** 加入黑名单按钮操作 */
  221. addBlackListEven(row) {
  222. let str = row.isBlackList == 0 ? "是否将该用户加入黑名单?":'是否将该用户移出黑名单?'
  223. this.$confirm(str, '提示', {
  224. confirmButtonText: '确定',
  225. cancelButtonText: '取消',
  226. type: 'warning'
  227. }).then(() => {
  228. addBlackList({
  229. id: row.id,
  230. type: row.isBlackList == 0 ? 1:2
  231. }).then((res) => {
  232. if (res.code == 200) {
  233. this.$message({
  234. type: 'success',
  235. message: '操作成功!'
  236. });
  237. this.getList();
  238. }
  239. });
  240. }).catch(() => {});
  241. },
  242. /** 查看按钮操作 */
  243. seeCenter(obj, type) {
  244. this.visibleStatus = true
  245. this.visibleType = type;
  246. this.newObj = obj;
  247. }
  248. }
  249. };
  250. </script>