商品分类,新建一二级

master
panqihua 2 years ago
parent d240823008
commit 88a5d5db4f
  1. 73
      src/views/platform/self-operated-mall/category.vue

@ -1,6 +1,6 @@
<template> <template>
<div class="app-container"> <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 :data="dataList" row-key="id">
<el-table-column label="分类名称" prop="name" align="center"></el-table-column> <el-table-column label="分类名称" prop="name" align="center"></el-table-column>
<el-table-column label="图片" align="center"> <el-table-column label="图片" align="center">
@ -14,12 +14,52 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="scope"> <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>
<el-button type="text">删除</el-button> <el-button type="text">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </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> </div>
</template> </template>
<script> <script>
@ -27,6 +67,10 @@ export default {
name: 'Category', name: 'Category',
data() { data() {
return { return {
//
topName: '',
show: 0,
open: false,
dataList: [{ dataList: [{
id: 1, id: 1,
name: '一级分类A', name: '一级分类A',
@ -36,7 +80,30 @@ export default {
name: '二级分类A', 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
} }
} }
} }

Loading…
Cancel
Save