From 211e67a8f63f0c8b930c70c664f959fd1725e69f Mon Sep 17 00:00:00 2001 From: "DESKTOP-369JRHT\\12997" <9> Date: Mon, 9 Sep 2024 18:42:05 +0800 Subject: [PATCH] 9.9 --- .../src/api/EventMarketing/cardCoupon.js | 13 ++ .../EventMarketing/newCertificate/index.vue | 113 ++++++++++++------ 2 files changed, 88 insertions(+), 38 deletions(-) diff --git a/fuintAdmin/src/api/EventMarketing/cardCoupon.js b/fuintAdmin/src/api/EventMarketing/cardCoupon.js index 1077bf020..415fec320 100644 --- a/fuintAdmin/src/api/EventMarketing/cardCoupon.js +++ b/fuintAdmin/src/api/EventMarketing/cardCoupon.js @@ -42,3 +42,16 @@ export function deleteCardCoupon(id) { 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', + + }) +} diff --git a/fuintAdmin/src/views/EventMarketing/newCertificate/index.vue b/fuintAdmin/src/views/EventMarketing/newCertificate/index.vue index 1219fd91b..759db2a2b 100644 --- a/fuintAdmin/src/views/EventMarketing/newCertificate/index.vue +++ b/fuintAdmin/src/views/EventMarketing/newCertificate/index.vue @@ -10,14 +10,14 @@ - - - + @@ -81,8 +81,11 @@ @@ -417,7 +420,14 @@ import imgUpload from "@/components/ImageUpload/index.vue" import {getToken} from "@/utils/auth"; import imgUpload1 from "@/components/map/imgUpload.vue"; 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 {listUserGrade} from "@/api/staff/user/usergrade"; @@ -690,12 +700,11 @@ export default { } }, - mounted() { - this.getlist() - this.gettj() - }, + created() { this.getOilList() + this.getlist() + this.gettj() }, components: { @@ -703,6 +712,22 @@ export default { imgUpload, }, 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({page:1,pageSize:1000}).then(res => { if (res.code == 200) { @@ -888,38 +913,34 @@ export default { // }) }, // 删除 - remindOpen(row) { + deletId(id){ + this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { - deleteList(row.id).then(res => { - if (res.success) { + CardCouponDelete(id).then(res=>{ + if(res.code == 200){ this.$message({ type: 'success', message: '删除成功!' }); - // 更新表格数据 - this.updateTableData(row); - } else { - console.log(row); - this.$message.error('删除失败,请稍后重试!' + (response.message || '')); + this.getlist() } - }).catch(error => { - console.error('Delete operation failed:', error); - this.$message({ - type: 'error', - message: '删除失败,请稍后重试!' - }); - }); + }) }).catch(() => { this.$message({ type: 'info', message: '已取消删除' }); }); + + + + }, + updateTableData(deletedRow) { // 更新表格数据,例如移除已删除的行 this.tableData = this.tableData.filter(item => item.id !== deletedRow.id); @@ -982,6 +1003,7 @@ export default { } }, addBlock() { + if( this.ruleForm.unAvailableWeek){ this.ruleForm.unAvailableWeek = this.ruleForm.unAvailableWeek.toString() } @@ -1004,19 +1026,34 @@ export default { - // addList(data).then(res => { - addCardCoupon(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('操作失败请稍后再试'); - }); + if(!this.ruleForm.id ){ + + addCardCoupon(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('操作失败请稍后再试'); + }); + }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 } }