|
|
|
|
@ -37,12 +37,8 @@
|
|
|
|
|
类别
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<el-cascader
|
|
|
|
|
clearable
|
|
|
|
|
placeholder="类别选择"
|
|
|
|
|
style="width: 170px;" size="small"
|
|
|
|
|
:options="types" :show-all-levels="false"
|
|
|
|
|
:props="{value:'id',label:'title',expandTrigger:'hover'}"
|
|
|
|
|
<el-cascader clearable placeholder="类别选择" style="width: 170px;" size="small" :options="types"
|
|
|
|
|
:show-all-levels="false" :props="{value:'id',label:'title',expandTrigger:'hover'}"
|
|
|
|
|
@change="e => select.productTypeId = e.at(-1)">
|
|
|
|
|
</el-cascader>
|
|
|
|
|
</div>
|
|
|
|
|
@ -50,7 +46,8 @@
|
|
|
|
|
</template>
|
|
|
|
|
</xy-selectors>
|
|
|
|
|
<Button type="primary" @click="searchProducts">查询</Button>
|
|
|
|
|
<Button type="primary" @click="$refs['addProduct'].isShow = true,$refs['addProduct'].type = 'add'" style="margin-left: 10px;">新增</Button>
|
|
|
|
|
<Button type="primary" @click="$refs['addProduct'].isShow = true,$refs['addProduct'].type = 'add'"
|
|
|
|
|
style="margin-left: 10px;">新增</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- <div class="selector">-->
|
|
|
|
|
<!-- <div class="selector-item">-->
|
|
|
|
|
@ -97,26 +94,20 @@
|
|
|
|
|
</lx-header>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<xy-table :total="total" :list="list" :table-item="table" @pageSizeChange="pageSizeChange" @pageIndexChange="pageChange">
|
|
|
|
|
<xy-table :total="total" :list="list" :table-item="table" @pageSizeChange="pageSizeChange"
|
|
|
|
|
@pageIndexChange="pageChange">
|
|
|
|
|
<template v-slot:btns>
|
|
|
|
|
<el-table-column fixed="right" label="操作" width="300" header-align="center">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<Button type="primary" size="small" @click="editorShow(scope.row.id,'editor')">编辑</Button>
|
|
|
|
|
<Button type="primary" size="small" style="margin-left: 10px;" @click="editorShow(scope.row.id,'copy')">复制新增</Button>
|
|
|
|
|
<Poptip
|
|
|
|
|
transfer
|
|
|
|
|
confirm
|
|
|
|
|
title="确认要删除吗?"
|
|
|
|
|
@on-ok="deleteProduct(scope.row)">
|
|
|
|
|
<Button type="primary" size="small" style="margin-left: 10px;"
|
|
|
|
|
@click="editorShow(scope.row.id,'copy')">复制新增</Button>
|
|
|
|
|
<Poptip transfer confirm title="确认要删除吗?" @on-ok="deleteProduct(scope.row)">
|
|
|
|
|
<Button type="primary" style="margin-left: 10px;" size="small" ghost>删除</Button>
|
|
|
|
|
</Poptip>
|
|
|
|
|
<el-switch
|
|
|
|
|
style="margin-left: 10px;"
|
|
|
|
|
:value="scope.row.state_name == '已上架' ? true : false"
|
|
|
|
|
active-color="#BF617C"
|
|
|
|
|
inactive-color="#E5E5E5"
|
|
|
|
|
:active-text="scope.row.state_name == '已上架' ? '已上架' : '已下架'"
|
|
|
|
|
@change="stateChange(scope.row)">
|
|
|
|
|
<el-switch style="margin-left: 10px;" :value="scope.row.state_name == '已上架' ? true : false"
|
|
|
|
|
active-color="#BF617C" inactive-color="#E5E5E5"
|
|
|
|
|
:active-text="scope.row.state_name == '已上架' ? '已上架' : '已下架'" @change="stateChange(scope.row)">
|
|
|
|
|
</el-switch>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
@ -129,12 +120,22 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {index as typeIndex} from '@/api/type'
|
|
|
|
|
import {index,toggleActive,destroy} from '@/api/product'
|
|
|
|
|
import {index as merchantIndex} from "@/api/merchant"
|
|
|
|
|
import {
|
|
|
|
|
index as typeIndex
|
|
|
|
|
} from '@/api/type'
|
|
|
|
|
import {
|
|
|
|
|
index,
|
|
|
|
|
toggleActive,
|
|
|
|
|
destroy
|
|
|
|
|
} from '@/api/product'
|
|
|
|
|
import {
|
|
|
|
|
index as merchantIndex
|
|
|
|
|
} from "@/api/merchant"
|
|
|
|
|
|
|
|
|
|
import addProduct from '@/views/productService/components/addProduct'
|
|
|
|
|
import { Message } from 'element-ui'
|
|
|
|
|
import {
|
|
|
|
|
Message
|
|
|
|
|
} from 'element-ui'
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
addProduct
|
|
|
|
|
@ -152,8 +153,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
total: 0,
|
|
|
|
|
list: [],
|
|
|
|
|
table:[
|
|
|
|
|
{
|
|
|
|
|
table: [{
|
|
|
|
|
prop: 'name',
|
|
|
|
|
label: '名称',
|
|
|
|
|
width: 260,
|
|
|
|
|
@ -201,16 +201,34 @@ export default {
|
|
|
|
|
{
|
|
|
|
|
prop: 'sortnumber',
|
|
|
|
|
label: '同级排序',
|
|
|
|
|
width: 130
|
|
|
|
|
width: 130,
|
|
|
|
|
customFn: (row) => {
|
|
|
|
|
return ( <input class = 'sortinput el-input__inner'
|
|
|
|
|
type='number'
|
|
|
|
|
on = {
|
|
|
|
|
{
|
|
|
|
|
["keyup"]: (e) => (this.updateSort(e, row.id, row))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
value = {
|
|
|
|
|
row.sortnumber
|
|
|
|
|
}> </input>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'state_name',
|
|
|
|
|
label: '状态',
|
|
|
|
|
customFn: (row) => {
|
|
|
|
|
if (row.state_name == '已上架') {
|
|
|
|
|
return (<div style="color: green">{row.state_name}</div>)
|
|
|
|
|
}else{
|
|
|
|
|
return (<div style="color: red">{row.state_name}</div>)
|
|
|
|
|
return ( <div style = "color: green" > {
|
|
|
|
|
row.state_name
|
|
|
|
|
} </div>)
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return ( <div style = "color: red" > {
|
|
|
|
|
row.state_name
|
|
|
|
|
} </div>)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -229,7 +247,25 @@ export default {
|
|
|
|
|
this.select.pageSize = e;
|
|
|
|
|
this.searchProducts();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
updateSort(e, id, row, type) {
|
|
|
|
|
if (e.keyCode === 13) {
|
|
|
|
|
if(e.target.value==row.sortnumber){
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.$confirm('是否确认更改排序?', '提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.$refs['addProduct'].type = 'editor';
|
|
|
|
|
this.$refs['addProduct'].id = id;
|
|
|
|
|
this.$refs['addProduct'].sortnumberNew = e.target.value
|
|
|
|
|
this.$refs['addProduct'].updateSortNumber()
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
e.target.value = row.sortnumber
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
searchProducts() {
|
|
|
|
|
|
|
|
|
|
this.select.pageIndex = 1
|
|
|
|
|
@ -241,12 +277,16 @@ this.searchProducts();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
stateChange(row) {
|
|
|
|
|
toggleActive({id:row.id}).then(res => {
|
|
|
|
|
toggleActive({
|
|
|
|
|
id: row.id
|
|
|
|
|
}).then(res => {
|
|
|
|
|
row.state_name = row.state_name == '已上架' ? '已下架' : '已上架'
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
deleteProduct(row) {
|
|
|
|
|
destroy({id:row.id}).then(res => {
|
|
|
|
|
destroy({
|
|
|
|
|
id: row.id
|
|
|
|
|
}).then(res => {
|
|
|
|
|
Message({
|
|
|
|
|
type: 'success',
|
|
|
|
|
message: '删除成功'
|
|
|
|
|
@ -320,17 +360,20 @@ this.searchProducts();
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
|
|
|
|
&-label {
|
|
|
|
|
width: 110px;
|
|
|
|
|
|
|
|
|
|
padding: 0 20px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.selector {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
align-items: center;
|
|
|
|
|
align-content: center;
|
|
|
|
|
|
|
|
|
|
&-item {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
@ -344,10 +387,11 @@ this.searchProducts();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::v-deep .ivu-select-dropdown{
|
|
|
|
|
}
|
|
|
|
|
::v-deep .ivu-select-dropdown {}
|
|
|
|
|
|
|
|
|
|
::v-deep .ivu-scroll-container {
|
|
|
|
|
height: 180px !important;
|
|
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
|
content: '加载更多..';
|
|
|
|
|
text-align: center;
|
|
|
|
|
|