商品列表功能
This commit is contained in:
parent
6c01794fa3
commit
e6f1bd4a41
8
src/api/product.js
Normal file
8
src/api/product.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
export function fetchList(params) {
|
||||||
|
return request({
|
||||||
|
url:'/product/list',
|
||||||
|
method:'get',
|
||||||
|
params:params
|
||||||
|
})
|
||||||
|
}
|
@ -1,10 +1,345 @@
|
|||||||
<template>
|
<template>
|
||||||
<div> {{msg}}</div>
|
<div class="app-container">
|
||||||
|
<div class="filter-container container-frame">
|
||||||
|
<div>
|
||||||
|
<i class="el-icon-search" style="margin-top: 10px"></i>
|
||||||
|
<span style="margin-top: 10px">筛选搜索</span>
|
||||||
|
<el-button
|
||||||
|
style="float: right"
|
||||||
|
@click="handleSearchList()"
|
||||||
|
type="primary"
|
||||||
|
size="small">
|
||||||
|
查询结果
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 20px">
|
||||||
|
<el-form :inline="true" :model="listQuery" size="small">
|
||||||
|
<el-form-item label="输入搜索:">
|
||||||
|
<el-input v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商品分类:">
|
||||||
|
<el-select v-model="listQuery.productCategoryId" placeholder="请选择商品分类" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in options"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商品品牌:">
|
||||||
|
<el-select v-model="listQuery.brandId" placeholder="请选择品牌" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in options"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<br>
|
||||||
|
<el-form-item label="上下架:">
|
||||||
|
<el-select v-model="listQuery.publishStatus" placeholder="全部" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in publishStatusOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="审核状态:">
|
||||||
|
<el-select v-model="listQuery.verifyStatus" placeholder="全部" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in verifyStatusOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<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="handleAddItem()"
|
||||||
|
size="mini">
|
||||||
|
添加
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="table-container">
|
||||||
|
<el-table ref="productTable"
|
||||||
|
:data="list"
|
||||||
|
style="width: 100%"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
v-loading="listLoading"
|
||||||
|
border>
|
||||||
|
<el-table-column type="selection" width="60" align="center"></el-table-column>
|
||||||
|
<el-table-column label="编号" width="100" align="center">
|
||||||
|
<template slot-scope="scope">{{scope.row.id}}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="商品图片" width="120" align="center">
|
||||||
|
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.pic"></template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="商品名称" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<p>{{scope.row.name}}</p>
|
||||||
|
<p>品牌:{{scope.row.brandName}}</p>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="价格/货号" width="120" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<p>价格:¥{{scope.row.price}}</p>
|
||||||
|
<p>货号:{{scope.row.productSn}}</p>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="标签" width="140" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<p>上架:
|
||||||
|
<el-switch
|
||||||
|
@change="handlePublishStatusChange(scope.$index, scope.row)"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
v-model="scope.row.publishStatus">
|
||||||
|
</el-switch>
|
||||||
|
</p>
|
||||||
|
<p>新品:
|
||||||
|
<el-switch
|
||||||
|
@change="handleNewStatusChange(scope.$index, scope.row)"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
v-model="scope.row.newStatus">
|
||||||
|
</el-switch>
|
||||||
|
</p>
|
||||||
|
<p>推荐:
|
||||||
|
<el-switch
|
||||||
|
@change="handleRecommendStatusChange(scope.$index, scope.row)"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
v-model="scope.row.recommandStatus">
|
||||||
|
</el-switch>
|
||||||
|
</p>
|
||||||
|
</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="SKU库存" width="100" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="primary" icon="el-icon-edit" circle></el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="销量" width="100" align="center">
|
||||||
|
<template slot-scope="scope">{{scope.row.sale}}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="审核状态" width="100" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<p>{{scope.row.verifyStatus | verifyStatusFilter}}</p>
|
||||||
|
<p>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
@click="handleDelete(scope.$index, scope.row)">审核详情
|
||||||
|
</el-button>
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="160" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<p>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
@click="handleUpdate(scope.$index, scope.row)">查看
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
@click="handleDelete(scope.$index, scope.row)">编辑
|
||||||
|
</el-button>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<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>
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<div class="batch-operate-container">
|
||||||
|
<el-select
|
||||||
|
size="small"
|
||||||
|
v-model="operateType" placeholder="批量操作">
|
||||||
|
<el-option
|
||||||
|
v-for="item in operates"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-button
|
||||||
|
style="margin-left: 20px"
|
||||||
|
class="search-button"
|
||||||
|
@click="handleBatchOperate()"
|
||||||
|
type="primary"
|
||||||
|
size="small">
|
||||||
|
确定
|
||||||
|
</el-button>
|
||||||
|
</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>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default{
|
import {fetchList} from '@/api/product'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "productList",
|
||||||
data() {
|
data() {
|
||||||
return {msg: '商品列表'}
|
return {
|
||||||
|
operates: [
|
||||||
|
{
|
||||||
|
label: "商品上架",
|
||||||
|
value: "publishOn"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "商品下架",
|
||||||
|
value: "publishOff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "设为推荐",
|
||||||
|
value: "recommendOn"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "取消推荐",
|
||||||
|
value: "recommendOff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "设为新品",
|
||||||
|
value: "newOn"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "取消新品",
|
||||||
|
value: "newOff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "转移到分类",
|
||||||
|
value: "transferCategory"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "移入回收站",
|
||||||
|
value: "recycle"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
operateType: null,
|
||||||
|
listQuery: {
|
||||||
|
keyword: null,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 5,
|
||||||
|
publishStatus: null,
|
||||||
|
verifyStatus: null,
|
||||||
|
productSn: null,
|
||||||
|
productCategoryId: null,
|
||||||
|
brandId: null,
|
||||||
|
},
|
||||||
|
list: null,
|
||||||
|
total: null,
|
||||||
|
listLoading: true,
|
||||||
|
multipleSelection: [],
|
||||||
|
options: [{
|
||||||
|
value: '选项1',
|
||||||
|
label: '黄金糕'
|
||||||
|
}, {
|
||||||
|
value: '选项2',
|
||||||
|
label: '双皮奶'
|
||||||
|
}],
|
||||||
|
publishStatusOptions: [{
|
||||||
|
value: 1,
|
||||||
|
label: '上架'
|
||||||
|
}, {
|
||||||
|
value: 0,
|
||||||
|
label: '下架'
|
||||||
|
}],
|
||||||
|
verifyStatusOptions: [{
|
||||||
|
value: 1,
|
||||||
|
label: '审核通过'
|
||||||
|
}, {
|
||||||
|
value: 0,
|
||||||
|
label: '未审核'
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
filters: {
|
||||||
|
verifyStatusFilter(value) {
|
||||||
|
if (value === 1) {
|
||||||
|
return '审核通过';
|
||||||
|
} else {
|
||||||
|
return '未审核';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
this.listLoading = true;
|
||||||
|
fetchList(this.listQuery).then(response => {
|
||||||
|
this.listLoading = false;
|
||||||
|
this.list = response.data.list;
|
||||||
|
this.total = response.data.total;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleSearchList() {
|
||||||
|
this.listQuery.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
handleAddItem() {
|
||||||
|
console.log("handleAddItem");
|
||||||
|
},
|
||||||
|
handleBatchOperate() {
|
||||||
|
console.log("handleBatchOperate");
|
||||||
|
},
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.listQuery.pageNum = 1;
|
||||||
|
this.listQuery.pageSize = val;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.listQuery.pageNum = val;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
handleSelectionChange(val) {
|
||||||
|
this.multipleSelection = val;
|
||||||
|
},
|
||||||
|
handlePublishStatusChange(index, row) {
|
||||||
|
console.log("handleBatchOperate");
|
||||||
|
},
|
||||||
|
handleNewStatusChange(index, row) {
|
||||||
|
console.log("handleBatchOperate");
|
||||||
|
},
|
||||||
|
handleRecommendStatusChange(index, row) {
|
||||||
|
console.log("handleBatchOperate");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user