1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <template>
- <div class="address-list">
- <div class="table">
- <el-table ref="orderTable" v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
- <el-table-column align="center" label="商品信息" prop="goodsName" min-width="200">
- <template slot-scope="scope">
- <div class="goods-info">
- <el-image style="width: 40px; height: 40px;" :src="scope.row.imgUrl" :preview-src-list="[scope.row.imgUrl]" fit="cover"></el-image>
- <div class="name">{{scope.row.goodsName}}</div>
- </div>
- </template>
- </el-table-column>
- <el-table-column align="center" label="商品价格" prop="goodsPrice"></el-table-column>
- <el-table-column align="center" label="商品状态" prop="defaultAddr">
- <template slot-scope="scope">
- {{ scope.row.status ? '上架' : '下架' }}
- </template>
- </el-table-column>
- <el-table-column align="center" label="收藏时间" prop="createTime"></el-table-column>
- </el-table>
- </div>
- <div class="pagination clearfix">
- <div class="fr">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="listTotal">
- </el-pagination>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {getMemberFavoriteList} from "@/api/member";
- export default {
- name: 'MemberFavorite',
- componentName: 'MemberFavorite',
- props: ['user'],
- data() {
- return {
- dataList: [], // 数据列表
- listLoading: true, // 列表加载loading
- currentPage: 1, // 当前页码
- pageSize: 10, // 每页数量
- listTotal: 0 // 列表总数
- }
- },
- created() {
- this.getFavoriteList()
- },
- methods: {
- getFavoriteList() {
- let params = {
- userId: this.user.userId,
- pageNum: this.currentPage,
- pageSize: this.pageSize
- }
- getMemberFavoriteList(params).then(res => {
- this.dataList = res.data.records
- this.listTotal = res.data.total
- this.listLoading = false
- })
- },
- // 更改每页数量
- handleSizeChange(val) {
- this.pageSize = val
- this.currentPage = 1
- this.getList()
- },
- // 更改当前页
- handleCurrentChange(val) {
- this.currentPage = val
- this.getList()
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .goods-info {
- display: flex;
- align-items: center;
- .el-image {
- flex-shrink: 0;
- }
- .name {
- margin-left: 8px;
- text-align: left;
- }
- }
- </style>
|