From 1275c740d5d427f979891fc16eac698834f32654 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 9 Jan 2020 19:57:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Ecp=E5=AF=B9=E8=B4=A6=E5=8D=95?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/StatementController.class.php | 11 +++++ .../Admin/View/Statement/editCpStatement.html | 6 +-- .../Admin/View/StatementMangement/lists.html | 44 ++++++++++++++++--- 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/Application/Admin/Controller/StatementController.class.php b/Application/Admin/Controller/StatementController.class.php index d0730b443..4c823e9c8 100644 --- a/Application/Admin/Controller/StatementController.class.php +++ b/Application/Admin/Controller/StatementController.class.php @@ -45,6 +45,17 @@ class StatementController extends ThinkController $this->display(); } + public function delCpStatement() + { + if(!isset($_REQUEST['id'])) $this->error("参数错误"); + $id = $_REQUEST['id']; + $res = M("statement","tab_")->where("id = '{$id}'")->delete(); + if($res !== false){ + $this->ajaxReturn(array("success"=>"ok","code"=>0)); + }else{ + $this->ajaxReturn(array("error"=>"database error","code"=>2000)); + } + } //获取推广公司基础信息 public function getCpCompanyInfo() { diff --git a/Application/Admin/View/Statement/editCpStatement.html b/Application/Admin/View/Statement/editCpStatement.html index 7e26ef44c..cebc94243 100644 --- a/Application/Admin/View/Statement/editCpStatement.html +++ b/Application/Admin/View/Statement/editCpStatement.html @@ -601,11 +601,11 @@ } } console.log(DATAOBJ); - // layer.load(2); - // $("#createStatement").off("click");//自我解绑 + layer.load(2); + $("#createStatement").off("click");//自我解绑 PUBLIC.postData("{:U('doAddCpStatement',['id'=>$id])}",DATAOBJ,function(data){ - if(data.success){ + if(data.code == 0){ layer.closeAll('loading'); layer.msg('修改成功'); setTimeout(function(){ diff --git a/Application/Admin/View/StatementMangement/lists.html b/Application/Admin/View/StatementMangement/lists.html index ca7760206..28e62edde 100644 --- a/Application/Admin/View/StatementMangement/lists.html +++ b/Application/Admin/View/StatementMangement/lists.html @@ -60,8 +60,8 @@
@@ -131,10 +131,10 @@ 未确认确认 查看 - 撤销 编辑 + 撤销 @@ -223,7 +223,6 @@ var edit = $(this).data(); var ext_field = $(this).attr('ext_field'); - console.log(ext_field) if(edit.type == 0){ var url = "/admin.php?s=/Statement/editCpStatement/id/"+edit.id; }else{ @@ -251,7 +250,42 @@ content: url }); }); - + $(".statement_del").click(function () { + var del = $(this).data(); + layer.confirm('【警告】撤销后将不可回退,如需继续请点击确认', { + btn: ['确认','取消'], + title:false + }, function(){ + if(del.type == 0){ + var url = "/admin.php?s=/Statement/delCpStatement/id/"+del.id; + }else{ + var url = "/admin.php?s=/StatementMangement/delStatementData/id/"+del.id; + } + layer.load(2); + $.ajax({ + url: url, + type: "get", + dataType: "json", + success: function (data) { + if(data.code == 0){ + layer.closeAll('loading'); + layer.msg("删除成功"); + setTimeout(function(){ + window.location.reload(); + },350); + }else{ + alert("删除失败,请联系管理员") + } + } + }) + + }, function(){ + + }); + + + + }); $("#search").click(function(){ var url = $(this).attr('url');