store_bind_class.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php defined('InShopNC') or exit('Access Invalid!');?>
  2. <div class="page">
  3. <div class="fixed-bar">
  4. <div class="item-title">
  5. <h3><?php echo $lang['store'];?></h3>
  6. <ul class="tab-base">
  7. <li><a href="index.php?act=store&op=store" ><span><?php echo $lang['manage'];?></span></a></li>
  8. <li><a href="index.php?act=store&op=store_joinin"><span><?php echo $lang['pending'];?></span></a></li>
  9. <li><a href="index.php?act=store&op=reopen_list" ><span>续签申请</span></a></li>
  10. <li><a href="index.php?act=store&op=store_bind_class_applay_list" ><span>经营类目申请</span></a></li>
  11. <li><a href="JavaScript:void(0);" class="current"><span>编辑经营类目</span></a></li>
  12. </ul>
  13. </div>
  14. </div>
  15. <div class="fixed-empty"></div>
  16. <table class="table tb-type2" id="prompt">
  17. <tbody>
  18. <tr class="space odd">
  19. <th colspan="12"><div class="title">
  20. <h5><?php echo $lang['nc_prompts'];?></h5>
  21. <span class="arrow"></span></div>
  22. </th>
  23. </tr>
  24. <tr>
  25. <td><ul>
  26. <li>删除店铺的经营类目会造成相应商品下架,请谨慎操作</li>
  27. <li>所有修改即时生效</li>
  28. </ul></td>
  29. </tr>
  30. </tbody>
  31. </table>
  32. <table class="table tb-type2">
  33. <thead class="thead">
  34. <tr class="space">
  35. <th colspan="15">店铺名称:<?php echo $output['store_info']['store_name'];?></th>
  36. </tr>
  37. </thead>
  38. <thead>
  39. <tr class="thead">
  40. <th>分类1</th>
  41. <th>分类2</th>
  42. <th>分类3</th>
  43. <th>分佣比例</th>
  44. <th class="align-center"><?php echo $lang['nc_handle'];?></th>
  45. </tr>
  46. </thead>
  47. <tbody>
  48. <?php if(!empty($output['store_bind_class_list']) && is_array($output['store_bind_class_list'])){ ?>
  49. <?php foreach($output['store_bind_class_list'] as $key => $value){ ?>
  50. <tr class="hover edit">
  51. <td class="w25pre"><?php echo $value['class_1_name'];?></td>
  52. <td class="w25pre"><?php echo $value['class_2_name'];?></td>
  53. <td class="w25pre"><?php echo $value['class_3_name'];?></td>
  54. <td class="sort"><span nc_type="commis_rate" column_id="<?php echo $value['bid'];?>" title="<?php echo $lang['nc_editable'];?>" class="editable " style="vertical-align: middle; margin-right: 4px;"><?php echo $value['commis_rate'];?></span>% </td>
  55. <td class="w60 align-center"><a nctype="btn_del_store_bind_class" href="javascript:;" data-bid="<?php echo $value['bid'];?>">删除</a></td>
  56. </tr>
  57. <?php } ?>
  58. <?php }else { ?>
  59. <tr class="no_data">
  60. <td colspan="10"><?php echo $lang['nc_no_record'];?></td>
  61. </tr>
  62. <?php } ?>
  63. </tbody>
  64. </table>
  65. <table class="table tb-type2" >
  66. <thead class="thead">
  67. <tr class="space">
  68. <th colspan="15"><span>添加经营类目</span></th>
  69. </tr>
  70. </thead>
  71. <tbody>
  72. <tr class="noborder">
  73. <td class="required" colspan="2" >选择分类:</td>
  74. </tr>
  75. <tr class="noborder">
  76. <td colspan="2" id="gcategory" class="vatop rowform"><select id="gcategory_class1" style="width: auto;">
  77. <option value="0">全部分类</option>
  78. <?php if(!empty($output['gc_list']) && is_array($output['gc_list']) ) {?>
  79. <?php foreach ($output['gc_list'] as $gc) {?>
  80. <option value="<?php echo $gc['gc_id'];?>" data-explain="<?php echo $gc['commis_rate']; ?>"><?php echo $gc['gc_name'];?></option>
  81. <?php }?>
  82. <?php }?>
  83. </select><span id="error_message" style="color:red;"></span></td>
  84. </tr>
  85. <tr>
  86. <td class="required" colspan="2" >分佣比例(必须为0-100的整数):</td>
  87. </tr>
  88. <tr class="noborder">
  89. <td class="vatop rowform"><form id="add_form" action="<?php echo urlAdmin('store', 'store_bind_class_add');?>" method="post">
  90. <input name="store_id" type="hidden" value="<?php echo $output['store_info']['store_id'];?>">
  91. <input id="goods_class" name="goods_class" type="hidden" value="">
  92. <input id="commis_rate" name="commis_rate" class="w60" type="text" value="" />
  93. % <span id="error_message1" style="color:red;"></span>
  94. </form></td>
  95. <td class="vatop tips"></td>
  96. </tr>
  97. </tbody>
  98. <tfoot>
  99. <tr>
  100. <td colspan="2"><a id="btn_add_category" class="btn" href="JavaScript:void(0);" /><span>确认</span></a></td>
  101. </tr>
  102. </tfoot>
  103. </table>
  104. </div>
  105. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/jquery.edit.js" charset="utf-8"></script>
  106. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/common_select.js" charset="utf-8"></script>
  107. <script type="text/javascript">
  108. $(document).ready(function(){
  109. gcategoryInit("gcategory");
  110. // 提交新添加的类目
  111. $('#btn_add_category').on('click', function() {
  112. $('#error_message').hide();
  113. $('#error_message1').hide();
  114. var category_id = '';
  115. var validation = true;
  116. $('#gcategory').find('select').each(function() {
  117. if(parseInt($(this).val(), 10) > 0) {
  118. category_id += $(this).val() + ',';
  119. } else {
  120. validation = false;
  121. }
  122. });
  123. /*if(!validation) {
  124. $('#error_message').text('请选择分类');
  125. $('#error_message').show();
  126. return false;
  127. }*/
  128. var commis_rate = parseInt($('#commis_rate').val(), 10);
  129. if(isNaN(commis_rate) || commis_rate < 0 || commis_rate > 100) {
  130. $('#error_message1').text('请填写正确的分佣比例');
  131. $('#error_message1').show();
  132. return false;
  133. }
  134. $('#goods_class').val(category_id);
  135. $('#add_form').submit();
  136. });
  137. $('#gcategory select').live('change', function() {
  138. var cr = $(this).children(':selected').attr('data-explain');
  139. $('#commis_rate').val(parseInt(cr) || '');
  140. });
  141. // 删除现有类目
  142. $('[nctype="btn_del_store_bind_class"]').on('click', function() {
  143. if(confirm('确认删除?删除后店铺对应分类商品将全部下架')) {
  144. var bid = $(this).attr('data-bid');
  145. $this = $(this);
  146. $.post('<?php echo urlAdmin('store', 'store_bind_class_del');?>', {bid: bid}, function(data) {
  147. if(data.result) {
  148. $this.parents('tr').hide();
  149. } else {
  150. showError(data.message);
  151. }
  152. }, 'json');
  153. }
  154. });
  155. // 修改分佣比例
  156. $('span[nc_type="commis_rate"]').inline_edit({act: 'store',op: 'store_bind_class_update'});
  157. });
  158. </script>