This commit is contained in:
DESKTOP-369JRHT\12997 2024-09-09 18:42:05 +08:00
parent af22da2de6
commit 211e67a8f6
2 changed files with 88 additions and 38 deletions

View File

@ -42,3 +42,16 @@ export function deleteCardCoupon(id) {
method: 'delete', method: 'delete',
}) })
} }
export function CardCouponDelete(id) {
return request({
url: 'cardCoupon/delete/'+id,
method: 'delete',
})
}
export function getCoupon(id) {
return request({
url: 'cardCoupon/isOnLine/'+id,
method: 'get',
})
}

View File

@ -10,14 +10,14 @@
<!-- <el-option v-for="item in jglist" :key="item.cardAmount" :label="item.cardAmount" :value="item.cardAmount">--> <!-- <el-option v-for="item in jglist" :key="item.cardAmount" :label="item.cardAmount" :value="item.cardAmount">-->
<!-- </el-option>--> <!-- </el-option>-->
<!-- </el-select>--> <!-- </el-select>-->
<el-input v-model="queryParams.cardAmount" clearable style="margin-right: 10px" <el-input v-model="queryParams.cardAmount" clearable style=" width: 250px; margin-right: 10px"
placeholder="请输入优惠券名称"></el-input> placeholder="请输入优惠券名称"></el-input>
<el-select v-model="queryParams.activateStatus" clearable style="margin-right: 10px" <el-select v-model="queryParams.activateStatus" clearable style=" width: 250px; margin-right: 10px"
placeholder="请选择优惠类型"> placeholder="请选择优惠类型">
<el-option v-for="item in option" :key="item.value" :label="item.label" :value="item.value"> <el-option v-for="item in option" :key="item.value" :label="item.label" :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
<el-select v-model="queryParams.sailStatus" clearable style="margin-right: 10px" placeholder="请选择状态"> <el-select v-model="queryParams.sailStatus" clearable style=" width: 250px; margin-right: 10px" placeholder="请选择状态">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
@ -81,8 +81,11 @@
<template slot-scope="scope"> <template slot-scope="scope">
<div style="display: flex;"> <div style="display: flex;">
<el-button type="text" @click="updetenCardCoupon(scope.row.id)">修改</el-button> <el-button type="text" @click="updetenCardCoupon(scope.row.id)">修改</el-button>
<el-button type="text" @click="">下架</el-button> <el-button type="text" @click="sxCoupon(scope.row.id)">
<el-button type="text" @click="remindOpen(scope.row)">删除</el-button> <span v-if="scope.row.status == 0">上架</span>
<span v-if="scope.row.status == 1">下架</span>
</el-button>
<el-button type="text" @click="deletId(scope.row.id)">删除</el-button>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -417,7 +420,14 @@ import imgUpload from "@/components/ImageUpload/index.vue"
import {getToken} from "@/utils/auth"; import {getToken} from "@/utils/auth";
import imgUpload1 from "@/components/map/imgUpload.vue"; import imgUpload1 from "@/components/map/imgUpload.vue";
import {Row} from "element-ui"; import {Row} from "element-ui";
import {addCardCoupon, listCardCoupon,getCardCoupon} from "@/api/EventMarketing/cardCoupon"; import {
addCardCoupon,
listCardCoupon,
getCardCoupon,
getCoupon,
CardCouponDelete,
editCardCoupon
} from "@/api/EventMarketing/cardCoupon";
import {getOilNameList, oilNumberList} from "@/api/order/oilnumgun"; import {getOilNameList, oilNumberList} from "@/api/order/oilnumgun";
import {listUserGrade} from "@/api/staff/user/usergrade"; import {listUserGrade} from "@/api/staff/user/usergrade";
@ -690,12 +700,11 @@ export default {
} }
}, },
mounted() {
this.getlist()
this.gettj()
},
created() { created() {
this.getOilList() this.getOilList()
this.getlist()
this.gettj()
}, },
components: { components: {
@ -703,6 +712,22 @@ export default {
imgUpload, imgUpload,
}, },
methods: { methods: {
sxCoupon(id){
getCoupon(id).then(res=>{
if(res.code==200){
this.$message({
message: '操作成功',
type: 'success'
});
this.getlist()
}else{
this.$message({
message: res.msg,
type: 'error'
});
}
})
},
listUserGrade() { listUserGrade() {
listUserGrade({page:1,pageSize:1000}).then(res => { listUserGrade({page:1,pageSize:1000}).then(res => {
if (res.code == 200) { if (res.code == 200) {
@ -888,38 +913,34 @@ export default {
// }) // })
}, },
// //
remindOpen(row) { deletId(id){
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', { this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
deleteList(row.id).then(res => { CardCouponDelete(id).then(res=>{
if (res.success) { if(res.code == 200){
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!' message: '删除成功!'
}); });
// this.getlist()
this.updateTableData(row);
} else {
console.log(row);
this.$message.error('删除失败,请稍后重试!' + (response.message || ''));
} }
}).catch(error => { })
console.error('Delete operation failed:', error);
this.$message({
type: 'error',
message: '删除失败,请稍后重试!'
});
});
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
message: '已取消删除' message: '已取消删除'
}); });
}); });
}, },
updateTableData(deletedRow) { updateTableData(deletedRow) {
// //
this.tableData = this.tableData.filter(item => item.id !== deletedRow.id); this.tableData = this.tableData.filter(item => item.id !== deletedRow.id);
@ -982,6 +1003,7 @@ export default {
} }
}, },
addBlock() { addBlock() {
if( this.ruleForm.unAvailableWeek){ if( this.ruleForm.unAvailableWeek){
this.ruleForm.unAvailableWeek = this.ruleForm.unAvailableWeek.toString() this.ruleForm.unAvailableWeek = this.ruleForm.unAvailableWeek.toString()
} }
@ -1004,7 +1026,8 @@ export default {
// addList(data).then(res => { if(!this.ruleForm.id ){
addCardCoupon(this.ruleForm).then(res => { addCardCoupon(this.ruleForm).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.$message.success('添加成功'); this.$message.success('添加成功');
@ -1013,10 +1036,24 @@ export default {
} else { } else {
this.$message.error('操作失败请稍后再试'); this.$message.error('操作失败请稍后再试');
} }
}) }).catch().catch(error => {
.catch().catch(error => {
this.$message.error('操作失败请稍后再试'); this.$message.error('操作失败请稍后再试');
}); });
}else {
editCardCoupon(this.ruleForm).then(res => {
if (res.code == 200) {
this.$message.success('修改成功');
this.gettj()
this.getlist()
} else {
this.$message.error('操作失败请稍后再试');
}
}).catch().catch(error => {
this.$message.error('操作失败请稍后再试');
});
}
this.centerDialogVisible = false this.centerDialogVisible = false
} }
} }