调整优惠券的权限

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

View File

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