调整优惠券的权限

This commit is contained in:
zhl 2021-05-08 16:36:18 +08:00
parent 92a0e18abf
commit 56fe4bcae4
2 changed files with 24 additions and 7 deletions

View File

@ -5,7 +5,7 @@
<el-form-item label="关键字" prop="key">
<el-input v-model="filterForm.key" placeholder="关键字"/>
</el-form-item>
<el-form-item label="店铺">
<el-form-item label="店铺" v-if="userLevel === 1">
<el-select
v-model="filterForm.department"
placeholder="所有"
@ -55,6 +55,7 @@
<el-table-column
label="店铺"
prop="shop"
v-if="userLevel === 1"
:formatter = "formatDept"
>
</el-table-column>
@ -131,6 +132,7 @@ import Pagination from '@/components/Pagination/index.vue'
import { getShops } from '@/api/shop'
import { parseTime } from '@/utils'
import { deleteCoupon, getCoupons } from '@/api/coupon'
import { UserModule } from '@/store/modules/user'
@Component({
name: 'CouponList',
@ -177,9 +179,15 @@ export default class extends Vue {
filterForm: HTMLFormElement
}
created() {
this.getList()
this.getRemoteDeptList('')
get userLevel() {
return UserModule.level
}
async created() {
await this.getList()
if (UserModule.level === 1) {
await this.getRemoteDeptList()
}
}
private async getList() {

View File

@ -7,7 +7,7 @@
label-width="121px"
class="form-container"
>
<el-form-item label="店铺" prop="shop">
<el-form-item label="店铺" prop="shop" v-if="userLevel === 1">
<el-select
v-model="postForm.shop"
placeholder="选择店铺"
@ -133,6 +133,7 @@ import UploadImage from '@/components/UploadImage/index.vue'
import Tinymce from '@/components/Tinymce/index.vue'
import { getShops } from '@/api/shop'
import { defaultCouponData, getCoupon, saveCoupon } from '@/api/coupon'
import { UserModule } from '@/store/modules/user'
@Component({
name: 'CouponEditor',
@ -184,9 +185,17 @@ export default class extends Vue {
postForm: HTMLFormElement
}
get userLevel() {
return UserModule.level
}
created() {
const id = this.$route.params?.id
this.getRemoteDeptList('')
if (UserModule.level === 1) {
this.getRemoteDeptList('')
} else {
this.postForm.shop = UserModule.department
}
if (id) {
this.fetchData(id)
}
@ -246,7 +255,7 @@ export default class extends Vue {
this.loading = false
this.$notify({
title: 'Success',
message: 'The post published successfully',
message: '优惠券保存成功',
type: 'success',
duration: 2000
})