修改
- 下架
- 删除
+
+ 上架
+ 下架
+
+ 删除
@@ -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
}
}