From ffad0d78c50c7fcc36f20435549bfcaf47b138f5 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 22 Oct 2020 14:10:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PaymentMerchantController.class.php | 5 -- .../Admin/View/PaymentMerchant/rules.html | 83 +++++-------------- 2 files changed, 23 insertions(+), 65 deletions(-) diff --git a/Application/Admin/Controller/PaymentMerchantController.class.php b/Application/Admin/Controller/PaymentMerchantController.class.php index e55b1d99e..da88a3dde 100644 --- a/Application/Admin/Controller/PaymentMerchantController.class.php +++ b/Application/Admin/Controller/PaymentMerchantController.class.php @@ -667,11 +667,6 @@ class PaymentMerchantController extends ThinkController public function deleteRule() { - $this->ajaxReturn([ - 'status' => 0, - 'message' => '暂不支持删除' - ]); - $id = I('id', 0); $rule = M('payment_rule', 'tab_')->where(['id' => $id])->find(); diff --git a/Application/Admin/View/PaymentMerchant/rules.html b/Application/Admin/View/PaymentMerchant/rules.html index 7c1493f1c..ade22a150 100644 --- a/Application/Admin/View/PaymentMerchant/rules.html +++ b/Application/Admin/View/PaymentMerchant/rules.html @@ -124,7 +124,6 @@
+ 删除 @@ -253,27 +252,6 @@ minView:'month', maxView:'month', }); - $('#batch-delete-btn').on({ - click: function() { - var ids = getIds(); - $.ajax({ - url: '{:U("batchDelete")}', - type: 'post', - dataType: 'json', - data: {ids: ids}, - success: function(result) { - if (result.status == 1) { - layer.msg(result.message) - setTimeout(function() { - window.location.href = window.location.href - }, 200) - } else { - layer.msg(result.message) - } - } - }) - } - }) function getIds() { var ids = []; $('.ids:checked').each(function() { @@ -281,45 +259,30 @@ }) return ids; } - $('.delete-btn').on({ - click: function() { - var id = $(this).parents('tr').eq(0).attr('data-id'); - $.ajax({ - url: '{:U("deleteRule")}', - type: 'post', - dataType: 'json', - data: {id: id}, - success: function(result) { - if (result.status == 1) { - layer.msg(result.message) - setTimeout(function() { - window.location.href = window.location.href - }, 200) - } else { - layer.msg(result.message) - } + + function deleteRule(id) { + $.ajax({ + url: '{:U("deleteRule")}', + type: 'post', + dataType: 'json', + data: {id: id}, + success: function(result) { + if (result.status == 1) { + layer.msg(result.message) + setTimeout(function() { + window.location.href = window.location.href + }, 200) + } else { + layer.msg(result.message) } - }) - } - }) - $('.cancel-btn').on({ + } + }) + } + $('.delete-btn').on({ click: function() { - var id = $(this).parents('tr').eq(0).attr('data-id'); - $.ajax({ - url: '{:U("cancel")}', - type: 'post', - dataType: 'json', - data: {id: id}, - success: function(result) { - if (result.status == 1) { - layer.msg(result.message) - setTimeout(function() { - window.location.href = window.location.href - }, 200) - } else { - layer.msg(result.message) - } - } + var id = $(this).parents('tr').eq(0).attr('data-id') + layer.confirm('确定要删除该规则 ?请确保删除后时间范围内规则完整!', {icon: 3, title:'提示'}, function(index){ + deleteRule(id) }) } })