xiaoyu преди 3 години
родител
ревизия
5339f294d8
променени са 3 файла, в които са добавени 71 реда и са изтрити 11 реда
  1. 7 3
      admin/control/merchant.php
  2. 24 5
      admin/templates/default/merchant.index.php
  3. 40 3
      admin/templates/default/provider.group.set.php

+ 7 - 3
admin/control/merchant.php

@@ -59,9 +59,13 @@ class merchantControl extends SystemControl
         showMessage('操作成功', 'index.php?act=merchant&op=merchant');
     }
 
-    /**
-     * 新增机构
-     */
+    public function AllCloseMerchantOp()
+    {
+        $model_merchant = Model('merchant');
+        $resp = $model_merchant->editMerchant(['merchant_state' => 2], ['mchid' => ['gt',0]]);
+        showMessage('操作成功');
+    }
+
     public function merchant_addOp()
     {
         if (chksubmit()) {

+ 24 - 5
admin/templates/default/merchant.index.php

@@ -1,3 +1,13 @@
+<style>
+    .page .fixed-bar .item-title h3 {
+        margin-top:18px !important;
+        margin-bottom:10px !important;
+        font-weight:700 !important;
+    }
+    .tab-base li span {
+        font-size:12px !important;
+    }
+</style>
 <?php use refill\LZRefillFactory;
 
 defined('InShopNC') or exit('Access Invalid!'); ?>
@@ -50,8 +60,7 @@ defined('InShopNC') or exit('Access Invalid!'); ?>
     <!--  </table>-->
     <form method="post" id="merchant_name_form">
         <input type="hidden" name="form_submit" value="ok"/>
-        <!-- <a href="#" class="btns" id="enable"><span>全部启用机构</span></a>
-        <a href="#" class="btns" id="close"><span>全部关闭机构</span></a> -->
+        <a href="#" class="btns" id="close"><span>全部关闭机构</span></a>
 
         <div>
         <table class="table tb-type2 myTable" width="100%"  id="app-gas-content">
@@ -117,7 +126,7 @@ defined('InShopNC') or exit('Access Invalid!'); ?>
                             <a href="index.php?act=merchant&op=merchant_edit&mchid=<?php echo $v['mchid'] ?>">编辑</a>
                             <?php if($v['merchant_state'] == 1){?>
                                 |
-                                <a href="index.php?act=merchant&op=changeState&state=2&mchid=<?php echo $v['mchid'] ?>" style="color: red">关闭机构</a>
+                                <a class="closeall" href="index.php?act=merchant&op=changeState&state=2&mchid=<?php echo $v['mchid'] ?>" style="color: red">关闭机构</a>
                             <?php }?>
                             <?php if($v['merchant_state'] == 2){?>
                                 |
@@ -160,6 +169,8 @@ defined('InShopNC') or exit('Access Invalid!'); ?>
     </form>
 </div>
 <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.edit.js" charset="utf-8"></script>
+<script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL;?>/layui/layui.js"></script>
+<link rel="stylesheet" type="text/css" href="<?php echo ADMIN_TEMPLATES_URL; ?>/layui/css/layui.css"/>
 <script>
     $(function () {
         $('#ncsubmit').click(function () {
@@ -174,7 +185,15 @@ defined('InShopNC') or exit('Access Invalid!'); ?>
                 $(this)[0].style.backgroundColor = '#fff'
             })
         })
-        // 
-
+        // 全部关闭机构
+             $('#close').click(function () {
+            layer.confirm('您确定要全部关闭机构', {
+                btn: ['确定', '取消'],
+                title: '全部关闭'
+            }, function () {
+                window.location.href = `index.php?act=merchant&op=AllCloseMerchant`
+            }, function () {
+            });
+        })
     });
 </script>

+ 40 - 3
admin/templates/default/provider.group.set.php

@@ -25,8 +25,8 @@
                 <th class="w180">
                 <a href="JavaScript:void(0);" class="btn" id="emptyBtn"><span>清空</span></a>
                 </th>
-                <th class="w57 align-center">
-                    全选
+                <th class="w57 align-center" id="selectAll">
+                <input type="checkbox" name="chbox" value="">
                 </th>
                 <?php foreach ($output['amounts'] as $amount){?>
                 <th class="w57 align-center"><?php echo $amount;?></th>
@@ -39,7 +39,7 @@
                     <tr class="trFlex" data-color="<?php echo $provider['card_type'];?>">
                             <td class="w180"><span data-color="<?php echo $provider['opened']?>" class="textColor"><?php echo $provider['name'];?></span></td>
                             <td class="w50 align-center">
-                                <input type="checkbox" class="w50 checkAll">
+                                <input type="checkbox" data-check="<?php echo $provider['opened']?>" name="checkbox" class="w50 checkAll">
                             </td>
                             <?php foreach ($output['amounts'] as $amount){?>
 
@@ -142,6 +142,7 @@
         // 全选
         $('.checkAll').click(function () {
             let hang = $(this).parent().parent().prevAll().length + 1
+            console.log(hang);
             if ($(this).is(':checked')) {
                 $('.td_readonly').each(function () {
                     let isReadonly = $(this).attr('data-readonly')
@@ -164,5 +165,41 @@
                 })
             }
         })
+        // 一键全部选择
+        $('#selectAll').click(function() {
+            let hang = $(this).parent().parent().prevAll().length + 1
+            console.log(hang);
+            if ($("input[name='chbox']").is(':checked')) {
+                $("input[name='checkbox']").each(function() {
+                let checkall =  $(this).attr('data-check')
+                if(checkall == '1') {
+                  this.checked = true;
+                }
+                if ($(this).is(':checked')) {
+                $('.td_readonly').each(function () {
+                    let isReadonly = $(this).attr('data-readonly')
+                    if (isReadonly == 0) {
+                    if (hang == 1) {
+                        $(this).children().attr("checked",true)
+                        }
+                    }
+                })
+            } 
+              })
+       
+          } else {
+              $("input[name='checkbox']").each(function() {
+                  this.checked = false;
+                  $('.td_readonly').each(function () {
+                    let isReadonly = $(this).attr('data-readonly')
+                    if (isReadonly == 0) {
+                    if (hang == 1) {
+                    $(this).children().attr("checked",false)
+                        }
+                    }
+                })
+              })
+          }
+        })
     });
 </script>