web-base-admin/src/views/wholeNetwork/productManage/index.vue

389 lines
9.7 KiB
Vue

<template>
<div class="page">
<topBar
v-if="topList.length > 0"
:top-list="topList"
:moren="defaultSelected"
/>
<div class="thetopbox">
<el-form label-width="100px">
<el-row>
<el-col :span="4">
<el-form-item label="仓储编号" prop="productName">
<el-input v-model="select.wmsCode" clearable />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="产品名称" prop="productName">
<el-input v-model="select.productName" clearable />
</el-form-item>
</el-col>
<!-- <el-col :span="8">
<el-form-item label="时间范围" prop="timeRange">
<el-date-picker
v-model="timeRange"
value-format="yyyy-MM-dd"
type="daterange"
:clearable="false"
:range-separator="'至'"
:start-placeholder="'开始日期'"
:end-placeholder="'结束日期'"
@change="changeTime"
/>
</el-form-item>
</el-col> -->
<el-col :span="4">
<div class="searchbox">
<el-button
class="my_search"
@click="
() => {
getSearch();
resetPageNum();
}
"
>
{{ '搜索' }}</el-button>
<el-button class="my_reset" @click="resetHandle">
{{ '重置' }}</el-button>
</div>
</el-col>
</el-row>
</el-form>
</div>
<div class="main">
<div class="maintop">
<div class="mainbtn">
<el-button v-hasButtons="['WholeNetworkProductManageListAdd']" size="small" class="addBtn" @click="addHandle">
新增</el-button>
<el-button v-hasButtons="['WholeNetworkProductManageListExport']" size="small" class="thebtn1" @click="handleExport">
导出</el-button>
</div>
</div>
<div class="maintable">
<el-table
v-loading="loading"
:data="tableData"
height="700px"
style="width: 100%"
:header-cell-style="{ background: '#EEEEEE' }"
@selection-change="handleSelectionChange"
>
<el-table-column prop="colsele" type="selection" width="55" />
<el-table-column
align="center"
prop="wmsCode"
label="仓储编号"
/>
<el-table-column
align="center"
prop="productName"
label="产品名称"
min-width="180px"
/>
<el-table-column
align="center"
prop="inventory"
label="库存数量"
/>
<el-table-column
align="center"
prop="cover"
label="封面图"
>
<template slot-scope="scope">
<img :src="scope.row.cover" alt="" style="width: 50px; height: 50px;">
</template>
</el-table-column>
<el-table-column
align="center"
prop="remark"
label="备注"
/>
<el-table-column
align="center"
prop="colsele"
label="操作"
>
<template slot-scope="scope">
<el-button
type="text"
size="small"
style="color: #48b2fd; padding: 0"
@click.native.prevent="goDetail(scope.row)"
>
详情
</el-button>
<el-button
type="text"
size="small"
style="color: rgb(55, 191, 70); padding: 0"
@click.native.prevent="updateHandle(scope.row)"
>
修改
</el-button>
<el-button
type="text"
size="small"
style="padding: 0; color: #f3a900"
@click.native.prevent="updateInventoryHandle(scope.row)"
>
修改库存
</el-button>
<el-button
type="text"
size="small"
style="padding: 0; color: #c8161d"
@click.native.prevent="delHandle(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getSearch"
/>
<UpdateDialog
v-if="updateDialogVisible"
:visible.sync="updateDialogVisible"
:is-edit="isEdit"
:product-info="productInfo"
@success="getSearch"
/>
<UpdateInventory
v-if="updateInventoryVisible"
:visible.sync="updateInventoryVisible"
:inventory-info="inventoryInfo"
@success="getSearch"
/>
</div>
</template>
<script>
import { getProductList, deleteProduct } from '@/api/wholeNetwork/productManage'
import topBar from '@/components/topBar'
import { getMonthFirstDay, getMonthLastDay } from '@/utils/date'
import UpdateDialog from './components/UpdateDialog.vue'
import UpdateInventory from './components/UpdateInventory.vue'
const initSearch = {
productName: '',
wmsCode: ''
}
export default {
name: 'WholeNetworkProductManageList',
components: {
topBar,
UpdateDialog,
UpdateInventory
},
data() {
return {
defaultSelected: 'wholeNetworkProductManageList',
topList: [
{
name: '全网商品管理',
path: 'wholeNetworkProductManageList'
}
],
tableData: [],
loading: false,
queryParams: {
pageNum: 1,
pageSize: 50
},
timeRange: [
getMonthFirstDay(),
getMonthLastDay()
],
select: {
...initSearch
},
total: 0,
multipleSelection: [],
updateDialogVisible: false,
isEdit: false,
productInfo: {
remark: ''
},
updateInventoryVisible: false,
inventoryInfo: {
inventory: ''
}
}
},
created() {
this.getSearch()
},
methods: {
delHandle(val) {
this.$confirm('是否确认删除该数据?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then((_) => {
deleteProduct(val.pkId).then((res) => {
if (res.code === 200) {
this.$message.success('删除成功')
this.getSearch()
}
})
})
},
updateHandle(val) {
this.isEdit = true
this.productInfo = val
this.updateDialogVisible = true
},
addHandle() {
this.isEdit = false
this.productInfo = {
remark: ''
}
this.updateDialogVisible = true
},
updateInventoryHandle(val) {
this.inventoryInfo = val
this.updateInventoryVisible = true
},
goDetail(val) {
this.$router.push({
path: 'productManageDetails',
query: {
pkId: val.pkId
}
})
},
// 导出
handleExport() {
this.$confirm('是否确认导出所有数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then((_) => {
this.download(
'/sale/manage/all-product/export',
Object.assign({}, this.queryParams, this.select),
`${'全网商品管理'}${new Date().getTime()}.xlsx`
)
})
},
handleSelectionChange(val) {
this.multipleSelection = val
},
resetHandle() {
this.queryParams = {
pageNum: 1,
pageSize: 50
}
this.select = {
...initSearch
}
this.getSearch()
},
getSearch() {
this.loading = true
const params = {
...this.queryParams,
...this.select
}
getProductList(params).then((res) => {
this.loading = false
if (res.code === 200) {
this.tableData = res.rows
this.total = res.total
}
})
},
resetPageNum() {
this.queryParams.pageNum = 1
}
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-image-viewer__close {
right: 500px;
}
::v-deep .dizhi .el-cascader {
width: 100%;
}
::v-deep .el-range-editor.el-input__inner {
width: 100%;
}
::v-deep .el-table thead {
color: #000000;
}
::v-deep .el-table .warning-row {
background: #f9f9f9;
}
.page {
padding: 10px 20px;
background: #f9f9f9;
font-size: 14px;
.thetopbox {
padding: 15px 20px 15px 0;
background: #ffffff;
border-radius: 8px;
.searchbox {
display: flex;
align-items: center;
margin-left: 40px;
}
.searchtitle {
margin-right: 10px;
}
.searchbtn {
background: #08143f;
color: #ffffff;
}
}
.main {
//margin-top: 20px;
background: #f9f9f9;
//border-radius: 8px;
//box-shadow: 0px 2px 20px 0px rgba(238, 238, 238, 0.5);
.maintop {
display: flex;
// padding: 10px 0;
justify-content: space-between;
align-items: center;
.mainbtn {
.thebtn1 {
color: #ffffff;
background: #ffad41;
width: 68px;
height: 32px;
}
.thebtn2 {
color: #ffffff;
background: #009b58;
width: 68px;
height: 32px;
}
.thebtn3 {
color: #ffffff;
background: #c8161d;
width: 68px;
height: 32px;
}
}
}
}
}
</style>