添加:品牌管理
This commit is contained in:
parent
369bceb38f
commit
5cb9c36241
|
|
@ -111,6 +111,21 @@ export function categoryDeleteApi(id) {
|
|||
return request.delete(`system/merchant/category/${id}`)
|
||||
}
|
||||
|
||||
|
||||
// 商户品牌 - 列表
|
||||
export function brandListApi(data) {
|
||||
return request.get('system/merchant/brand/lst', data)
|
||||
}
|
||||
// 商户品牌 -- 编辑表单
|
||||
export function brandEditApi(data) {
|
||||
return request.get(`system/merchant/brand/form`, data)
|
||||
}
|
||||
// 商户品牌 -- 删除
|
||||
export function brandDeleteApi(id) {
|
||||
return request.delete(`system/merchant/brand/${id}`)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 商户对账 -- 订单列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -63,11 +63,20 @@ const merchantRouter =
|
|||
path: 'classify',
|
||||
name: 'MerchantClassify',
|
||||
meta: {
|
||||
title: '商户分类',
|
||||
title: '分类管理',
|
||||
noCache: true
|
||||
},
|
||||
component: () => import('@/views/merchant/classify')
|
||||
},
|
||||
{
|
||||
path: 'brand',
|
||||
name: 'MerchantBrand',
|
||||
meta: {
|
||||
title: '品牌管理',
|
||||
noCache: true
|
||||
},
|
||||
component: () => import('@/views/merchant/brand')
|
||||
},
|
||||
{
|
||||
path: 'application',
|
||||
name: 'MerchantApplication',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
<template>
|
||||
<div class="divBox">
|
||||
<el-card class="box-card">
|
||||
<!--顶部信息-->
|
||||
<div slot="header" class="clearfix">
|
||||
<el-button size="small" type="primary" @click="onAdd">添加品牌</el-button>
|
||||
</div>
|
||||
<!--列表-->
|
||||
<el-table v-loading="listLoading" :data="tableData.data" style="width: 100%" size="small" highlight-current-row>
|
||||
<el-table-column prop="id" label="ID" min-width="100" align="center"/>
|
||||
<el-table-column prop="title" label="品牌名称" min-width="150" align="center"/>
|
||||
<el-table-column prop="create_time" label="创建时间" min-width="150" align="center"/>
|
||||
<el-table-column label="操作" min-width="150" fixed="right" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="onEdit(scope.row.id)">编辑</el-button>
|
||||
<el-button type="text" size="small" @click="handleDelete(scope.row.id, scope.$index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页-->
|
||||
<div class="block">
|
||||
<el-pagination
|
||||
:page-sizes="[20, 40, 60, 80]"
|
||||
:page-size="tableFrom.limit"
|
||||
:current-page="tableFrom.page"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="tableData.total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {brandListApi, brandDeleteApi, brandEditApi} from '@/api/merchant'
|
||||
export default {
|
||||
name: 'MerchantBrand',
|
||||
data() {
|
||||
return {
|
||||
tableFrom: {
|
||||
page: 1,
|
||||
limit: 20
|
||||
},
|
||||
tableData: {
|
||||
data: [],
|
||||
total: 0
|
||||
},
|
||||
listLoading: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 列表
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
brandListApi(this.tableFrom).then(res => {
|
||||
this.tableData.data = res.data.list
|
||||
this.tableData.total = res.data.count
|
||||
this.listLoading = false
|
||||
}).catch(res => {
|
||||
this.listLoading = false
|
||||
this.$message.error(res.message)
|
||||
})
|
||||
},
|
||||
pageChange(page) {
|
||||
this.tableFrom.page = page
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.tableFrom.limit = val
|
||||
this.getList()
|
||||
},
|
||||
// 添加
|
||||
onAdd() {
|
||||
this.$modalForm(brandEditApi()).then(() => this.getList())
|
||||
},
|
||||
// 编辑
|
||||
onEdit(id) {
|
||||
this.$modalForm(brandEditApi({id: id})).then(() => this.getList())
|
||||
},
|
||||
// 删除
|
||||
handleDelete(id, idx) {
|
||||
this.$modalSure().then(() => {
|
||||
brandDeleteApi(id).then(({ message }) => {
|
||||
this.$message.success(message)
|
||||
this.tableData.data.splice(idx, 1)
|
||||
}).catch(({ message }) => {
|
||||
this.$message.error(message)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
Loading…
Reference in New Issue