users.vue 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-edit" @click="handleCreate">
  5. 添加收款用户
  6. </el-button>
  7. </div>
  8. <el-table :key="tableKey" v-loading="listLoading" :data="list" border fit highlight-current-row style="width:100%">
  9. <el-table-column label="序号" align="center" width="60">
  10. <template slot-scope="scope">{{ scope.$index + 1 }}</template>
  11. </el-table-column>
  12. <el-table-column label="姓名" align="center">
  13. <template slot-scope="scope">{{ scope.row.name }}</template>
  14. </el-table-column>
  15. <el-table-column label="手机号" align="center">
  16. <template slot-scope="scope">{{ scope.row.mobile }}</template>
  17. </el-table-column>
  18. <el-table-column label="用户类型" align="center">
  19. <template slot-scope="scope">{{ scope.row.userTypeText }}</template>
  20. </el-table-column>
  21. <el-table-column label="收款小程序openid" align="center">
  22. <template slot-scope="scope">{{ scope.row.openid }}</template>
  23. </el-table-column>
  24. <el-table-column label="用户权限" align="center" min-width="180">
  25. <template slot-scope="scope">
  26. <el-tag v-for="item in scope.row.permissions" :key="item.id" v-text="item.permission" />
  27. </template>
  28. </el-table-column>
  29. <el-table-column label="操作" width="200" align="center">
  30. <template slot-scope="scope">
  31. <el-button size="mini" type="primary" @click="handleUpdate(scope.row)">修改</el-button>
  32. <el-button size="mini" type="danger" @click="handleDelete(scope.row)">删除</el-button>
  33. </template>
  34. </el-table-column>
  35. </el-table>
  36. </div>
  37. </template>
  38. <script>
  39. import { fetchList, deleteUser } from '@/api/caimei/finance/receipt-user'
  40. export default {
  41. name: 'ReceiptUserList',
  42. data() {
  43. return {
  44. tableKey: 0,
  45. list: [],
  46. listLoading: true
  47. }
  48. },
  49. watch: {
  50. $route(route) {
  51. this.getList()
  52. }
  53. },
  54. created() {
  55. this.getList()
  56. },
  57. methods: {
  58. getList() {
  59. this.listLoading = true
  60. fetchList().then(response => {
  61. this.listLoading = false
  62. this.list = response.data
  63. setTimeout(() => {
  64. this.listLoading = false
  65. }, 1.5 * 1000)
  66. })
  67. },
  68. handleCreate() {
  69. this.$router.push({ path: '/finance/receipts/user/add' })
  70. },
  71. handleUpdate(row) {
  72. this.$router.push({ path: '/finance/receipts/user/edit', query: { id: row.id }})
  73. },
  74. handleDelete(row) {
  75. this.$confirm('是否要删除该收款用户', '提示', {
  76. confirmButtonText: '确定',
  77. cancelButtonText: '取消',
  78. type: 'warning'
  79. }).then(() => {
  80. deleteUser(row.id).then(() => {
  81. this.$message({
  82. message: '删除成功',
  83. type: 'success',
  84. duration: 1000
  85. })
  86. this.getList()
  87. })
  88. })
  89. }
  90. }
  91. }
  92. </script>
  93. <style scoped>
  94. </style>