userlist.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <div id="auditList">
  3. <el-row>
  4. <el-col :span="24" class="info">
  5. <el-col :span="24" class="newuser"><van-button type="info" size="small" @click="usersubmit()">新建用户</van-button> </el-col>
  6. <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
  7. <p class="textOver">
  8. <span class="textOver">{{ item.name }}</span>
  9. <span style="float:right"> <van-button type="danger" size="small" @click="toDelete(item)">删除</van-button></span>
  10. <span style="float:right"
  11. ><van-button type="info" size="small" @click="submit(item)">{{
  12. item.status == '0' ? '审核' : item.status == '1' ? '查看' : '未识别'
  13. }}</van-button>
  14. </span>
  15. </p>
  16. <p>
  17. <span class="ptwo"><span>电话:</span>{{ item.phone || '暂无' }}</span>
  18. <span class="ptwo">
  19. <span>用户类型:</span>{{ item.role == '2' ? '个人用户' : item.role == '3' ? '企业用户' : item.role == '6' ? '专家用户' : '临时用户' }}</span
  20. >
  21. </p>
  22. <p class="newptwo">
  23. <span>状态:</span>{{ item.status == '0' ? '待审核' : item.status == '1' ? '审核成功' : item.status == '2' ? '审核拒绝' : '待认证' }}
  24. </p>
  25. </el-col>
  26. </el-col>
  27. </el-row>
  28. </div>
  29. </template>
  30. <script>
  31. import { mapState, createNamespacedHelpers } from 'vuex';
  32. const { mapActions: exportuser } = createNamespacedHelpers('exportuser');
  33. const { mapActions: user } = createNamespacedHelpers('user');
  34. export default {
  35. name: 'auditList',
  36. props: {},
  37. components: {},
  38. data: function() {
  39. return {
  40. list: [],
  41. };
  42. },
  43. created() {
  44. this.search();
  45. },
  46. methods: {
  47. ...user(['query', 'delete', 'update']),
  48. ...exportuser({ exportuserQuery: 'query' }),
  49. async search() {
  50. if (this.user.code.length == 3) {
  51. const res = await this.query();
  52. const resTwo = await this.exportuserQuery();
  53. var newData = res.data.concat(resTwo.data);
  54. if (this.$checkRes(newData)) {
  55. var arr = newData.filter(item => item.pid == undefined && item.status != '3');
  56. this.$set(this, `list`, arr);
  57. }
  58. } else {
  59. const res = await this.query({ code: this.user.code });
  60. const resTwo = await this.exportuserQuery({ code: this.user.code });
  61. console.log(resTwo);
  62. var newData = res.data.concat(resTwo.data);
  63. console.log(newData);
  64. if (this.$checkRes(newData)) {
  65. var arr = newData.filter(item => item.pid == undefined && item.status != '3');
  66. this.$set(this, `list`, arr);
  67. }
  68. }
  69. },
  70. async submit(item) {
  71. this.$router.push({ path: './detail', query: { id: item.id, role: item.role } });
  72. },
  73. usersubmit() {
  74. this.$router.push({ path: './detail' });
  75. },
  76. async toDelete(item) {
  77. const res = await this.delete(item.id);
  78. if (this.$checkRes(res, '删除成功', res.errmsg || '删除失败')) this.search();
  79. },
  80. },
  81. computed: {
  82. ...mapState(['user']),
  83. pageTitle() {
  84. return `${this.$route.meta.title}`;
  85. },
  86. },
  87. metaInfo() {
  88. return { title: this.$route.meta.title };
  89. },
  90. };
  91. </script>
  92. <style lang="less" scoped>
  93. .newuser {
  94. text-align: center;
  95. padding: 10px 0 10px 10px;
  96. }
  97. .info {
  98. border-top: 1px solid #f5f5f5;
  99. .list {
  100. background: #fff;
  101. padding: 0 10px;
  102. border-bottom: 1px solid #ccc;
  103. p {
  104. font-size: 14px;
  105. color: #000;
  106. padding: 5px 0;
  107. }
  108. p:first-child {
  109. font-size: 16px;
  110. span:first-child {
  111. width: 60%;
  112. display: inline-block;
  113. }
  114. }
  115. p:nth-child(2) .ptwo {
  116. display: inline-block;
  117. width: 50%;
  118. }
  119. p:nth-child(2) .ptwo span:first-child {
  120. color: #ccc;
  121. }
  122. p:last-child span {
  123. color: #ccc;
  124. }
  125. }
  126. }
  127. .content {
  128. padding: 16px 16px 160px;
  129. height: 160px;
  130. background-color: aqua;
  131. }
  132. .newptwo {
  133. color: #ccc !important;
  134. }
  135. /deep/.van-button--small {
  136. min-width: 60px;
  137. height: 30px;
  138. padding: 0 8px;
  139. font-size: 12px;
  140. margin: 0 5px 0 0;
  141. }
  142. </style>