parent
2891c177f4
commit
ab0b305464
7 changed files with 3084 additions and 2904 deletions
@ -1,111 +1,109 @@ |
|||||||
<template> |
<template> |
||||||
<div> |
<div> |
||||||
<el-form ref="editPram" :model="editPram" label-width="130px"> |
<el-form ref="editPram" :model="editPram" label-width="130px"> |
||||||
<el-form-item label="分类名称" prop="categoryName" :rules="[{ required: true, message: '请输入分类名称', trigger: ['blur', 'change'] }]"> |
<el-form-item label="分类名称" prop="categoryName" :rules="[{ required: true, message: '请输入分类名称', trigger: ['blur', 'change'] }]"> |
||||||
<el-input v-model="editPram.categoryName" placeholder="分类名称" /> |
<el-input v-model="editPram.categoryName" placeholder="分类名称" /> |
||||||
</el-form-item> |
</el-form-item> |
||||||
<el-form-item v-if="editPram.parentCategoryName" label="父级" > |
<el-form-item v-if="editPram.parentCategoryName" label="父级"> |
||||||
{{ editPram.parentCategoryName }} |
{{ editPram.parentCategoryName }} |
||||||
</el-form-item> |
</el-form-item> |
||||||
<el-form-item label="分类图标(180*180)"> |
<el-form-item label="分类图标(180*180)" prop="icon" :rules="[{ required: true, message: '请上传分类图标!', trigger: ['blur', 'change'] }]"> |
||||||
<div class="upLoadPicBox" @click="modalPicTap('1')"> |
<div class="upLoadPicBox" @click="modalPicTap('1')"> |
||||||
<upload :photo="editPram.icon" @success="uploadSuccess" tip="图标尺寸为18*18比例,大小不能超过200KB,图片只能为jpg、png、gif格式"></upload> |
<upload :photo="editPram.icon" @success="uploadSuccess" tip="图标尺寸为18*18比例,大小不能超过50KB,图片只能为jpg、png格式"></upload> |
||||||
</div> |
</div> |
||||||
</el-form-item> |
</el-form-item> |
||||||
<el-form-item label="排序"> |
<el-form-item label="排序"> |
||||||
<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> |
<el-button @click="close">取消</el-button> |
||||||
<el-button @click="close">取消</el-button> |
</el-form-item> |
||||||
</el-form-item> |
</el-form> |
||||||
</el-form> |
</div> |
||||||
</div> |
</template> |
||||||
</template> |
<!--创建和编辑公用一个组件--> |
||||||
<!--创建和编辑公用一个组件--> |
<script> |
||||||
<script> |
import upload from '@/components/Upload/index' |
||||||
import upload from '@/components/Upload/index' |
import productApi from '@/api/product/productAttr.js' |
||||||
import productApi from '@/api/product/productAttr.js'; |
import { loadingFn } from '@/utils/validate' |
||||||
import { loadingFn } from "@/utils/validate" |
|
||||||
|
export default { |
||||||
export default { |
// name: "edit", |
||||||
// name: "edit", |
components: { upload }, |
||||||
components: { upload }, |
props: { |
||||||
props: { |
parentOptions: { |
||||||
parentOptions: { |
type: Array, |
||||||
type: Array, |
default: () => [] |
||||||
default: () => [] |
} |
||||||
} |
}, |
||||||
}, |
data() { |
||||||
data() { |
return { |
||||||
return { |
model: 'classifySave', |
||||||
model:"classifySave", |
loadingBtn: false, |
||||||
loadingBtn: false, |
constants: [], |
||||||
constants: [], |
editPram: { |
||||||
editPram: { |
level: 1, |
||||||
level: 1, |
icon: '', |
||||||
icon:"", |
showFlag: 1, |
||||||
showFlag: 1, |
categoryName: '', |
||||||
categoryName: "", |
sort: 1, |
||||||
sort:1, |
parentId: '', |
||||||
parentId:"", |
parentCategoryName: '' |
||||||
parentCategoryName:"" |
}, |
||||||
}, |
categoryProps: { |
||||||
categoryProps: { |
value: 'id', |
||||||
value: 'id', |
label: 'categoryName', |
||||||
label: 'categoryName', |
children: 'children' |
||||||
children: 'children' |
} |
||||||
} |
} |
||||||
} |
}, |
||||||
}, |
mounted() { |
||||||
mounted() { |
// this.initEditData() |
||||||
// this.initEditData() |
}, |
||||||
}, |
methods: { |
||||||
methods: { |
updateModel(e) { |
||||||
updateModel(e){ |
this.model = 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); |
} |
||||||
} |
}, |
||||||
}, |
// 点击图标 |
||||||
// 点击图标 |
addIcon() {}, |
||||||
addIcon() { }, |
// 点击商品图 |
||||||
// 点击商品图 |
modalPicTap(tit, num, i) {}, |
||||||
modalPicTap(tit, num, i) { |
close() { |
||||||
}, |
this.$parent.$parent.editDialogConfig.visible = false |
||||||
close() { |
}, |
||||||
this.$parent.$parent.editDialogConfig.visible=false; |
initEditData() {}, |
||||||
}, |
addTreeListLabelForCasCard(arr, child) {}, |
||||||
initEditData() { |
handlerSubmit() { |
||||||
}, |
this.$refs.editPram.validate(valid => { |
||||||
addTreeListLabelForCasCard(arr, child) { |
if (valid) { |
||||||
}, |
productApi[this.model](this.editPram) |
||||||
handlerSubmit() { |
.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; |
this.$message.success('添加成功!') |
||||||
this.$message.success("添加成功!"); |
this.$parent.$parent.handleCurrentChange() |
||||||
this.$parent.$parent.handleCurrentChange(); |
} |
||||||
|
}) |
||||||
} |
.catch(err => {}) |
||||||
}).catch((err) => { |
} |
||||||
|
}) |
||||||
}); |
}, |
||||||
}, |
handlerSaveOrUpdate(isSave) {} |
||||||
handlerSaveOrUpdate(isSave) { |
} |
||||||
} |
} |
||||||
} |
</script> |
||||||
} |
|
||||||
</script> |
<style scoped> |
||||||
|
::v-deep .photo-container { |
||||||
<style scoped> |
align-items: flex-start !important; |
||||||
::v-deep .photo-container { |
} |
||||||
align-items: flex-start !important; |
</style> |
||||||
} |
|
||||||
</style> |
|
||||||
|
@ -1,72 +1,83 @@ |
|||||||
<template> |
<template> |
||||||
<div> |
<div> |
||||||
<el-form ref="form" :model="form"> |
<el-form ref="form" :model="form"> |
||||||
<el-form-item prop="brandName" label="品牌名称" label-width="100px" |
<el-form-item |
||||||
:rules="[{ required: true, message: '请输入品牌名称', trigger: ['blur', 'change'] }]"> |
prop="brandName" |
||||||
<el-input v-model="form.brandName"></el-input> |
label="品牌名称" |
||||||
</el-form-item> |
label-width="100px" |
||||||
<el-form-item label="品牌首字母" prop="firstLetter" label-width="100px" |
:rules="[{ required: true, message: '请输入品牌名称', trigger: ['blur', 'change'] }]" |
||||||
:rules="[{ required: true, message: '请输入品牌首字母', trigger: ['blur', 'change'] }]"> |
> |
||||||
<el-input v-model="form.firstLetter"></el-input> |
<el-input v-model="form.brandName"></el-input> |
||||||
</el-form-item> |
</el-form-item> |
||||||
<el-form-item label=" 品牌LOGO" label-width="100px"> |
<el-form-item |
||||||
<upload :photo="form.logoUrl" @success="uploadSuccess" tip="只能上传jpg/png格式文件,文件不能超过50kb"> |
label="品牌首字母" |
||||||
</upload> |
prop="firstLetter" |
||||||
</el-form-item> |
label-width="100px" |
||||||
<el-form-item label="排序" label-width="100px"> |
:rules="[{ required: true, message: '请输入品牌首字母', trigger: ['blur', 'change'] }]" |
||||||
<el-input-number v-model="form.sort" :min="0" /> |
> |
||||||
</el-form-item> |
<el-input v-model="form.firstLetter"></el-input> |
||||||
<el-form-item label="是否显示" label-width="100px"> |
</el-form-item> |
||||||
<el-switch v-model="form.showFlag" active-text="显示" inactive-text="隐藏" active-value="1" |
<el-form-item |
||||||
inactive-value="2" /> |
label=" 品牌LOGO" |
||||||
</el-form-item> |
label-width="100px" |
||||||
</el-form> |
prop="logoUrl" |
||||||
<div slot="footer" class="footer"> |
:rules="[{ required: true, message: '请上传品牌LOGO', trigger: ['blur', 'change'] }]" |
||||||
<el-button @click="$emit('close')" >取 消</el-button> |
> |
||||||
<el-button @click="save" type="primary">确 定</el-button> |
<upload :photo="form.logoUrl" @success="uploadSuccess" tip="只能上传jpg/png格式文件,文件不能超过50kb"> </upload> |
||||||
</div> |
</el-form-item> |
||||||
</div> |
<el-form-item label="排序" label-width="100px"> |
||||||
</template> |
<el-input-number v-model="form.sort" :min="0" /> |
||||||
|
</el-form-item> |
||||||
<script> |
<el-form-item label="是否显示" label-width="100px"> |
||||||
import upload from '@/components/Upload/index' |
<el-switch v-model="form.showFlag" active-text="显示" inactive-text="隐藏" active-value="1" inactive-value="2" /> |
||||||
export default { |
</el-form-item> |
||||||
components: { upload }, |
</el-form> |
||||||
|
<div slot="footer" class="footer"> |
||||||
data() { |
<el-button @click="$emit('close')">取 消</el-button> |
||||||
return { |
<el-button @click="save" type="primary">确 定</el-button> |
||||||
apiMode:"brandSave", |
</div> |
||||||
form: { |
</div> |
||||||
"brandName": "", |
</template> |
||||||
"firstLetter": "", |
|
||||||
"logoUrl": "", |
<script> |
||||||
"showFlag": "1", |
import upload from '@/components/Upload/index' |
||||||
"sort": "1" |
export default { |
||||||
} |
components: { upload }, |
||||||
} |
|
||||||
}, |
data() { |
||||||
methods: { |
return { |
||||||
save() { |
apiMode: 'brandSave', |
||||||
this.$refs.form.validate((valid) => { |
form: { |
||||||
if (valid) { |
brandName: '', |
||||||
this.$emit("brandSave",this.form,this.apiMode) |
firstLetter: '', |
||||||
} |
logoUrl: '', |
||||||
}); |
showFlag: '1', |
||||||
}, |
sort: '1' |
||||||
uploadSuccess(e, res) { |
} |
||||||
console.log(...arguments,"uploadSuccess") |
} |
||||||
if (res.code == 20000) { |
}, |
||||||
({ publicUrl: this.form.logoUrl } = res.data); |
methods: { |
||||||
} |
save() { |
||||||
}, |
this.$refs.form.validate(valid => { |
||||||
} |
if (valid) { |
||||||
} |
this.$emit('brandSave', this.form, this.apiMode) |
||||||
</script> |
} |
||||||
|
}) |
||||||
<style scoped> |
}, |
||||||
.footer { |
uploadSuccess(e, res) { |
||||||
width: 100%; |
console.log(...arguments, 'uploadSuccess') |
||||||
display: flex; |
if (res.code == 20000) { |
||||||
justify-content: center; |
;({ publicUrl: this.form.logoUrl } = res.data) |
||||||
} |
} |
||||||
</style> |
} |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped> |
||||||
|
.footer { |
||||||
|
width: 100%; |
||||||
|
display: flex; |
||||||
|
justify-content: center; |
||||||
|
} |
||||||
|
</style> |
||||||
|
@ -1,175 +1,195 @@ |
|||||||
<template> |
<template> |
||||||
<div> |
<div> |
||||||
<el-card :bordered="false" shadow="never" class="ivu-mt" :body-style="{ padding: 0 }"> |
<el-card :bordered="false" shadow="never" class="ivu-mt" :body-style="{ padding: 0 }"> |
||||||
<div class="padding-add"> |
<div class="padding-add"> |
||||||
<el-form ref="artFrom" :model="page" label-width="80px" label-position="right" class="tabform" |
<el-form ref="artFrom" :model="page" label-width="80px" label-position="right" class="tabform" @submit.native.prevent inline> |
||||||
@submit.native.prevent inline> |
<el-form-item label="输入搜索"> |
||||||
<el-form-item label="输入搜索"> |
<el-input clearable v-model="page.params.brandName" placeholder="品牌名称/关键词" class="form_content_width"></el-input> |
||||||
<el-input clearable v-model="page.brandName" placeholder="品牌名称/关键词" |
</el-form-item> |
||||||
class="form_content_width"></el-input> |
<el-form-item> |
||||||
</el-form-item> |
<el-button type="primary" @click="userSearchs">查询</el-button> |
||||||
<el-form-item> |
</el-form-item> |
||||||
<el-button type="primary" @click="userSearchs">查询</el-button> |
</el-form> |
||||||
</el-form-item> |
</div> |
||||||
</el-form> |
</el-card> |
||||||
</div> |
<el-card :bordered="false" shadow="never" class="ivu-mt-16"> |
||||||
</el-card> |
<el-button type="primary" @click="addBrand">添加品牌</el-button> |
||||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16"> |
<el-table |
||||||
<el-button type="primary" @click="addBrand">添加品牌</el-button> |
@current-change="tableCurrentChange" |
||||||
<el-table @current-change="tableCurrentChange" ref="table" :data="tableData" v-loading="loading" |
ref="table" |
||||||
highlight-current-row :row-key="getRowKey" @selection-change="handleSelectRow" empty-text="暂无数据" |
:data="tableData" |
||||||
class="mt14"> |
v-loading="loading" |
||||||
<el-table-column type="selection" width="60" :reserve-selection="true"> </el-table-column> |
highlight-current-row |
||||||
<el-table-column label="编号"> |
:row-key="getRowKey" |
||||||
<template slot-scope="scope"> |
@selection-change="handleSelectRow" |
||||||
<span>{{ scope.row.brandNum }}</span> |
empty-text="暂无数据" |
||||||
</template> |
class="mt14" |
||||||
</el-table-column> |
> |
||||||
<el-table-column label="品牌名称"> |
<el-table-column type="selection" width="60" :reserve-selection="true"> </el-table-column> |
||||||
<template slot-scope="scope"> |
<el-table-column label="编号"> |
||||||
<span>{{ scope.row.brandName }}</span> |
<template slot-scope="scope"> |
||||||
</template> |
<span>{{ scope.row.brandNum }}</span> |
||||||
</el-table-column> |
</template> |
||||||
<el-table-column label="品牌首字母" prop="firstLetter"> </el-table-column> |
</el-table-column> |
||||||
<el-table-column label="排序" prop="sort"> </el-table-column> |
<el-table-column label="品牌名称"> |
||||||
<el-table-column label="是否显示"> |
<template slot-scope="scope"> |
||||||
<template slot-scope="scope"> |
<span>{{ scope.row.brandName }}</span> |
||||||
<el-switch disabled active-value="1" inactive-value="0" v-model="scope.row.showFlag" |
</template> |
||||||
active-color="#13ce66" inactive-color="#ff4949"> |
</el-table-column> |
||||||
</el-switch> |
<el-table-column label="品牌首字母" prop="firstLetter"> </el-table-column> |
||||||
</template> |
<el-table-column label="排序" prop="sort"> </el-table-column> |
||||||
</el-table-column> |
<el-table-column label="是否显示"> |
||||||
<el-table-column label="操作" fixed="right"> |
<template slot-scope="scope"> |
||||||
<template slot-scope="scope"> |
<el-switch disabled active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66" inactive-color="#ff4949"> |
||||||
<el-button type="text" @click="edit(scope.row)">编辑</el-button> |
</el-switch> |
||||||
<el-divider direction="vertical"></el-divider> |
</template> |
||||||
<el-button type="text" @click="del(scope.row)">删除</el-button> |
</el-table-column> |
||||||
</template> |
<el-table-column label="操作" fixed="right"> |
||||||
</el-table-column> |
<template slot-scope="scope"> |
||||||
</el-table> |
<el-button type="text" @click="edit(scope.row)">编辑</el-button> |
||||||
<div class="acea-row row-right page"> |
<el-divider direction="vertical"></el-divider> |
||||||
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
<el-button type="text" @click="del(scope.row)">删除</el-button> |
||||||
:current-page="page.currentPage" :page-sizes="[10, 15, 20, 30]" :page-size="page.pageSize" |
</template> |
||||||
layout="total, sizes, prev, pager, next, jumper" :total="page.totalCount" /> |
</el-table-column> |
||||||
</div> |
</el-table> |
||||||
</el-card> |
<div class="acea-row row-right page"> |
||||||
<el-dialog title="品牌设置" :visible.sync="isAddOrEdit" v-loading="addLoading"> |
<el-pagination |
||||||
<addOrEdit v-if="isAddOrEdit" @close="isAddOrEdit = false" @brandSave="brandSave" ref="addOrEdit"></addOrEdit> |
@size-change="handleSizeChange" |
||||||
</el-dialog> |
@current-change="handleCurrentChange" |
||||||
</div> |
:current-page="page.currentPage" |
||||||
</template> |
:page-sizes="[10, 15, 20, 30]" |
||||||
<script> |
:page-size="page.pageSize" |
||||||
import productApi from '@/api/product/productAttr.js'; |
layout="total, sizes, prev, pager, next, jumper" |
||||||
import { loadingFn } from "@/utils/validate" |
:total="page.totalCount" |
||||||
import addOrEdit from "./components/AddOrEdit.vue" |
/> |
||||||
export default { |
</div> |
||||||
components: { addOrEdit }, |
</el-card> |
||||||
data() { |
<el-dialog title="品牌设置" :visible.sync="isAddOrEdit" v-loading="addLoading"> |
||||||
return { |
<addOrEdit v-if="isAddOrEdit" @close="isAddOrEdit = false" @brandSave="brandSave" ref="addOrEdit"></addOrEdit> |
||||||
addLoading: false, |
</el-dialog> |
||||||
isAddOrEdit: false, |
</div> |
||||||
selection: [], |
</template> |
||||||
selectAttrList: null, |
<script> |
||||||
isShowAttrList: false, |
import productApi from '@/api/product/productAttr.js' |
||||||
loading: false, |
import { loadingFn } from '@/utils/validate' |
||||||
page: { |
import addOrEdit from './components/AddOrEdit.vue' |
||||||
"currentPage": 1, |
export default { |
||||||
"pageSize": 10, |
components: { addOrEdit }, |
||||||
"params": { |
data() { |
||||||
brandName:"" |
return { |
||||||
}, |
addLoading: false, |
||||||
totalCount: 0 |
isAddOrEdit: false, |
||||||
}, |
selection: [], |
||||||
tableData: [], |
selectAttrList: null, |
||||||
total: 0, |
isShowAttrList: false, |
||||||
selectedIds: new Set(), //选中合并项的id |
loading: false, |
||||||
ids: [], |
page: { |
||||||
multipleSelection: [], |
currentPage: 1, |
||||||
}; |
pageSize: 10, |
||||||
}, |
params: { |
||||||
computed: {}, |
brandName: '' |
||||||
created() { |
}, |
||||||
this.init() |
totalCount: 0 |
||||||
}, |
}, |
||||||
methods: { |
tableData: [], |
||||||
addBrand() { |
total: 0, |
||||||
this.isAddOrEdit = true; |
selectedIds: new Set(), //选中合并项的id |
||||||
}, |
ids: [], |
||||||
brandSave(e,model="brandSave") { |
multipleSelection: [] |
||||||
loadingFn.call(this, "addLoading", productApi[model](e).then(res => { |
} |
||||||
if (res.code == 20000) { |
}, |
||||||
this.$message.success("操作成功") |
computed: {}, |
||||||
setTimeout(() => { |
created() { |
||||||
this.isAddOrEdit = false; |
this.init() |
||||||
this.getList(); |
}, |
||||||
|
methods: { |
||||||
}, 1000); |
addBrand() { |
||||||
} |
this.isAddOrEdit = true |
||||||
}), 1000); |
}, |
||||||
|
brandSave(e, model = 'brandSave') { |
||||||
}, |
loadingFn.call( |
||||||
tableCurrentChange(e) { }, |
this, |
||||||
handleCurrentChange(val) { |
'addLoading', |
||||||
this.page.currentPage = val; |
productApi[model](e).then(res => { |
||||||
this.getList() |
if (res.code == 20000) { |
||||||
}, |
this.$message.success('操作成功') |
||||||
handleSizeChange(val) { |
setTimeout(() => { |
||||||
this.page.pageSize = val |
this.isAddOrEdit = false |
||||||
this.getList() |
this.getList() |
||||||
}, |
}, 1000) |
||||||
clearSelection() { }, |
} |
||||||
onCancel() { }, |
}), |
||||||
|
1000 |
||||||
showAttrList(e) { }, |
) |
||||||
getRowKey(row) { }, |
}, |
||||||
//全选和取消全选时触发 |
tableCurrentChange(e) {}, |
||||||
handleSelectAll(selection) { }, |
handleCurrentChange(val) { |
||||||
// 选中某一行 |
this.page.currentPage = val |
||||||
handleSelectRow(selection) { }, |
this.getList() |
||||||
setChecked() { }, |
}, |
||||||
// 删除 |
handleSizeChange(val) { |
||||||
del(row) { |
this.page.pageSize = val |
||||||
this.$alert('请确定删除该数据!', '提示', { |
this.getList() |
||||||
confirmButtonText: '确定', |
}, |
||||||
callback: action => { |
clearSelection() {}, |
||||||
if (action == "confirm") { |
onCancel() {}, |
||||||
loadingFn.call(this, "loading", productApi.brandDelete(row).then(res => { |
|
||||||
if (res.code = 20000) { |
showAttrList(e) {}, |
||||||
this.$message.success("操作成功!") |
getRowKey(row) {}, |
||||||
this.handleCurrentChange() |
//全选和取消全选时触发 |
||||||
} |
handleSelectAll(selection) {}, |
||||||
})); |
// 选中某一行 |
||||||
} |
handleSelectRow(selection) {}, |
||||||
} |
setChecked() {}, |
||||||
}); |
// 删除 |
||||||
}, |
del(row) { |
||||||
addAttr(model) { |
this.$alert('请确定删除该数据!', '提示', { |
||||||
}, |
confirmButtonText: '确定', |
||||||
// 编辑 |
callback: action => { |
||||||
edit(row) { |
if (action == 'confirm') { |
||||||
this.isAddOrEdit = true; |
loadingFn.call( |
||||||
this.$nextTick(() => { |
this, |
||||||
this.$refs.addOrEdit.apiMode = "brandUpdate" |
'loading', |
||||||
this.$refs.addOrEdit.form = Object.assign(this.$refs.addOrEdit.form, row); |
productApi.brandDelete(row).then(res => { |
||||||
}) |
if ((res.code = 20000)) { |
||||||
}, |
this.$message.success('操作成功!') |
||||||
// 列表 |
this.handleCurrentChange() |
||||||
getList() { |
} |
||||||
loadingFn.call(this, "loading", productApi.brandGetByPage(this.page).then(res => { |
}) |
||||||
if (res.code = 20000) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data); |
) |
||||||
})); |
} |
||||||
}, |
} |
||||||
// 表格搜索 |
}) |
||||||
userSearchs() { |
}, |
||||||
this.handleCurrentChange() |
addAttr(model) {}, |
||||||
}, |
// 编辑 |
||||||
// 初始化 |
edit(row) { |
||||||
init() { |
this.isAddOrEdit = true |
||||||
this.getList() |
this.$nextTick(() => { |
||||||
} |
this.$refs.addOrEdit.apiMode = 'brandUpdate' |
||||||
}, |
this.$refs.addOrEdit.form = Object.assign(this.$refs.addOrEdit.form, row) |
||||||
}; |
}) |
||||||
</script> |
}, |
||||||
|
// 列表 |
||||||
<style scoped></style> |
getList() { |
||||||
|
loadingFn.call( |
||||||
|
this, |
||||||
|
'loading', |
||||||
|
productApi.brandGetByPage(this.page).then(res => { |
||||||
|
if ((res.code = 20000)) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data) |
||||||
|
}) |
||||||
|
) |
||||||
|
}, |
||||||
|
// 表格搜索 |
||||||
|
userSearchs() { |
||||||
|
this.handleCurrentChange() |
||||||
|
}, |
||||||
|
// 初始化 |
||||||
|
init() { |
||||||
|
this.getList() |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped></style> |
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,257 +1,257 @@ |
|||||||
<template> |
<template> |
||||||
<div class="article-manager"> |
<div class="article-manager"> |
||||||
<!-- <el-card :bordered="false" shadow="never" class="ivu-mt-16" :body-style="{ padding: 0 }"> |
<!-- <el-card :bordered="false" shadow="never" class="ivu-mt-16" :body-style="{ padding: 0 }"> |
||||||
<div class="padding-add"> |
<div class="padding-add"> |
||||||
<el-form ref="artFrom" :model="artFrom" inline label-width="80px" label-position="right" @submit.native.prevent> |
<el-form ref="artFrom" :model="artFrom" inline label-width="80px" label-position="right" @submit.native.prevent> |
||||||
<el-form-item label="商品分类:" prop="pid" label-for="pid"> |
<el-form-item label="商品分类:" prop="pid" label-for="pid"> |
||||||
<el-select v-model="artFrom.pid" placeholder="请选择商品分类" @change="userSearchs" clearable |
<el-select v-model="artFrom.pid" placeholder="请选择商品分类" @change="userSearchs" clearable |
||||||
class="form_content_width"> |
class="form_content_width"> |
||||||
<el-option v-for="item in treeSelect" :value="item.id" :label="item.cate_name" :key="item.id">{{ |
<el-option v-for="item in treeSelect" :value="item.id" :label="item.cate_name" :key="item.id">{{ |
||||||
item.cate_name |
item.cate_name |
||||||
}}</el-option> |
}}</el-option> |
||||||
</el-select> |
</el-select> |
||||||
</el-form-item> |
</el-form-item> |
||||||
<el-form-item label="分类状态:" label-for="is_show"> |
<el-form-item label="分类状态:" label-for="is_show"> |
||||||
<el-select v-model="artFrom.is_show" placeholder="请选择分类状态" clearable @change="userSearchs" |
<el-select v-model="artFrom.is_show" placeholder="请选择分类状态" clearable @change="userSearchs" |
||||||
class="form_content_width"> |
class="form_content_width"> |
||||||
<el-option value="1" label="显示"></el-option> |
<el-option value="1" label="显示"></el-option> |
||||||
<el-option value="0" label="隐藏"></el-option> |
<el-option value="0" label="隐藏"></el-option> |
||||||
</el-select> |
</el-select> |
||||||
</el-form-item> |
</el-form-item> |
||||||
<el-form-item label="分类名称:" label-for="status2"> |
<el-form-item label="分类名称:" label-for="status2"> |
||||||
<el-input clearable placeholder="请输入分类名称" v-model="artFrom.cate_name" class="form_content_width" /> |
<el-input clearable placeholder="请输入分类名称" v-model="artFrom.cate_name" class="form_content_width" /> |
||||||
</el-form-item> |
</el-form-item> |
||||||
<el-form-item> |
<el-form-item> |
||||||
<el-button type="primary" @click="userSearchs">查询</el-button> |
<el-button type="primary" @click="userSearchs">查询</el-button> |
||||||
</el-form-item> |
</el-form-item> |
||||||
</el-form> |
</el-form> |
||||||
</div> |
</div> |
||||||
</el-card> --> |
</el-card> --> |
||||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16"> |
<el-card :bordered="false" shadow="never" class="ivu-mt-16"> |
||||||
<el-button type="primary" class="bnt" @click="addClass(null)">添加分类</el-button> |
<el-button type="primary" class="bnt" @click="addClass(null)">添加分类</el-button> |
||||||
<el-table row-key="id" class="mt14" v-loading="loading" :tree-props="{ children: 'children' }" :data="tableData"> |
<el-table row-key="id" class="mt14" v-loading="loading" :tree-props="{ children: 'children' }" :data="tableData"> |
||||||
<el-table-column prop="categoryNum" label="编号"></el-table-column> |
<el-table-column prop="categoryNum" label="编号"></el-table-column> |
||||||
<el-table-column prop="categoryName" label="分类名称"></el-table-column> |
<el-table-column prop="categoryName" label="分类名称"></el-table-column> |
||||||
<el-table-column prop="level" label="级别"></el-table-column> |
<el-table-column prop="level" label="级别"></el-table-column> |
||||||
<el-table-column prop="icon" label="分类图标" min-width="100"> |
<el-table-column prop="icon" label="分类图标" min-width="100"> |
||||||
<template slot-scope="scope"> |
<template slot-scope="scope"> |
||||||
<el-image style="width: 50px; height: 50px" :src="scope.row.icon" :preview-src-list="[scope.row.icon]"> |
<el-image style="width: 50px; height: 50px" :src="scope.row.icon" :preview-src-list="[scope.row.icon]"> |
||||||
</el-image> |
</el-image> |
||||||
</template> |
</template> |
||||||
</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 disabled 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> |
||||||
</el-table-column> |
</el-table-column> |
||||||
<el-table-column prop="sort" label="排序" min-width="100" tooltip="true"></el-table-column> |
<el-table-column prop="sort" label="排序" min-width="100" tooltip="true"></el-table-column> |
||||||
<el-table-column prop="date" label="操作" width="120" fixed="right"> |
<el-table-column prop="date" label="操作" width="120" fixed="right"> |
||||||
<template slot-scope="scope"> |
<template slot-scope="scope"> |
||||||
<el-dropdown> |
<el-dropdown> |
||||||
<el-button type=text>设置<i class="el-icon-arrow-down el-icon--right"></i></el-button> |
<el-button type=text>设置<i class="el-icon-arrow-down el-icon--right"></i></el-button> |
||||||
<el-dropdown-menu slot="dropdown"> |
<el-dropdown-menu slot="dropdown"> |
||||||
<el-dropdown-item> |
<el-dropdown-item> |
||||||
<span @click="edit(scope.row)">编辑</span> |
<span @click="edit(scope.row)">编辑</span> |
||||||
</el-dropdown-item> |
</el-dropdown-item> |
||||||
<el-dropdown-item v-if="scope.row.level == 1"> |
<el-dropdown-item v-if="scope.row.level == 1"> |
||||||
<span @click="addClass(scope.row)">新增下级</span> |
<span @click="addClass(scope.row)">新增下级</span> |
||||||
</el-dropdown-item> |
</el-dropdown-item> |
||||||
<el-dropdown-item v-if="scope.row.level == 1">查看下级 </el-dropdown-item> |
<!-- <el-dropdown-item v-if="scope.row.level == 1">查看下级 </el-dropdown-item> --> |
||||||
</el-dropdown-menu> |
</el-dropdown-menu> |
||||||
</el-dropdown> |
</el-dropdown> |
||||||
<el-button type=text> |
<el-button type=text> |
||||||
</el-button> |
</el-button> |
||||||
<el-button @click="del(scope.row, scope)" type=text>删除</el-button> |
<el-button @click="del(scope.row, scope)" type=text>删除</el-button> |
||||||
</template> |
</template> |
||||||
</el-table-column> |
</el-table-column> |
||||||
</el-table> |
</el-table> |
||||||
</el-card> |
</el-card> |
||||||
<div class="acea-row row-right page"> |
<div class="acea-row row-right page"> |
||||||
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
||||||
:current-page="page.currentPage" :page-sizes="[10, 15, 20, 30]" :page-size="page.pageSize" |
:current-page="page.currentPage" :page-sizes="[10, 15, 20, 30]" :page-size="page.pageSize" |
||||||
layout="total, sizes, prev, pager, next, jumper" :total="page.totalCount" /> |
layout="total, sizes, prev, pager, next, jumper" :total="page.totalCount" /> |
||||||
</div> |
</div> |
||||||
|
|
||||||
<!-- 添加 编辑表单--> |
<!-- 添加 编辑表单--> |
||||||
<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> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<script> |
<script> |
||||||
import edit from '@/components/Category/edit' |
import edit from '@/components/Category/edit' |
||||||
import editFrom from '../../../components/from/from'; |
import editFrom from '../../../components/from/from'; |
||||||
import productApi from '@/api/product/productAttr.js'; |
import productApi from '@/api/product/productAttr.js'; |
||||||
import { loadingFn } from "@/utils/validate" |
import { loadingFn } from "@/utils/validate" |
||||||
export default { |
export default { |
||||||
name: 'product_productClassify', |
name: 'product_productClassify', |
||||||
components: { |
components: { |
||||||
editFrom, |
editFrom, |
||||||
edit |
edit |
||||||
}, |
}, |
||||||
data() { |
data() { |
||||||
return { |
return { |
||||||
editDialogConfig: { |
editDialogConfig: { |
||||||
visible: false |
visible: false |
||||||
}, |
}, |
||||||
treeSelect: [], |
treeSelect: [], |
||||||
FromData: null, |
FromData: null, |
||||||
grid: { |
grid: { |
||||||
xl: 7, |
xl: 7, |
||||||
lg: 7, |
lg: 7, |
||||||
md: 12, |
md: 12, |
||||||
sm: 24, |
sm: 24, |
||||||
xs: 24, |
xs: 24, |
||||||
}, |
}, |
||||||
loading: false, |
loading: false, |
||||||
page: { |
page: { |
||||||
"currentPage": 1, |
"currentPage": 1, |
||||||
"pageSize": 10, |
"pageSize": 10, |
||||||
"params": {}, |
"params": {}, |
||||||
totalCount: 0 |
totalCount: 0 |
||||||
}, |
}, |
||||||
total: 0, |
total: 0, |
||||||
tableData: [], |
tableData: [], |
||||||
}; |
}; |
||||||
}, |
}, |
||||||
mounted() { |
mounted() { |
||||||
this.getList(); |
this.getList(); |
||||||
}, |
}, |
||||||
methods: { |
methods: { |
||||||
handleCommand(e) { |
handleCommand(e) { |
||||||
|
|
||||||
}, |
}, |
||||||
handleSizeChange(val) { |
handleSizeChange(val) { |
||||||
this.page.pageSize = val |
this.page.pageSize = val |
||||||
this.getList() |
this.getList() |
||||||
}, |
}, |
||||||
handleCurrentChange(val) { |
handleCurrentChange(val) { |
||||||
this.page.currentPage = val |
this.page.currentPage = val |
||||||
this.getList() |
this.getList() |
||||||
}, |
}, |
||||||
// 商品分类; |
// 商品分类; |
||||||
goodsCategory() { |
goodsCategory() { |
||||||
}, |
}, |
||||||
// 列表 |
// 列表 |
||||||
getList() { |
getList() { |
||||||
loadingFn.call(this, "loading", productApi.classifyGetByPage(this.page).then(res => { |
loadingFn.call(this, "loading", productApi.classifyGetByPage(this.page).then(res => { |
||||||
if (res.code = 20000) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data); |
if (res.code = 20000) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data); |
||||||
})); |
})); |
||||||
}, |
}, |
||||||
pageChange(index) { |
pageChange(index) { |
||||||
this.artFrom.page = index; |
this.artFrom.page = index; |
||||||
this.getList(); |
this.getList(); |
||||||
}, |
}, |
||||||
// 添加 |
// 添加 |
||||||
addClass(parent = null) { |
addClass(parent = null) { |
||||||
this.editDialogConfig.visible = true; |
this.editDialogConfig.visible = true; |
||||||
if (parent) { |
if (parent) { |
||||||
let { categoryName, id } = parent; |
let { categoryName, id } = parent; |
||||||
this.$nextTick(() => { |
this.$nextTick(() => { |
||||||
this.$refs.edit.updateModel("classifySave"); |
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 }); |
||||||
}) |
}) |
||||||
} |
} |
||||||
}, |
}, |
||||||
// 编辑 |
// 编辑 |
||||||
edit(row) { |
edit(row) { |
||||||
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; |
||||||
this.$refs.edit.updateModel("classifyUpdate"); |
this.$refs.edit.updateModel("classifyUpdate"); |
||||||
if (row.level == 1) { |
if (row.level == 1) { |
||||||
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, |
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, |
||||||
{ |
{ |
||||||
level, |
level, |
||||||
icon, |
icon, |
||||||
showFlag, |
showFlag, |
||||||
parentCategoryName: this.tableData.find(item => item.id == parentId).categoryName, |
parentCategoryName: this.tableData.find(item => item.id == parentId).categoryName, |
||||||
categoryName, |
categoryName, |
||||||
sort, |
sort, |
||||||
parentId, id |
parentId, id |
||||||
}) |
}) |
||||||
} |
} |
||||||
}) |
}) |
||||||
}, |
}, |
||||||
// 修改状态 |
// 修改状态 |
||||||
onchangeIsShow(row) { |
onchangeIsShow(row) { |
||||||
let data = { |
let data = { |
||||||
id: row.id, |
id: row.id, |
||||||
is_show: row.is_show, |
is_show: row.is_show, |
||||||
}; |
}; |
||||||
setShowApi(data) |
setShowApi(data) |
||||||
.then(async (res) => { |
.then(async (res) => { |
||||||
this.$message.success(res.msg); |
this.$message.success(res.msg); |
||||||
}) |
}) |
||||||
.catch((res) => { |
.catch((res) => { |
||||||
this.$message.error(res.msg); |
this.$message.error(res.msg); |
||||||
}); |
}); |
||||||
}, |
}, |
||||||
// 下拉树 |
// 下拉树 |
||||||
handleCheckChange(data) { |
handleCheckChange(data) { |
||||||
let value = ''; |
let value = ''; |
||||||
let title = ''; |
let title = ''; |
||||||
this.list = []; |
this.list = []; |
||||||
this.artFrom.pid = 0; |
this.artFrom.pid = 0; |
||||||
data.forEach((item, index) => { |
data.forEach((item, index) => { |
||||||
value += `${item.id},`; |
value += `${item.id},`; |
||||||
title += `${item.title},`; |
title += `${item.title},`; |
||||||
}); |
}); |
||||||
value = value.substring(0, value.length - 1); |
value = value.substring(0, value.length - 1); |
||||||
title = title.substring(0, title.length - 1); |
title = title.substring(0, title.length - 1); |
||||||
this.list.push({ |
this.list.push({ |
||||||
value, |
value, |
||||||
title, |
title, |
||||||
}); |
}); |
||||||
this.artFrom.pid = value; |
this.artFrom.pid = value; |
||||||
this.getList(); |
this.getList(); |
||||||
}, |
}, |
||||||
// 删除 |
// 删除 |
||||||
del(row, scope) { |
del(row, scope) { |
||||||
console.log(scope) |
console.log(scope) |
||||||
this.$alert('请确定删除!', '提示', { |
this.$alert('请确定删除!', '提示', { |
||||||
confirmButtonText: '确定', |
confirmButtonText: '确定', |
||||||
callback: action => { |
callback: action => { |
||||||
if (action == "confirm") { |
if (action == "confirm") { |
||||||
loadingFn.call(this, "loading", productApi.classifyDelete(row).then(res => { |
loadingFn.call(this, "loading", productApi.classifyDelete(row).then(res => { |
||||||
if (res.code = 20000) { |
if (res.code = 20000) { |
||||||
this.$message.success("操作成功!") |
this.$message.success("操作成功!") |
||||||
this.handleCurrentChange() |
this.handleCurrentChange() |
||||||
} |
} |
||||||
})); |
})); |
||||||
} |
} |
||||||
} |
} |
||||||
}); |
}); |
||||||
}, |
}, |
||||||
// 表格搜索 |
// 表格搜索 |
||||||
userSearchs() { |
userSearchs() { |
||||||
this.artFrom.page = 1; |
this.artFrom.page = 1; |
||||||
this.getList(); |
this.getList(); |
||||||
}, |
}, |
||||||
}, |
}, |
||||||
}; |
}; |
||||||
</script> |
</script> |
||||||
<style scoped lang="stylus"> |
<style scoped lang="stylus"> |
||||||
.treeSel ::v-deep .ivu-select-dropdown-list { |
.treeSel ::v-deep .ivu-select-dropdown-list { |
||||||
padding: 0 10px !important; |
padding: 0 10px !important; |
||||||
box-sizing: border-box; |
box-sizing: border-box; |
||||||
} |
} |
||||||
|
|
||||||
.tabBox_img { |
.tabBox_img { |
||||||
width: 36px; |
width: 36px; |
||||||
height: 36px; |
height: 36px; |
||||||
border-radius: 4px; |
border-radius: 4px; |
||||||
cursor: pointer; |
cursor: pointer; |
||||||
|
|
||||||
img { |
img { |
||||||
width: 100%; |
width: 100%; |
||||||
height: 100%; |
height: 100%; |
||||||
} |
} |
||||||
} |
} |
||||||
</style> |
</style> |
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue