优惠券

This commit is contained in:
@fawn-nine
2024-10-18 17:02:59 +08:00
parent ce2574a60b
commit 5663fecb71
6 changed files with 508 additions and 28 deletions

View File

@@ -1,6 +1,7 @@
<template>
<div class="mod-config">
<el-radio-group v-model="currentState" style="margin-bottom: 15px;" @tab-click="handleClick">
<el-radio-button label="">全部</el-radio-button>
<el-radio-button label="0">生效中</el-radio-button>
<el-radio-button label="1">已过期</el-radio-button>
</el-radio-group>
@@ -60,13 +61,12 @@
align="center"
label="优惠券名称">
</el-table-column>
<el-table-column
prop="couponType"
<el-table-column
header-align="center"
align="center"
label="优惠券类型" width="100px">
<template slot-scope="scope">
{{scope.row.couponType | getType}}
{{scope.row.effectType | getType}}
</template>
</el-table-column>
<el-table-column
@@ -115,6 +115,22 @@
align="center"
label="领取数量">
</el-table-column> -->
<el-table-column
prop="receiveCount"
header-align="center"
align="center"
label="操作">
<template slot-scope="scope">
<el-switch
v-model="scope.row.currentState"
:active-value ="0"
:inactive-value='1'
@change="changeStateHandle(scope.row.id, scope.row.currentState)"
active-text="发放中"
inactive-text="暂停发放">
</el-switch>
</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
@@ -122,7 +138,7 @@
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="primary" size="small" plain @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="primary" size="small" plain @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="danger" size="small" plain @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
@@ -154,7 +170,7 @@ import commentsListVue from '../book/commentsList.vue'
couponRange: '',
couponType:''
},
currentState:'0', // "currentState":""//当前状态 0 发放中 1结束
currentState:'', // "currentState":""//当前状态 0 发放中 1结束
dataList: [],
rangList: global.rangList,
TypeList: global.TypeList,
@@ -197,9 +213,34 @@ import commentsListVue from '../book/commentsList.vue'
activated () {
this.getDataList()
},
methods: {
methods: {
// 修改优惠券状态
changeStateHandle (id, state) {
console.log('进来了')
this.$http({
url: this.$http.adornUrl('/common/coupon/updateCouponState'),
method: 'post',
data: this.$http.adornData({
id: id,
currentState: state
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type:'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
}).catch((e) => {
this.$message.error(e.msg)
})
},
handleClick(){
console.log(this.currentState)
this.pageIndex = 1
@@ -251,10 +292,11 @@ import commentsListVue from '../book/commentsList.vue'
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
// this.addOrUpdateVisible = true
})
},
// 删除