member-favorite.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div class="address-list">
  3. <div class="table">
  4. <el-table ref="orderTable" v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
  5. <el-table-column align="center" label="商品信息" prop="goodsName" min-width="200">
  6. <template slot-scope="scope">
  7. <div class="goods-info">
  8. <el-image style="width: 40px; height: 40px;" :src="scope.row.imgUrl" :preview-src-list="[scope.row.imgUrl]" fit="cover"></el-image>
  9. <div class="name">{{scope.row.goodsName}}</div>
  10. </div>
  11. </template>
  12. </el-table-column>
  13. <el-table-column align="center" label="商品价格" prop="goodsPrice"></el-table-column>
  14. <el-table-column align="center" label="商品状态" prop="defaultAddr">
  15. <template slot-scope="scope">
  16. {{ scope.row.status ? '上架' : '下架' }}
  17. </template>
  18. </el-table-column>
  19. <el-table-column align="center" label="收藏时间" prop="createTime"></el-table-column>
  20. </el-table>
  21. </div>
  22. <div class="pagination clearfix">
  23. <div class="fr">
  24. <el-pagination
  25. @size-change="handleSizeChange"
  26. @current-change="handleCurrentChange"
  27. :current-page="currentPage"
  28. :page-sizes="[10, 20, 30, 50]"
  29. :page-size="10"
  30. layout="total, sizes, prev, pager, next, jumper"
  31. :total="listTotal">
  32. </el-pagination>
  33. </div>
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. import {getMemberFavoriteList} from "@/api/member";
  39. export default {
  40. name: 'MemberFavorite',
  41. componentName: 'MemberFavorite',
  42. props: ['user'],
  43. data() {
  44. return {
  45. dataList: [], // 数据列表
  46. listLoading: true, // 列表加载loading
  47. currentPage: 1, // 当前页码
  48. pageSize: 10, // 每页数量
  49. listTotal: 0 // 列表总数
  50. }
  51. },
  52. created() {
  53. this.getFavoriteList()
  54. },
  55. methods: {
  56. getFavoriteList() {
  57. let params = {
  58. userId: this.user.userId,
  59. pageNum: this.currentPage,
  60. pageSize: this.pageSize
  61. }
  62. getMemberFavoriteList(params).then(res => {
  63. this.dataList = res.data.records
  64. this.listTotal = res.data.total
  65. this.listLoading = false
  66. })
  67. },
  68. // 更改每页数量
  69. handleSizeChange(val) {
  70. this.pageSize = val
  71. this.currentPage = 1
  72. this.getList()
  73. },
  74. // 更改当前页
  75. handleCurrentChange(val) {
  76. this.currentPage = val
  77. this.getList()
  78. },
  79. }
  80. }
  81. </script>
  82. <style scoped lang="scss">
  83. .goods-info {
  84. display: flex;
  85. align-items: center;
  86. .el-image {
  87. flex-shrink: 0;
  88. }
  89. .name {
  90. margin-left: 8px;
  91. text-align: left;
  92. }
  93. }
  94. </style>