Skip to content

Commit

Permalink
添加商品分类列表
Browse files Browse the repository at this point in the history
  • Loading branch information
zhh committed May 22, 2018
1 parent afb0ed0 commit 8a90048
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 6 deletions.
8 changes: 8 additions & 0 deletions src/api/productCate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import request from '@/utils/request'
export function fetchList(parentId,params) {
return request({
url:'/productCategory/list/'+parentId,
method:'get',
params:params
})
}
2 changes: 1 addition & 1 deletion src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const constantRouterMap = [
{
path: 'productCate',
name: 'productCate',
component: () => import('@/views/pms/product/index'),
component: () => import('@/views/pms/productCate/index'),
meta: {title: '商品分类', icon: 'product-cate'}
},
{
Expand Down
6 changes: 3 additions & 3 deletions src/views/pms/brand/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="80" align="center">
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="品牌名称" align="center">
Expand All @@ -50,7 +50,7 @@
<el-table-column label="品牌首字母" width="100" align="center">
<template slot-scope="scope">{{scope.row.firstLetter}}</template>
</el-table-column>
<el-table-column label="排序" width="80" align="center">
<el-table-column label="排序" width="100" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="品牌制造商" width="100" align="center">
Expand Down Expand Up @@ -89,7 +89,7 @@
</el-button>
</template>
</el-table-column>
<el-table-column label="操作" width="220" align="center">
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
Expand Down
4 changes: 2 additions & 2 deletions src/views/pms/productAttr/productAttrList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="80" align="center">
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="属性名称" width="140" align="center">
Expand All @@ -37,7 +37,7 @@
<el-table-column label="可选值列表" align="center">
<template slot-scope="scope">{{scope.row.inputList}}</template>
</el-table-column>
<el-table-column label="排序" width="120" align="center">
<el-table-column label="排序" width="100" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
Expand Down
172 changes: 172 additions & 0 deletions src/views/pms/productCate/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
<template>
<div class="app-container">
<div class="operate-container container-frame">
<i class="el-icon-tickets" style="margin-top: 5px"></i>
<span style="margin-top: 5px">数据列表</span>
<el-button
class="btn-add"
@click="handleAddProductCate()"
size="mini">
添加
</el-button>
</div>
<div class="table-container">
<el-table ref="productCateTable"
style="width: 100%"
:data="list"
v-loading="listLoading" border>
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="分类名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="级别" width="100" align="center">
<template slot-scope="scope">{{scope.row.level | levelFilter}}</template>
</el-table-column>
<el-table-column label="商品数量" width="100" align="center">
<template slot-scope="scope">{{scope.row.productCount }}</template>
</el-table-column>
<el-table-column label="数量单位" width="100" align="center">
<template slot-scope="scope">{{scope.row.productUnit }}</template>
</el-table-column>
<el-table-column label="导航栏" width="100" align="center">
<template slot-scope="scope">
<el-switch
@change="handleNavStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.navStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="是否显示" width="100" align="center">
<template slot-scope="scope">
<el-switch
@change="handleShowStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.showStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="排序" width="100" align="center">
<template slot-scope="scope">{{scope.row.sort }}</template>
</el-table-column>
<el-table-column label="设置" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleShowNextLevel(scope.$index, scope.row)">查看下级
</el-button>
<el-button
size="mini"
@click="handleTransferProduct(scope.$index, scope.row)">转移商品
</el-button>
</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>

<script>
import {fetchList} from '@/api/productCate'
export default {
name: "productCateList",
data() {
return {
list: null,
total: null,
listLoading: true,
listQuery: {
pageNum: 1,
pageSize: 5
},
parentId: 0
}
},
created() {
this.getList();
},
methods: {
handleAddProductCate() {
console.log('handleAddProductCate');
},
getList() {
this.listLoading = true;
fetchList(this.parentId, this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
});
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleNavStatusChange(index, row) {
console.log('handleAddProductCate');
},
handleShowStatusChange(index, row) {
console.log('handleAddProductCate');
},
handleShowNextLevel(index, row) {
console.log('handleAddProductCate');
},
handleTransferProduct(index, row) {
console.log('handleAddProductCate');
},
handleUpdate(index, row) {
console.log('handleAddProductCate');
},
handleDelete(index, row) {
console.log('handleAddProductCate');
}
},
filters: {
levelFilter(value) {
if (value === 0) {
return '一级';
} else if (value === 1) {
return '二级';
}
}
}
}
</script>

<style scoped>
</style>

0 comments on commit 8a90048

Please sign in to comment.