商品分类
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
<el-input-number v-model="editPram.sort" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-switch v-model="editPram.showFlag" active-text="显示" inactive-text="隐藏" :active-value="1"
|
||||
:inactive-value="2" />
|
||||
<el-switch v-model="editPram.showFlag" active-text="显示" inactive-text="隐藏" active-value="1"
|
||||
inactive-value="2" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="loadingBtn" @click="handlerSubmit">确定</el-button>
|
||||
@@ -43,7 +43,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
model:"add",
|
||||
model:"classifySave",
|
||||
loadingBtn: false,
|
||||
constants: [],
|
||||
editPram: {
|
||||
@@ -66,10 +66,13 @@ export default {
|
||||
// this.initEditData()
|
||||
},
|
||||
methods: {
|
||||
updateModel(e){
|
||||
this.model = e
|
||||
},
|
||||
uploadSuccess(e, res) {
|
||||
if (res.code == 20000) {
|
||||
({ publicUrl: this.editPram.icon } = res.data);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 点击图标
|
||||
addIcon() { },
|
||||
@@ -84,6 +87,7 @@ export default {
|
||||
addTreeListLabelForCasCard(arr, child) {
|
||||
},
|
||||
handlerSubmit() {
|
||||
console.log(this.model,'454545')
|
||||
productApi[this.model](this.editPram).then((result) => {
|
||||
if(result.code==20000){
|
||||
this.$parent.$parent.editDialogConfig.visible=false;
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
<template>
|
||||
<div class="photo-container">
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
:action="uploadUrl"
|
||||
:limit="1"
|
||||
:show-file-list="false"
|
||||
:on-success="uploadSuccess"
|
||||
:on-remove="removeUrl"
|
||||
:data="{'code':code,'ossKey':'xingyou2','pathKey':'banner-group','encrypt':'PUBLIC'}"
|
||||
>
|
||||
<div>
|
||||
<el-upload class="avatar-uploader" :action="uploadUrl" :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">
|
||||
<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">
|
||||
<slot name="bottom">{{ tip }}</slot>
|
||||
</span>
|
||||
@@ -21,7 +19,7 @@
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
tip:{
|
||||
tip: {
|
||||
type: String,
|
||||
default: "请上传图片"
|
||||
},
|
||||
@@ -46,10 +44,10 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
photo: function(newVal, oldVal) {
|
||||
photo: function (newVal, oldVal) {
|
||||
this.photoUrl = newVal
|
||||
},
|
||||
isPrivate: function(newVal, oldVal) {
|
||||
isPrivate: function (newVal, oldVal) {
|
||||
this.changeUploadUrl
|
||||
}
|
||||
},
|
||||
@@ -64,16 +62,17 @@ export default {
|
||||
this.uploadUrl = process.env.VUE_APP_UPLOAD_URL
|
||||
}
|
||||
},
|
||||
removeUrl(file, fileList) {
|
||||
removeUrl(file, fileList) {
|
||||
this.$emit('success', "", {data:{publicUrl:""},code:20000});
|
||||
},
|
||||
uploadSuccess(res, file) {
|
||||
if (res.code === 20000) {
|
||||
this.$message.success(res.msg)
|
||||
this.photoUrl = res.data.url
|
||||
if (this.isPrivate) {
|
||||
this.$emit('success', this.res.path,res)
|
||||
this.$emit('success', this.res.path, res)
|
||||
} else {
|
||||
this.$emit('success', this.photoUrl,res)
|
||||
this.$emit('success', this.photoUrl, res)
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
@@ -82,8 +81,9 @@ export default {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
<style >
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
@@ -91,9 +91,11 @@ export default {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
@@ -102,6 +104,7 @@ export default {
|
||||
line-height: 178px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="showFlag" label="是否显示">
|
||||
<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">
|
||||
</el-switch>
|
||||
</template>
|
||||
@@ -52,7 +52,7 @@
|
||||
<el-dropdown>
|
||||
<el-button type=text>设置<i class="el-icon-arrow-down el-icon--right"></i></el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item >
|
||||
<el-dropdown-item>
|
||||
<span @click="edit(scope.row)">编辑</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-if="scope.row.level == 1">
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
<!-- 添加 编辑表单-->
|
||||
<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" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
@@ -148,31 +148,36 @@ export default {
|
||||
},
|
||||
// 添加
|
||||
addClass(parent = null) {
|
||||
this.editDialogConfig.visible = true;
|
||||
this.$refs.edit.model = "classifySave";
|
||||
// this.$nextTick(()=>{
|
||||
// this.$refs.edit.parent = parent;
|
||||
// });
|
||||
this.editDialogConfig.visible = true;
|
||||
if (parent) {
|
||||
let { categoryName, id } = parent;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.edit.updateModel("classifySave");
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { parentCategoryName: categoryName, parentId: id, level: 2 });
|
||||
})
|
||||
}
|
||||
},
|
||||
// 编辑
|
||||
edit(row) {
|
||||
this.editDialogConfig.visible = true;
|
||||
this.$nextTick(()=>{
|
||||
let { level, icon, showFlag, categoryName, sort, parentId,id } = row;
|
||||
console.log(this.tableData.find(item=>item==parentId),"categoryName")
|
||||
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 })
|
||||
} 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 })
|
||||
}
|
||||
})
|
||||
edit(row) {
|
||||
this.editDialogConfig.visible = true;
|
||||
this.$nextTick(() => {
|
||||
let { level, icon, showFlag, categoryName, sort, parentId, id } = row;
|
||||
this.$refs.edit.updateModel("classifyUpdate");
|
||||
if (row.level == 1) {
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId, id })
|
||||
} else {
|
||||
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
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 修改状态
|
||||
onchangeIsShow(row) {
|
||||
|
||||
Reference in New Issue
Block a user