Commit ad00b1a8 by lixiaomin

修改店铺商品分页

parent edabb35b
...@@ -74,6 +74,16 @@ ...@@ -74,6 +74,16 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination
style="text-align:right;padding-top: 20px;"
@size-change="configSizeChange"
@current-change="configCurrentChange"
:current-page="pageNum"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next,jumper"
:total="totalNum">
</el-pagination>
</div> </div>
</template> </template>
...@@ -96,12 +106,16 @@ export default { ...@@ -96,12 +106,16 @@ export default {
components: { SelectGoods, AddRecommend, Preferential }, components: { SelectGoods, AddRecommend, Preferential },
data() { data() {
return { return {
pageNum:1,
pageSize:10,
totalNum:0,
loading: false, loading: false,
list: [], list: [],
options: [], options: [],
btnId: '', btnId: '',
outIds: '', outIds: '',
total: null total: null,
goodsList:[]
} }
}, },
mounted() { mounted() {
...@@ -133,8 +147,10 @@ export default { ...@@ -133,8 +147,10 @@ export default {
}, },
setData(data) { setData(data) {
this.list = data.goodsList; this.list = data.goodsList;
this.goodsList=data.goodsList;
this.btnId = data.id; this.btnId = data.id;
this.total=this.list.length; this.total=this.list.length;
this.totalNum=this.list.length;
}, },
getList() { getList() {
if (!this.shopId) return; if (!this.shopId) return;
...@@ -152,7 +168,9 @@ export default { ...@@ -152,7 +168,9 @@ export default {
} }
} }
} }
this.goodsList=this.list;
this.total=this.list.length; this.total=this.list.length;
this.totalNum=this.list.length;
}else{ }else{
this.options=[]; this.options=[];
} }
...@@ -214,7 +232,23 @@ export default { ...@@ -214,7 +232,23 @@ export default {
message: '已取消所选的商品!' message: '已取消所选的商品!'
}); });
}); });
} },
getPageList(){
let startRow = (this.pageNum - 1) * this.pageSize+1-1;//开始显示的行
let endRow = this.pageNum * this.pageSize;//结束显示的行
endRow = (endRow > this.totalNum)? this.totalNum : endRow;
this.list=this.goodsList.slice(startRow,endRow);
},
configSizeChange(size){
this.pageNum=1;
this.pageSize=size;
this.getPageList();
},
configCurrentChange(current){
this.pageNum=current;
this.pageSize=this.pageSize;
this.getPageList();
},
} }
} }
</script> </script>
...@@ -224,6 +258,6 @@ export default { ...@@ -224,6 +258,6 @@ export default {
height: 50px; height: 50px;
align-items: center; align-items: center;
text-align: right; text-align: right;
} }
</style> </style>
\ No newline at end of file
...@@ -108,6 +108,8 @@ export default { ...@@ -108,6 +108,8 @@ export default {
height: 50px; height: 50px;
align-items: center; align-items: center;
text-align: right; text-align: right;
}
.pagination-container {
height: 30px;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment