index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <div class="content-container">
  3. <el-row class="tool-bar">
  4. <el-col :span="12" class="left">
  5. <div class="content-title">微信客户</div>
  6. </el-col>
  7. <el-col :span="12" class="right">
  8. <el-input v-model="conditions.keywords" style="width: 200px;" class="filter-item" prefix-icon="el-icon-search" size="mini" placeholder="请输入内容" @keyup.enter.native="getData" />
  9. <el-button class="filter-item" style="margin-left: 10px;" type="primary" size="mini" icon="el-icon-search" @click="getData">查询</el-button>
  10. </el-col>
  11. </el-row>
  12. <el-row class="content-body">
  13. <el-table v-loading="listLoading" class="page-table" border :data="dataList" size="mini" height="calc(100vh - 280px)">
  14. <el-table-column type="index" label="序号" header-align="center" align="center" width="80" />
  15. <el-table-column label="客户名称" width="200" align="center" header-align="center">
  16. <template v-slot="{row}">
  17. <span>{{ row.wxName }}</span>
  18. </template>
  19. </el-table-column>
  20. <el-table-column label="卡号" width="200" align="center" header-align="center">
  21. <template v-slot="{row}">
  22. <span>{{ row.cardNo }}</span>
  23. </template>
  24. </el-table-column>
  25. <el-table-column label="电话号码" width="200" align="center" header-align="center">
  26. <template v-slot="{row}">
  27. <span>{{ row.wxPhone }}</span>
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="备注">
  31. <template v-slot="{row}">
  32. <span>{{ row.remark }}</span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column label="操作" class-name="small-padding fixed-width" align="center" header-align="center" width="120">
  36. <template v-slot="{row}">
  37. <el-button size="mini" icon="el-icon-delete" type="danger" @click="handleDelete(row)">删除</el-button>
  38. </template>
  39. </el-table-column>
  40. </el-table>
  41. </el-row>
  42. <div class="pagination-container">
  43. <pagination v-show="total>0" :total="total" :page.sync="conditions.page" :limit.sync="conditions.limit" @pagination="getData" />
  44. </div>
  45. </div>
  46. </template>
  47. <script>
  48. import Pagination from '@/components/Pagination'
  49. import { getWxUserByPage, deleteWxUserById } from '@/api/system/wxUserApi'
  50. export default {
  51. name: 'WxUserIndex',
  52. components: {
  53. Pagination
  54. },
  55. data() {
  56. return {
  57. dataList: undefined,
  58. listLoading: false,
  59. total: 0,
  60. conditions: {
  61. page: 1,
  62. limit: 10,
  63. keywords: ''
  64. }
  65. }
  66. },
  67. mounted() {
  68. this.getData()
  69. },
  70. methods: {
  71. // 初始化
  72. getData() {
  73. this.listLoading = true
  74. getWxUserByPage(this.conditions).then((resp) => {
  75. const { data, total } = resp
  76. this.listLoading = false
  77. this.total = total
  78. this.dataList = data
  79. }).catch((error) => {
  80. console.log(error)
  81. })
  82. },
  83. // 删除
  84. handleDelete(data) {
  85. const { wxId } = data
  86. this.$confirm('此操作将永久删除, 是否继续?', '提示', {
  87. confirmButtonText: '确定',
  88. cancelButtonText: '取消',
  89. type: 'warning'
  90. }).then(() => {
  91. deleteWxUserById(wxId).then((resp) => {
  92. const { msg } = resp
  93. this.getData()
  94. this.$message.success(msg)
  95. }).catch((error) => {
  96. console.log(error)
  97. })
  98. }).catch(() => {
  99. this.$message({
  100. type: 'info',
  101. message: '已取消删除'
  102. })
  103. })
  104. }
  105. }
  106. }
  107. </script>
  108. <style lang="scss">
  109. </style>
  110. <style lang="scss" scoped>
  111. .content-container{
  112. }
  113. </style>