|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
<template> |
|
|
|
|
<div class="app-container"> |
|
|
|
|
<el-button type="primary" style="margin-bottom: 10px;">新建分类</el-button> |
|
|
|
|
<el-button type="primary" style="margin-bottom: 10px;" @click="show = 0; open = true">新建分类</el-button> |
|
|
|
|
<el-table :data="dataList" row-key="id"> |
|
|
|
|
<el-table-column label="分类名称" prop="name" align="center"></el-table-column> |
|
|
|
|
<el-table-column label="图片" align="center"> |
|
|
|
@ -14,12 +14,52 @@ |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button type="text" v-if="scope.row.children">新建子分类</el-button> |
|
|
|
|
<el-button type="text" v-if="scope.row.children" |
|
|
|
|
@click="topName = scope.row.name; show = 1; open = true">新建子分类</el-button> |
|
|
|
|
<el-button type="text">编辑</el-button> |
|
|
|
|
<el-button type="text">删除</el-button> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<el-dialog title="新增分类" :visible.sync="open" @close="reset"> |
|
|
|
|
<el-form :inline="true" label-width="150px" label-position="left"> |
|
|
|
|
|
|
|
|
|
<template v-if="show === 0"> |
|
|
|
|
<el-form-item label="分类名称"> |
|
|
|
|
<el-input v-model="form.name" placeholder="请输入分类名称"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
<template v-else> |
|
|
|
|
<el-form-item label="上级分类"> |
|
|
|
|
<el-input v-model="topName" readonly></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<br /> |
|
|
|
|
<el-form-item label="分类名称"> |
|
|
|
|
<el-input v-model="form.name" placeholder="请输入分类名称"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<br /> |
|
|
|
|
<el-form-item label="平台抽成"> |
|
|
|
|
<el-input v-model="form.commission" placeholder="请输入"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<br /> |
|
|
|
|
<el-form-item label="特价商品最高折扣"> |
|
|
|
|
<el-input v-model="form.discount" placeholder="请输入"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
<br /> |
|
|
|
|
<el-form-item label="图片"> |
|
|
|
|
<el-upload :on-remove="onChange" :file-list="form.fileList" :on-change="onChange" |
|
|
|
|
list-type="picture" action="#" :auto-upload="false" :limit="1"> |
|
|
|
|
<i class="el-icon-plus" v-if="form.fileList.length === 0"></i> |
|
|
|
|
</el-upload> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
</el-form> |
|
|
|
|
<div style="text-align:center"> |
|
|
|
|
<el-button type="primary" @click="open = false; $modal.msgSuccess('保存成功')">保存</el-button> |
|
|
|
|
<el-button @click="reset">重置</el-button> |
|
|
|
|
</div> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
@ -27,6 +67,10 @@ export default { |
|
|
|
|
name: 'Category', |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
// 新增子分类的一级分类 |
|
|
|
|
topName: '', |
|
|
|
|
show: 0, |
|
|
|
|
open: false, |
|
|
|
|
dataList: [{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '一级分类A', |
|
|
|
@ -36,7 +80,30 @@ export default { |
|
|
|
|
name: '二级分类A', |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}] |
|
|
|
|
}], |
|
|
|
|
form: { |
|
|
|
|
// 分类名称 |
|
|
|
|
name: '', |
|
|
|
|
// 平台抽成 |
|
|
|
|
commission: '', |
|
|
|
|
//特价商品最高折扣 |
|
|
|
|
discount: '', |
|
|
|
|
//图片 |
|
|
|
|
fileList: [] |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
reset() { |
|
|
|
|
this.form.name = '' |
|
|
|
|
this.form.commission = '' |
|
|
|
|
this.form.discount = '' |
|
|
|
|
this.form.fileList = [] |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
onChange(file, fileList) { |
|
|
|
|
this.form.fileList = fileList |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|