产品更改序号

master
lion 3 years ago
parent 275d4552ec
commit 8c7a9272e3

@ -1,12 +1,13 @@
<template>
<div>
<Modal :width="80" :value.sync="isShow" :fullscreen='isFullScreen' @on-visible-change="$emit('update:isShow',$event)"
>
<Modal :width="80" :value.sync="isShow" :fullscreen='isFullScreen'
@on-visible-change="$emit('update:isShow',$event)">
<div class="ivu-modal-header ivu-modal-header-wrap">
<div v-solt:header>
<template v-solt:header>
{{name+'订单列表'}}
<a class="ivu-modal-screen" @click="isFullScreen=!isFullScreen"><i :class="isFullScreen?'el-icon-aim':'el-icon-full-screen'"></i></a>
</div>
<a class="ivu-modal-screen" @click="isFullScreen=!isFullScreen"><i
:class="isFullScreen?'el-icon-aim':'el-icon-full-screen'"></i></a>
</template>
</div>
<Button class="select" type="primary" style="margin-bottom: 10px;" @click="downloadExel"></Button>
@ -20,7 +21,9 @@
</template>
<script>
import {show} from "@/api/activity"
import {
show
} from "@/api/activity"
import {
download
} from '@/utils/downloadRequest'
@ -37,8 +40,7 @@ export default {
return {
isFullScreen: false,
list: [],
table:[
{
table: [{
prop: "name",
label: "姓名",
width: 120
@ -156,10 +158,12 @@ export default {
.ivu-modal-header-wrap {
margin-bottom: 10px;
padding-top: 0;
.ivu-modal-screen {
top: 16px;
}
}
.ivu-modal-close {
top: 7px
}

@ -236,6 +236,7 @@
id: '',
isShow: false,
type: 'add',
sortnumberNew:'',
action: `${process.env.VUE_APP_BASE_API}api/admin/upload-file`,
pickerOptions: {
shortcuts: [{
@ -377,6 +378,7 @@
sortnumber: res?.sortnumber,
content: res?.content
}
console.log("form",this.form)
// this.$refs['tinymce'].setContent(this.form.content || ' ')
},
@ -441,6 +443,12 @@
// return str
// }
// },
async updateSortNumber(){
await this.getDetail()
this.form.sortnumber = this.sortnumberNew
await this.submit()
},
submit() {
if (this.type === 'add'||this.type === 'copy') {
store({
@ -472,6 +480,7 @@
return
}
if (this.type === 'editor') {
// return
save({
id: this.id,
name: this.form.name,
@ -496,6 +505,7 @@
type: 'success',
message: '编辑商品成功'
})
this.sortnumberNew = ""
this.isShow = false
this.$emit('refresh')
})

@ -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;

Loading…
Cancel
Save