member-address.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <div class="address-list">
  3. <div class="table">
  4. <el-table
  5. ref="orderTable"
  6. v-loading="listLoading"
  7. :data="dataList"
  8. element-loading-text="Loading"
  9. border
  10. fit
  11. highlight-current-row stripe
  12. >
  13. <el-table-column align="center" label="收货人" prop="name"></el-table-column>
  14. <el-table-column align="center" label="手机号" prop="phone"></el-table-column>
  15. <el-table-column align="center" label="地址信息" prop="address" min-width="200"></el-table-column>
  16. <el-table-column align="center" label="是否默认地址" prop="defaultAddr">
  17. <template slot-scope="{ row }">
  18. {{ row.defaultAddr ? '是' : '否' }}
  19. </template>
  20. </el-table-column>
  21. </el-table>
  22. </div>
  23. <div class="pagination clearfix">
  24. <div class="fr">
  25. <el-pagination
  26. @size-change="handleSizeChange"
  27. @current-change="handleCurrentChange"
  28. :current-page="currentPage"
  29. :page-sizes="[10, 20, 30, 50]"
  30. :page-size="10"
  31. layout="total, sizes, prev, pager, next, jumper"
  32. :total="listTotal">
  33. </el-pagination>
  34. </div>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import {getMemberAddressList} from "@/api/member";
  40. export default {
  41. name: 'MemberAddress',
  42. componentName: 'MemberAddress',
  43. props: ['user'],
  44. data() {
  45. return {
  46. dataList: [], // 数据列表
  47. listLoading: true, // 列表加载loading
  48. currentPage: 1, // 当前页码
  49. pageSize: 10, // 每页数量
  50. listTotal: 0 // 列表总数
  51. }
  52. },
  53. created() {
  54. this.getAddressList()
  55. },
  56. methods: {
  57. getAddressList() {
  58. let params = {
  59. userId: this.user.userId,
  60. pageNum: this.currentPage,
  61. pageSize: this.pageSize
  62. }
  63. getMemberAddressList(params).then(res => {
  64. this.dataList = res.data.records
  65. this.listTotal = res.data.total
  66. this.listLoading = false
  67. })
  68. },
  69. // 更改每页数量
  70. handleSizeChange(val) {
  71. this.pageSize = val
  72. this.currentPage = 1
  73. this.getList()
  74. },
  75. // 更改当前页
  76. handleCurrentChange(val) {
  77. this.currentPage = val
  78. this.getList()
  79. },
  80. }
  81. }
  82. </script>
  83. <style scoped>
  84. </style>