产品更改序号

master
lion 3 years ago
parent 275d4552ec
commit 8c7a9272e3

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

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

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

Loading…
Cancel
Save