优惠券刚写
This commit is contained in:
@@ -1,17 +1,38 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-radio-group size="mini" v-model="couponActiveName" style="margin-bottom: 15px;" @tab-click="handleClick">
|
||||
<el-radio-button label="0">全部</el-radio-button>
|
||||
<el-radio-button label="1">生效中</el-radio-button>
|
||||
<el-radio-button label="2">已过期</el-radio-button>
|
||||
<el-radio-group v-model="currentState" style="margin-bottom: 15px;" @tab-click="handleClick">
|
||||
<el-radio-button label="0">生效中</el-radio-button>
|
||||
<el-radio-button label="1">已过期</el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input size="mini" v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
<el-input v-model="dataForm.couponName" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠卷范围">
|
||||
<el-select v-model="dataForm.couponRange" placeholder="请选择" @change="pageIndex = 1; getDataList()">
|
||||
<el-option
|
||||
v-for="item in rangList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠券类型">
|
||||
<el-select v-model="dataForm.TypeList" placeholder="请选择" @change="pageIndex = 1; getDataList()">
|
||||
<el-option
|
||||
v-for="item in TypeList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="mini" @click="getDataList()">查询</el-button>
|
||||
<el-button size="mini" v-if="isAuth('book:coupon:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="isAuth('book:coupon:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<!-- <el-button v-if="isAuth('book:coupon:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -43,29 +64,41 @@
|
||||
prop="couponType"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="优惠卷类型">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.couponProType == 0">商品用券</span>
|
||||
<span v-if="scope.row.couponProType == 1">电子书用券</span>
|
||||
</template>
|
||||
label="优惠卷类型" width="100px">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="couponAmount"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="面值">
|
||||
</el-table-column>
|
||||
label="面值" width="90px">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="expirationDate"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="结束使用时间">
|
||||
label="时间">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.createTime">创建时间:{{scope.row.createTime}}</span>
|
||||
<span v-if="scope.row.effectTime"><br/>生效时间:{{scope.row.effectTime}}</span>
|
||||
<span v-if="scope.row.expireTime"><br/>结束时间:{{scope.row.expireTime}}</span>
|
||||
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="couponRange"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="优惠券范围">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.couponRange | getRange}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="totalCirculation"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="发行数量">
|
||||
label="发行数量" width="90px">
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
prop="useCount"
|
||||
@@ -106,15 +139,22 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import global from "@/views/common/common.vue"; //引入共用组间
|
||||
|
||||
import AddOrUpdate from './coupon-add-or-update'
|
||||
import commentsListVue from '../book/commentsList.vue'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
dataForm: {
|
||||
key: ''
|
||||
couponName: '',
|
||||
couponRange: '',
|
||||
couponType:''
|
||||
},
|
||||
couponActiveName:'0',
|
||||
currentState:'0', // "currentState":""//当前状态 0 发放中 1结束
|
||||
dataList: [],
|
||||
rangList: global.rangList,
|
||||
TypeList: global.TypeList,
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
@@ -123,6 +163,25 @@
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
// 格式化时间
|
||||
getRange (value) {
|
||||
// if (value && value != 0) {
|
||||
// console.log('555555555',value)
|
||||
switch (value) {
|
||||
case 0:
|
||||
|
||||
return '无限制'
|
||||
case 1:
|
||||
return '课程券'
|
||||
case 2:
|
||||
return '课程品类券'
|
||||
}
|
||||
// } else {
|
||||
// return ''
|
||||
// }
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
},
|
||||
@@ -131,24 +190,30 @@
|
||||
},
|
||||
methods: {
|
||||
handleClick(){
|
||||
console.log(this.couponActiveName)
|
||||
console.log(this.currentState)
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/coupon/list'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
url: this.$http.adornUrl('/common/coupon/getCouponList'),
|
||||
method: 'post',
|
||||
data: this.$http.adornData({
|
||||
'page': this.pageIndex,
|
||||
'limit': this.pageSize,
|
||||
'key': this.dataForm.key,
|
||||
'currentState': this.couponActiveName
|
||||
'couponName': this.dataForm.couponName,
|
||||
'currentState': this.currentState, //当前状态 0 发放中 1结束
|
||||
"couponType": this.dataForm.couponType,//优惠券类型 0现金 1折扣
|
||||
"couponRange":this.dataForm.couponRange,//优惠卷范围 0无限制 1课程卷 2课程品类卷
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if(data.code !==0) return this.$message.error(data.msg)
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.page.list
|
||||
this.totalPage = data.page.totalCount
|
||||
this.dataList = data.couponPage.records
|
||||
this.totalPage = data.couponPage.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
@@ -209,7 +274,7 @@
|
||||
})
|
||||
}
|
||||
},watch:{
|
||||
couponActiveName: {
|
||||
currentState: {
|
||||
handler(val, oldVal) {
|
||||
this.getDataList()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user