diff --git a/src/api/shop.ts b/src/api/shop.ts
index 148998b..ed7e5b9 100644
--- a/src/api/shop.ts
+++ b/src/api/shop.ts
@@ -61,3 +61,10 @@ export const updateShopQtypes = (data: any) =>
method: 'post',
data
})
+
+export const updateShopPublish = (data: any) =>
+ request({
+ url: '/shop/publish',
+ method: 'post',
+ data
+ })
diff --git a/src/views/shop/list.vue b/src/views/shop/list.vue
index f43dde1..7f953a5 100644
--- a/src/views/shop/list.vue
+++ b/src/views/shop/list.vue
@@ -5,6 +5,17 @@
+
+
+ 所有
+ 已审核
+ 未审核
+
+
查询
@@ -13,25 +24,25 @@
添加
{{ row.createdAt | parseTime }}
@@ -39,13 +50,13 @@
{{ row.name }}
@@ -53,34 +64,58 @@
- {{ row.areaStr }}
+ {{ row.areaStr }}
+
+ {{ formPublish(row.publish) }}
+
+
+
+
+ {{ scope.row.publish? '取消审核': '通过审核' }}
+
- 编辑
+ 编辑
{{ $t('permission.delete') }}
@@ -89,11 +124,11 @@
@@ -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()
}