增加店铺的审核功能
This commit is contained in:
parent
2b8a557ceb
commit
be24b9489d
@ -61,3 +61,10 @@ export const updateShopQtypes = (data: any) =>
|
|||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export const updateShopPublish = (data: any) =>
|
||||||
|
request({
|
||||||
|
url: '/shop/publish',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
@ -5,6 +5,17 @@
|
|||||||
<el-form-item label="关键字" prop="key">
|
<el-form-item label="关键字" prop="key">
|
||||||
<el-input v-model="filterForm.key" placeholder="关键字"/>
|
<el-input v-model="filterForm.key" placeholder="关键字"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="审核状态">
|
||||||
|
<el-select
|
||||||
|
v-model="filterForm.publish"
|
||||||
|
placeholder="所有"
|
||||||
|
class="w100"
|
||||||
|
>
|
||||||
|
<el-option value="all">所有</el-option>
|
||||||
|
<el-option value="true">已审核</el-option>
|
||||||
|
<el-option value="false">未审核</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="search">查询</el-button>
|
<el-button type="primary" @click="search">查询</el-button>
|
||||||
@ -13,25 +24,25 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
<router-link to="/system/create">
|
<router-link to="/system/create">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
v-permission="['shopman:edit']"
|
v-permission="['shopman:edit']"
|
||||||
>
|
>
|
||||||
添加
|
添加
|
||||||
</el-button>
|
</el-button>
|
||||||
</router-link>
|
</router-link>
|
||||||
<el-table
|
<el-table
|
||||||
v-loading="listLoading"
|
v-loading="listLoading"
|
||||||
:data="list"
|
:data="list"
|
||||||
border
|
border
|
||||||
fit
|
fit
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
style="width: 100%;margin-top:30px;"
|
style="width: 100%;margin-top:30px;"
|
||||||
>
|
>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
width="180px"
|
width="180px"
|
||||||
align="center"
|
align="center"
|
||||||
label="添加时间"
|
label="添加时间"
|
||||||
>
|
>
|
||||||
<template slot-scope="{row}">
|
<template slot-scope="{row}">
|
||||||
<span>{{ row.createdAt | parseTime }}</span>
|
<span>{{ row.createdAt | parseTime }}</span>
|
||||||
@ -39,13 +50,13 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
min-width="200px"
|
min-width="200px"
|
||||||
label="店铺名"
|
label="店铺名"
|
||||||
>
|
>
|
||||||
<template slot-scope="{row}">
|
<template slot-scope="{row}">
|
||||||
<router-link
|
<router-link
|
||||||
:to="'/system/edit/'+row._id"
|
:to="'/system/edit/'+row._id"
|
||||||
class="link-type"
|
class="link-type"
|
||||||
>
|
>
|
||||||
<span>{{ row.name }}</span>
|
<span>{{ row.name }}</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
@ -53,34 +64,58 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="区域"
|
label="区域"
|
||||||
>
|
>
|
||||||
<template slot-scope="{row}">
|
<template slot-scope="{row}">
|
||||||
<span>{{ row.areaStr }}</span>
|
<span>{{ row.areaStr }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
prop="publish"
|
||||||
label="操作"
|
align="center"
|
||||||
|
label="审核状态"
|
||||||
|
>
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<el-tag
|
||||||
|
size="small"
|
||||||
|
:type="row.publish ? 'info': 'danger'"
|
||||||
|
>{{ formPublish(row.publish) }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
align="center"
|
||||||
|
label="操作"
|
||||||
|
fixed="right"
|
||||||
|
width="320"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
:type="scope.row.publish? 'warning': 'success'"
|
||||||
|
size="small"
|
||||||
|
style="margin-left: 10px"
|
||||||
|
v-permission="['shopman:review']"
|
||||||
|
@click="publishShop(scope)"
|
||||||
|
>
|
||||||
|
{{ scope.row.publish? '取消审核': '通过审核' }}
|
||||||
|
</el-button>
|
||||||
<router-link :to="'/system/edit/'+scope.row._id">
|
<router-link :to="'/system/edit/'+scope.row._id">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
v-permission="['shopman:edit']"
|
style="margin-left: 10px"
|
||||||
|
v-permission="['shopman:edit']"
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
</router-link>
|
</router-link>
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
size="small"
|
size="small"
|
||||||
style="margin-left: 10px"
|
style="margin-left: 10px"
|
||||||
v-permission="['shopman:delete']"
|
v-permission="['shopman:delete']"
|
||||||
@click="handleDelete(scope)"
|
@click="handleDelete(scope)"
|
||||||
>
|
>
|
||||||
{{ $t('permission.delete') }}
|
{{ $t('permission.delete') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -89,11 +124,11 @@
|
|||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total>0"
|
v-show="total>0"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page.sync="listQuery.page"
|
:page.sync="listQuery.page"
|
||||||
:limit.sync="listQuery.limit"
|
:limit.sync="listQuery.limit"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -102,7 +137,7 @@
|
|||||||
import { Component, Vue } from 'vue-property-decorator'
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import { IShopData } from '@/api/types'
|
import { IShopData } from '@/api/types'
|
||||||
import Pagination from '@/components/Pagination/index.vue'
|
import Pagination from '@/components/Pagination/index.vue'
|
||||||
import { deleteShop, getShops } from '@/api/shop'
|
import { deleteShop, getShops, updateShopPublish } from '@/api/shop'
|
||||||
import { parseTime } from '@/utils'
|
import { parseTime } from '@/utils'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -124,11 +159,13 @@ export default class extends Vue {
|
|||||||
private listQuery = {
|
private listQuery = {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
key: ''
|
key: '',
|
||||||
|
publish: 'all'
|
||||||
}
|
}
|
||||||
|
|
||||||
private filterForm = {
|
private filterForm = {
|
||||||
key: ''
|
key: '',
|
||||||
|
publish: 'all'
|
||||||
}
|
}
|
||||||
|
|
||||||
$refs!: {
|
$refs!: {
|
||||||
@ -151,6 +188,10 @@ export default class extends Vue {
|
|||||||
this.total = data.total
|
this.total = data.total
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private formPublish(cellValue: boolean) {
|
||||||
|
return cellValue ? '已审核' : '未审核'
|
||||||
|
}
|
||||||
|
|
||||||
private async handleDelete(scope: any) {
|
private async handleDelete(scope: any) {
|
||||||
const { $index, row } = scope
|
const { $index, row } = scope
|
||||||
await this.$confirm('确认删除该店铺?', 'Warning', {
|
await this.$confirm('确认删除该店铺?', 'Warning', {
|
||||||
@ -166,6 +207,22 @@ export default class extends Vue {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async publishShop(scope: any) {
|
||||||
|
const { row } = scope
|
||||||
|
const str = row.publish ? '确认取消该店铺的审核状态?' : '确定通过该店铺的审核?'
|
||||||
|
try {
|
||||||
|
await this.$confirm(str, 'Warning', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
await updateShopPublish({id: row._id, publish: !row.publish})
|
||||||
|
row.publish = !row.publish
|
||||||
|
} catch(err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private search() {
|
private search() {
|
||||||
this.filterData()
|
this.filterData()
|
||||||
}
|
}
|
||||||
@ -173,6 +230,7 @@ export default class extends Vue {
|
|||||||
private filterData() {
|
private filterData() {
|
||||||
this.listQuery.key = this.filterForm.key
|
this.listQuery.key = this.filterForm.key
|
||||||
this.listQuery.page = 1
|
this.listQuery.page = 1
|
||||||
|
this.listQuery.publish = this.filterForm.publish
|
||||||
this.getList()
|
this.getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user