商品列表修改功能完善
This commit is contained in:
parent
e6f1bd4a41
commit
b6a11dddcb
@ -6,3 +6,36 @@ export function fetchList(params) {
|
|||||||
params:params
|
params:params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function updateDeleteStatus(params) {
|
||||||
|
return request({
|
||||||
|
url:'/product/update/deleteStatus',
|
||||||
|
method:'post',
|
||||||
|
params:params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateNewStatus(params) {
|
||||||
|
return request({
|
||||||
|
url:'/product/update/newStatus',
|
||||||
|
method:'post',
|
||||||
|
params:params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateRecommendStatus(params) {
|
||||||
|
return request({
|
||||||
|
url:'/product/update/recommendStatus',
|
||||||
|
method:'post',
|
||||||
|
params:params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updatePublishStatus(params) {
|
||||||
|
return request({
|
||||||
|
url:'/product/update/publishStatus',
|
||||||
|
method:'post',
|
||||||
|
params:params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -51,3 +51,10 @@ export function updateNavStatus(data) {
|
|||||||
data:data
|
data:data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fetchListWithChildren() {
|
||||||
|
return request({
|
||||||
|
url:'/productCategory/list/withChildren',
|
||||||
|
method:'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -54,7 +54,8 @@ export const constantRouterMap = [
|
|||||||
path: 'productRecycle',
|
path: 'productRecycle',
|
||||||
name: 'productRecycle',
|
name: 'productRecycle',
|
||||||
component: () => import('@/views/pms/product/index'),
|
component: () => import('@/views/pms/product/index'),
|
||||||
meta: {title: '商品回收站', icon: 'product-recycle'}
|
meta: {title: '商品回收站', icon: 'product-recycle'},
|
||||||
|
hidden:true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'productComment',
|
path: 'productComment',
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<div class="filter-container container-frame">
|
<div class="filter-container container-frame">
|
||||||
<div>
|
<div>
|
||||||
<i class="el-icon-search" style="margin-top: 10px"></i>
|
<i class="el-icon-search"></i>
|
||||||
<span style="margin-top: 10px">筛选搜索</span>
|
<span>筛选搜索</span>
|
||||||
<el-button
|
<el-button
|
||||||
style="float: right"
|
style="float: right"
|
||||||
@click="searchBrandList()"
|
@click="searchBrandList()"
|
||||||
@ -12,14 +12,12 @@
|
|||||||
查询结果
|
查询结果
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top: 20px">
|
<div style="margin-top: 15px">
|
||||||
<span>输入搜索:</span>
|
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
|
||||||
<el-input
|
<el-form-item label="输入搜索:">
|
||||||
size="small"
|
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
|
||||||
style="width: 200px"
|
</el-form-item>
|
||||||
v-model="listQuery.keyword"
|
</el-form>
|
||||||
placeholder="品牌名称/关键字"
|
|
||||||
></el-input>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="operate-container container-frame">
|
<div class="operate-container container-frame">
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<div class="filter-container container-frame">
|
<div class="filter-container container-frame">
|
||||||
<div>
|
<div>
|
||||||
<i class="el-icon-search" style="margin-top: 10px"></i>
|
<i class="el-icon-search"></i>
|
||||||
<span style="margin-top: 10px">筛选搜索</span>
|
<span>筛选搜索</span>
|
||||||
<el-button
|
<el-button
|
||||||
style="float: right"
|
style="float: right"
|
||||||
@click="handleSearchList()"
|
@click="handleSearchList()"
|
||||||
@ -11,34 +11,39 @@
|
|||||||
size="small">
|
size="small">
|
||||||
查询结果
|
查询结果
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
style="float: right;margin-right: 15px"
|
||||||
|
@click="handleResetSearch()"
|
||||||
|
size="small">
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top: 20px">
|
<div style="margin-top: 15px">
|
||||||
<el-form :inline="true" :model="listQuery" size="small">
|
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
|
||||||
<el-form-item label="输入搜索:">
|
<el-form-item label="输入搜索:">
|
||||||
<el-input v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
|
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="商品名称"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商品货号:">
|
||||||
|
<el-input style="width: 203px" v-model="listQuery.productSn" placeholder="商品货号"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品分类:">
|
<el-form-item label="商品分类:">
|
||||||
<el-select v-model="listQuery.productCategoryId" placeholder="请选择商品分类" clearable>
|
<el-cascader
|
||||||
<el-option
|
clearable
|
||||||
v-for="item in options"
|
v-model="selectProductCateValue"
|
||||||
:key="item.value"
|
:options="productCateOptions">
|
||||||
:label="item.label"
|
</el-cascader>
|
||||||
:value="item.value">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品品牌:">
|
<el-form-item label="商品品牌:">
|
||||||
<el-select v-model="listQuery.brandId" placeholder="请选择品牌" clearable>
|
<el-select v-model="listQuery.brandId" placeholder="请选择品牌" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in options"
|
v-for="item in brandOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<br>
|
<el-form-item label="上架状态:">
|
||||||
<el-form-item label="上下架:">
|
|
||||||
<el-select v-model="listQuery.publishStatus" placeholder="全部" clearable>
|
<el-select v-model="listQuery.publishStatus" placeholder="全部" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in publishStatusOptions"
|
v-for="item in publishStatusOptions"
|
||||||
@ -142,7 +147,7 @@
|
|||||||
<p>{{scope.row.verifyStatus | verifyStatusFilter}}</p>
|
<p>{{scope.row.verifyStatus | verifyStatusFilter}}</p>
|
||||||
<p>
|
<p>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
type="text"
|
||||||
@click="handleDelete(scope.$index, scope.row)">审核详情
|
@click="handleDelete(scope.$index, scope.row)">审核详情
|
||||||
</el-button>
|
</el-button>
|
||||||
</p>
|
</p>
|
||||||
@ -153,17 +158,17 @@
|
|||||||
<p>
|
<p>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleUpdate(scope.$index, scope.row)">查看
|
@click="handleShowProduct(scope.$index, scope.row)">查看
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleDelete(scope.$index, scope.row)">编辑
|
@click="handleEdit(scope.$index, scope.row)">编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleUpdate(scope.$index, scope.row)">日志
|
@click="handleShowLog(scope.$index, scope.row)">日志
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -210,8 +215,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {fetchList} from '@/api/product'
|
import {
|
||||||
|
fetchList,
|
||||||
|
updateDeleteStatus,
|
||||||
|
updateNewStatus,
|
||||||
|
updateRecommendStatus,
|
||||||
|
updatePublishStatus
|
||||||
|
} from '@/api/product'
|
||||||
|
import {fetchList as fetchBrandList} from '@/api/brand'
|
||||||
|
import {fetchListWithChildren} from '@/api/productCate'
|
||||||
|
|
||||||
|
const defaultListQuery = {
|
||||||
|
keyword: null,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 5,
|
||||||
|
publishStatus: null,
|
||||||
|
verifyStatus: null,
|
||||||
|
productSn: null,
|
||||||
|
productCategoryId: null,
|
||||||
|
brandId: null
|
||||||
|
};
|
||||||
export default {
|
export default {
|
||||||
name: "productList",
|
name: "productList",
|
||||||
data() {
|
data() {
|
||||||
@ -251,27 +274,14 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
operateType: null,
|
operateType: null,
|
||||||
listQuery: {
|
listQuery: Object.assign({}, defaultListQuery),
|
||||||
keyword: null,
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 5,
|
|
||||||
publishStatus: null,
|
|
||||||
verifyStatus: null,
|
|
||||||
productSn: null,
|
|
||||||
productCategoryId: null,
|
|
||||||
brandId: null,
|
|
||||||
},
|
|
||||||
list: null,
|
list: null,
|
||||||
total: null,
|
total: null,
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
|
selectProductCateValue: null,
|
||||||
multipleSelection: [],
|
multipleSelection: [],
|
||||||
options: [{
|
productCateOptions: [],
|
||||||
value: '选项1',
|
brandOptions: [],
|
||||||
label: '黄金糕'
|
|
||||||
}, {
|
|
||||||
value: '选项2',
|
|
||||||
label: '双皮奶'
|
|
||||||
}],
|
|
||||||
publishStatusOptions: [{
|
publishStatusOptions: [{
|
||||||
value: 1,
|
value: 1,
|
||||||
label: '上架'
|
label: '上架'
|
||||||
@ -290,6 +300,18 @@
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
|
this.getBrandList();
|
||||||
|
this.getProductCateList();
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
selectProductCateValue: function (newValue) {
|
||||||
|
if (newValue != null && newValue.length == 2) {
|
||||||
|
this.listQuery.productCategoryId = newValue[1];
|
||||||
|
} else {
|
||||||
|
this.listQuery.productCategoryId = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
verifyStatusFilter(value) {
|
verifyStatusFilter(value) {
|
||||||
@ -309,6 +331,30 @@
|
|||||||
this.total = response.data.total;
|
this.total = response.data.total;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
getBrandList() {
|
||||||
|
fetchBrandList({pageNum: 1, pageSize: 100}).then(response => {
|
||||||
|
this.brandOptions = [];
|
||||||
|
let brandList = response.data.list;
|
||||||
|
for (let i = 0; i < brandList.length; i++) {
|
||||||
|
this.brandOptions.push({label: brandList[i].name, value: brandList[i].id});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getProductCateList() {
|
||||||
|
fetchListWithChildren().then(response => {
|
||||||
|
let list = response.data;
|
||||||
|
this.productCateOptions = [];
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
let children = [];
|
||||||
|
if (list[i].children != null && list[i].children.length > 0) {
|
||||||
|
for (let j = 0; j < list[i].children.length; j++) {
|
||||||
|
children.push({label: list[i].children[j].name, value: list[i].children[j].id});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.productCateOptions.push({label: list[i].name, value: list[i].id, children: children});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
handleSearchList() {
|
handleSearchList() {
|
||||||
this.listQuery.pageNum = 1;
|
this.listQuery.pageNum = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
@ -317,7 +363,60 @@
|
|||||||
console.log("handleAddItem");
|
console.log("handleAddItem");
|
||||||
},
|
},
|
||||||
handleBatchOperate() {
|
handleBatchOperate() {
|
||||||
console.log("handleBatchOperate");
|
if(this.operateType==null){
|
||||||
|
this.$message({
|
||||||
|
message: '请选择操作类型',
|
||||||
|
type: 'warning',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(this.multipleSelection==null||this.multipleSelection.length<1){
|
||||||
|
this.$message({
|
||||||
|
message: '请选择要操作的商品',
|
||||||
|
type: 'warning',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$confirm('是否要进行该批量操作?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
let ids=[];
|
||||||
|
for(let i=0;i<this.multipleSelection.length;i++){
|
||||||
|
ids.push(this.multipleSelection[i].id);
|
||||||
|
}
|
||||||
|
switch (this.operateType) {
|
||||||
|
case this.operates[0].value:
|
||||||
|
this.updatePublishStatus(1,ids);
|
||||||
|
break;
|
||||||
|
case this.operates[1].value:
|
||||||
|
this.updatePublishStatus(0,ids);
|
||||||
|
break;
|
||||||
|
case this.operates[2].value:
|
||||||
|
this.updateRecommendStatus(1,ids);
|
||||||
|
break;
|
||||||
|
case this.operates[3].value:
|
||||||
|
this.updateRecommendStatus(0,ids);
|
||||||
|
break;
|
||||||
|
case this.operates[4].value:
|
||||||
|
this.updateNewStatus(1,ids);
|
||||||
|
break;
|
||||||
|
case this.operates[5].value:
|
||||||
|
this.updateNewStatus(0,ids);
|
||||||
|
break;
|
||||||
|
case this.operates[6].value:
|
||||||
|
break;
|
||||||
|
case this.operates[7].value:
|
||||||
|
this.updateDeleteStatus(1,ids);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handleSizeChange(val) {
|
handleSizeChange(val) {
|
||||||
this.listQuery.pageNum = 1;
|
this.listQuery.pageNum = 1;
|
||||||
@ -332,13 +431,83 @@
|
|||||||
this.multipleSelection = val;
|
this.multipleSelection = val;
|
||||||
},
|
},
|
||||||
handlePublishStatusChange(index, row) {
|
handlePublishStatusChange(index, row) {
|
||||||
console.log("handleBatchOperate");
|
let ids = [];
|
||||||
|
ids.push(row.id);
|
||||||
|
this.updatePublishStatus(row.publishStatus, ids);
|
||||||
},
|
},
|
||||||
handleNewStatusChange(index, row) {
|
handleNewStatusChange(index, row) {
|
||||||
console.log("handleBatchOperate");
|
let ids = [];
|
||||||
|
ids.push(row.id);
|
||||||
|
this.updateNewStatus(row.newStatus, ids);
|
||||||
},
|
},
|
||||||
handleRecommendStatusChange(index, row) {
|
handleRecommendStatusChange(index, row) {
|
||||||
console.log("handleBatchOperate");
|
let ids = [];
|
||||||
|
ids.push(row.id);
|
||||||
|
this.updateRecommendStatus(row.recommandStatus, ids);
|
||||||
|
},
|
||||||
|
handleResetSearch() {
|
||||||
|
this.selectProductCateValue = [];
|
||||||
|
this.listQuery = Object.assign({}, defaultListQuery);
|
||||||
|
},
|
||||||
|
handleDelete(index, row){
|
||||||
|
this.$confirm('是否要进行删除操作?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
let ids = [];
|
||||||
|
ids.push(row.id);
|
||||||
|
this.updateDeleteStatus(1,ids);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
updatePublishStatus(publishStatus, ids) {
|
||||||
|
let params = new URLSearchParams();
|
||||||
|
params.append('ids', ids);
|
||||||
|
params.append('publishStatus', publishStatus);
|
||||||
|
updatePublishStatus(params).then(response => {
|
||||||
|
this.$message({
|
||||||
|
message: '修改成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
updateNewStatus(newStatus, ids) {
|
||||||
|
let params = new URLSearchParams();
|
||||||
|
params.append('ids', ids);
|
||||||
|
params.append('newStatus', newStatus);
|
||||||
|
updateNewStatus(params).then(response => {
|
||||||
|
this.$message({
|
||||||
|
message: '修改成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
updateRecommendStatus(recommendStatus, ids) {
|
||||||
|
let params = new URLSearchParams();
|
||||||
|
params.append('ids', ids);
|
||||||
|
params.append('recommendStatus', recommendStatus);
|
||||||
|
updateRecommendStatus(params).then(response => {
|
||||||
|
this.$message({
|
||||||
|
message: '修改成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
updateDeleteStatus(deleteStatus, ids) {
|
||||||
|
let params = new URLSearchParams();
|
||||||
|
params.append('ids', ids);
|
||||||
|
params.append('deleteStatus', deleteStatus);
|
||||||
|
updateDeleteStatus(params).then(response => {
|
||||||
|
this.$message({
|
||||||
|
message: '删除成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.getList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user