商品分类
This commit is contained in:
@@ -16,8 +16,8 @@
|
|||||||
<el-input-number v-model="editPram.sort" :min="0" />
|
<el-input-number v-model="editPram.sort" :min="0" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-switch v-model="editPram.showFlag" active-text="显示" inactive-text="隐藏" :active-value="1"
|
<el-switch v-model="editPram.showFlag" active-text="显示" inactive-text="隐藏" active-value="1"
|
||||||
:inactive-value="2" />
|
inactive-value="2" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" :loading="loadingBtn" @click="handlerSubmit">确定</el-button>
|
<el-button type="primary" :loading="loadingBtn" @click="handlerSubmit">确定</el-button>
|
||||||
@@ -43,7 +43,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
model:"add",
|
model:"classifySave",
|
||||||
loadingBtn: false,
|
loadingBtn: false,
|
||||||
constants: [],
|
constants: [],
|
||||||
editPram: {
|
editPram: {
|
||||||
@@ -66,6 +66,9 @@ export default {
|
|||||||
// this.initEditData()
|
// this.initEditData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
updateModel(e){
|
||||||
|
this.model = e
|
||||||
|
},
|
||||||
uploadSuccess(e, res) {
|
uploadSuccess(e, res) {
|
||||||
if (res.code == 20000) {
|
if (res.code == 20000) {
|
||||||
({ publicUrl: this.editPram.icon } = res.data);
|
({ publicUrl: this.editPram.icon } = res.data);
|
||||||
@@ -84,6 +87,7 @@ export default {
|
|||||||
addTreeListLabelForCasCard(arr, child) {
|
addTreeListLabelForCasCard(arr, child) {
|
||||||
},
|
},
|
||||||
handlerSubmit() {
|
handlerSubmit() {
|
||||||
|
console.log(this.model,'454545')
|
||||||
productApi[this.model](this.editPram).then((result) => {
|
productApi[this.model](this.editPram).then((result) => {
|
||||||
if(result.code==20000){
|
if(result.code==20000){
|
||||||
this.$parent.$parent.editDialogConfig.visible=false;
|
this.$parent.$parent.editDialogConfig.visible=false;
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="photo-container">
|
<div class="photo-container">
|
||||||
<el-upload
|
<div>
|
||||||
class="avatar-uploader"
|
<el-upload class="avatar-uploader" :action="uploadUrl" :limit="1" :show-file-list="false" :on-success="uploadSuccess"
|
||||||
:action="uploadUrl"
|
:on-remove="removeUrl" :data="{ 'code': code, 'ossKey': 'xingyou2', 'pathKey': 'banner-group', 'encrypt': 'PUBLIC' }">
|
||||||
:limit="1"
|
|
||||||
:show-file-list="false"
|
|
||||||
:on-success="uploadSuccess"
|
|
||||||
:on-remove="removeUrl"
|
|
||||||
:data="{'code':code,'ossKey':'xingyou2','pathKey':'banner-group','encrypt':'PUBLIC'}"
|
|
||||||
>
|
|
||||||
<img v-if="photoUrl" :src="photoUrl" class="avatar">
|
<img v-if="photoUrl" :src="photoUrl" class="avatar">
|
||||||
<i v-else class="el-icon-plus avatar-uploader-icon" />
|
<i v-else class="el-icon-plus avatar-uploader-icon" />
|
||||||
</el-upload>
|
</el-upload>
|
||||||
|
<div @click="removeUrl" style="width: 100%;text-align: center;" v-if="photoUrl" >
|
||||||
|
<i style="font-size: 20px;" class="el-icon-delete" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<span class="upload-span">
|
<span class="upload-span">
|
||||||
<slot name="bottom">{{ tip }}</slot>
|
<slot name="bottom">{{ tip }}</slot>
|
||||||
</span>
|
</span>
|
||||||
@@ -65,6 +63,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
removeUrl(file, fileList) {
|
removeUrl(file, fileList) {
|
||||||
|
this.$emit('success', "", {data:{publicUrl:""},code:20000});
|
||||||
},
|
},
|
||||||
uploadSuccess(res, file) {
|
uploadSuccess(res, file) {
|
||||||
if (res.code === 20000) {
|
if (res.code === 20000) {
|
||||||
@@ -82,7 +81,8 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
</style>
|
||||||
<style >
|
<style >
|
||||||
.avatar-uploader .el-upload {
|
.avatar-uploader .el-upload {
|
||||||
border: 1px dashed #d9d9d9;
|
border: 1px dashed #d9d9d9;
|
||||||
@@ -91,9 +91,11 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-uploader .el-upload:hover {
|
.avatar-uploader .el-upload:hover {
|
||||||
border-color: #409eff;
|
border-color: #409eff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-uploader-icon {
|
.avatar-uploader-icon {
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
color: #8c939d;
|
color: #8c939d;
|
||||||
@@ -102,6 +104,7 @@ export default {
|
|||||||
line-height: 178px;
|
line-height: 178px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
width: 178px;
|
width: 178px;
|
||||||
height: 178px;
|
height: 178px;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="showFlag" label="是否显示">
|
<el-table-column prop="showFlag" label="是否显示">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-switch active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66"
|
<el-switch disabled active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66"
|
||||||
inactive-color="#ff4949">
|
inactive-color="#ff4949">
|
||||||
</el-switch>
|
</el-switch>
|
||||||
</template>
|
</template>
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
|
|
||||||
<!-- 添加 编辑表单-->
|
<!-- 添加 编辑表单-->
|
||||||
<edit-from ref="edits" :FromData="FromData" @submitFail="userSearchs"></edit-from>
|
<edit-from ref="edits" :FromData="FromData" @submitFail="userSearchs"></edit-from>
|
||||||
<el-dialog title="添加分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false">
|
<el-dialog title="分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false">
|
||||||
<edit ref="edit" :parentOptions="tableData" />
|
<edit ref="edit" :parentOptions="tableData" />
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
@@ -149,13 +149,10 @@ export default {
|
|||||||
// 添加
|
// 添加
|
||||||
addClass(parent = null) {
|
addClass(parent = null) {
|
||||||
this.editDialogConfig.visible = true;
|
this.editDialogConfig.visible = true;
|
||||||
this.$refs.edit.model = "classifySave";
|
|
||||||
// this.$nextTick(()=>{
|
|
||||||
// this.$refs.edit.parent = parent;
|
|
||||||
// });
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
let { categoryName, id } = parent;
|
let { categoryName, id } = parent;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
this.$refs.edit.updateModel("classifySave");
|
||||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { parentCategoryName: categoryName, parentId: id, level: 2 });
|
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { parentCategoryName: categoryName, parentId: id, level: 2 });
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -165,12 +162,20 @@ export default {
|
|||||||
this.editDialogConfig.visible = true;
|
this.editDialogConfig.visible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
let { level, icon, showFlag, categoryName, sort, parentId, id } = row;
|
let { level, icon, showFlag, categoryName, sort, parentId, id } = row;
|
||||||
console.log(this.tableData.find(item=>item==parentId),"categoryName")
|
this.$refs.edit.updateModel("classifyUpdate");
|
||||||
if (row.level == 1) {
|
if (row.level == 1) {
|
||||||
this.$refs.edit.model = "classifyUpdate";
|
|
||||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId, id })
|
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId, id })
|
||||||
} else {
|
} else {
|
||||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag,parentCategoryName:this.tableData.find(item=>item==parentId).categoryName, categoryName, sort, parentId,id })
|
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram,
|
||||||
|
{
|
||||||
|
level,
|
||||||
|
icon,
|
||||||
|
showFlag,
|
||||||
|
parentCategoryName: this.tableData.find(item => item.id == parentId).categoryName,
|
||||||
|
categoryName,
|
||||||
|
sort,
|
||||||
|
parentId, id
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user