增加店铺的审核功能
This commit is contained in:
parent
2b8a557ceb
commit
be24b9489d
@ -61,3 +61,10 @@ export const updateShopQtypes = (data: any) =>
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
|
||||
export const updateShopPublish = (data: any) =>
|
||||
request({
|
||||
url: '/shop/publish',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
|
@ -5,6 +5,17 @@
|
||||
<el-form-item label="关键字" prop="key">
|
||||
<el-input v-model="filterForm.key" placeholder="关键字"/>
|
||||
</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-button type="primary" @click="search">查询</el-button>
|
||||
@ -60,16 +71,40 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="publish"
|
||||
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">
|
||||
<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">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
icon="el-icon-edit"
|
||||
style="margin-left: 10px"
|
||||
v-permission="['shopman:edit']"
|
||||
>
|
||||
编辑
|
||||
@ -102,7 +137,7 @@
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import { IShopData } from '@/api/types'
|
||||
import Pagination from '@/components/Pagination/index.vue'
|
||||
import { deleteShop, getShops } from '@/api/shop'
|
||||
import { deleteShop, getShops, updateShopPublish } from '@/api/shop'
|
||||
import { parseTime } from '@/utils'
|
||||
|
||||
@Component({
|
||||
@ -124,11 +159,13 @@ export default class extends Vue {
|
||||
private listQuery = {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
key: ''
|
||||
key: '',
|
||||
publish: 'all'
|
||||
}
|
||||
|
||||
private filterForm = {
|
||||
key: ''
|
||||
key: '',
|
||||
publish: 'all'
|
||||
}
|
||||
|
||||
$refs!: {
|
||||
@ -151,6 +188,10 @@ export default class extends Vue {
|
||||
this.total = data.total
|
||||
}
|
||||
|
||||
private formPublish(cellValue: boolean) {
|
||||
return cellValue ? '已审核' : '未审核'
|
||||
}
|
||||
|
||||
private async handleDelete(scope: any) {
|
||||
const { $index, row } = scope
|
||||
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() {
|
||||
this.filterData()
|
||||
}
|
||||
@ -173,6 +230,7 @@ export default class extends Vue {
|
||||
private filterData() {
|
||||
this.listQuery.key = this.filterForm.key
|
||||
this.listQuery.page = 1
|
||||
this.listQuery.publish = this.filterForm.publish
|
||||
this.getList()
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user