group_add.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. {extend name="default/base/base_seller" /}
  2. {block name="seller_main"}
  3. <div class="dssc-form-default">
  4. <form id="add_form" action="{:url('Selleraccountgroup/group_save',['group_id'=>$group_info.sellergroup_id])}" method="post">
  5. <dl>
  6. <dt><i class="required">*</i>{$Think.lang.group_name}{$Think.lang.ds_colon}</dt>
  7. <dd>
  8. <input class="w120 text" name="seller_group_name" type="text" id="seller_group_name" value="{if !empty($group_info)}{$group_info['sellergroup_name']}{/if}" />
  9. <span></span>
  10. <p class="hint">{$Think.lang.set_permission_group_name}</p>
  11. </dd>
  12. </dl>
  13. <dl id="function_list">
  14. <dt><i class="required">*</i>{$Think.lang.permissions}{$Think.lang.ds_colon}</dt>
  15. <dd>
  16. <div class="dssc-account-all">
  17. <input id="btn_select_all" name="btn_select_all" class="checkbox" type="checkbox" />
  18. <label for="btn_select_all">{$Think.lang.ds_select_all}</label>
  19. <span></span>
  20. </div>
  21. {notempty name="seller_menu"}
  22. {foreach name="seller_menu" item="value" key="key" }
  23. <div class="dssc-account-container">
  24. <h4>
  25. <input id="{$key}" class="checkbox" dstype="btn_select_module" type="checkbox" />
  26. <label for="{$key}">{$value.text}</label>
  27. </h4>
  28. {notempty name="$value.submenu"}
  29. <ul class="dssc-account-container-list">
  30. {foreach name="$value.submenu" item="submenu_value" }
  31. <li>
  32. <input id="{$submenu_value.controller}{if $submenu_value.action}.{$submenu_value.action}{/if}" class="checkbox" name="limits[]" value="{$submenu_value.controller}{if $submenu_value.action}.{$submenu_value.action}{/if}" <?php if(!empty($group_limits)) {if(in_array($submenu_value['controller'].($submenu_value['action']?('.'.$submenu_value['action']):''), $group_limits)) { echo 'checked'; }}?> type="checkbox" />
  33. <label for="{$submenu_value.controller}{if $submenu_value.action}.{$submenu_value.action}{/if}">{$submenu_value.text}</label>
  34. </li>
  35. {/foreach}
  36. </ul>
  37. {/notempty}
  38. </div>
  39. {/foreach}
  40. {/notempty}
  41. <p class="hint"></p>
  42. </dd>
  43. </dl>
  44. <dl>
  45. <dt><i class="required"></i>{$Think.lang.message_receiving_permissions}{$Think.lang.ds_colon}</dt>
  46. <dd>
  47. <div class="dssc-account-all">
  48. <input id="smt_select_all" class="checkbox" type="checkbox" />
  49. <label for="smt_select_all">{$Think.lang.ds_select_all}</label>
  50. </div>
  51. <div class="dssc-account-container">
  52. {notempty name="smt_list"}
  53. <ul class="dssc-account-container-list" style=" width: 99%; padding-left: 1%;">
  54. {foreach name="smt_list" item="val" }
  55. <li style=" width: 25%;">
  56. <input id="{$val.storemt_code}" class="checkbox" name="smt_limits[]" value="{$val.storemt_code}" {if !empty($smt_limits) && in_array($val['storemt_code'], $smt_limits)}checked{/if} type="checkbox" />
  57. <label for="{$val.storemt_code}">{$val.storemt_name}</label>
  58. </li>
  59. {/foreach}
  60. </ul>
  61. {/notempty}
  62. </div>
  63. <p class="hint">{$Think.lang.set_message_receiving_authority}</p>
  64. </dd>
  65. </dl>
  66. <div class="bottom">
  67. <input type="submit" class="submit" value="{$Think.lang.ds_submit}{$Think.lang.set}">
  68. </div>
  69. </form>
  70. </div>
  71. <script>
  72. $(document).ready(function(){
  73. $('#btn_select_all').on('click', function() {
  74. if($(this).prop('checked')) {
  75. $(this).parents('dd').find('input:checkbox').prop('checked', true);
  76. } else {
  77. $(this).parents('dd').find('input:checkbox').prop('checked', false);
  78. }
  79. });
  80. $('[dstype="btn_select_module"]').on('click', function() {
  81. if($(this).prop('checked')) {
  82. $(this).parents('.dssc-account-container').find('input:checkbox').prop('checked', true);
  83. } else {
  84. $(this).parents('.dssc-account-container').find('input:checkbox').prop('checked', false);
  85. }
  86. });
  87. $('#smt_select_all').on('click', function() {
  88. if($(this).prop('checked')) {
  89. $(this).parents('dl').find('input:checkbox').prop('checked', true);
  90. } else {
  91. $(this).parents('dl').find('input:checkbox').prop('checked', false);
  92. }
  93. });
  94. jQuery.validator.addMethod("function_check", function(value, element) {
  95. var count = $('#function_list').find('input:checkbox:checked').length;
  96. return count > 0;
  97. });
  98. $('#add_form').validate({
  99. errorPlacement: function(error, element){
  100. element.nextAll('span').first().after(error);
  101. },
  102. submitHandler:function(form){
  103. ds_ajaxpost('add_form', 'url', "{:url('Selleraccountgroup/group_list')}");
  104. },
  105. rules : {
  106. seller_group_name: {
  107. required: true,
  108. maxlength: 50
  109. },
  110. btn_select_all: {
  111. function_check: true
  112. }
  113. },
  114. messages: {
  115. seller_group_name: {
  116. required: '<i class="iconfont">&#xe64c;</i>{$Think.lang.group_name_cannot_empty}',
  117. maxlength: '<i class="iconfont">&#xe64c;</i>{$Think.lang.group_name_limit}'
  118. },
  119. btn_select_all: {
  120. function_check: '{$Think.lang.please_select_permission}'
  121. }
  122. }
  123. });
  124. // 商品相关权限关联选择
  125. $('#store_goods_add,#store_goods_online,#store_goods_offline').on('click', function() {
  126. if($(this).prop('checked')) {
  127. store_goods_select(true);
  128. } else {
  129. store_goods_select(false);
  130. }
  131. });
  132. function store_goods_select(state) {
  133. $('#store_goods_add').prop('checked', state);
  134. $('#store_goods_online').prop('checked', state);
  135. $('#store_goods_offline').prop('checked', state);
  136. }
  137. });
  138. </script>
  139. {/block}