spec_add.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <link rel="stylesheet" href="{$Think.HOME_SITE_ROOT}/css/common.css">
  6. <link rel="stylesheet" href="{$Think.HOME_SITE_ROOT}/css/seller.css">
  7. <link href="{$Think.PLUGINS_SITE_ROOT}/colorpicker/evol.colorpicker.css" rel="stylesheet" type="text/css">
  8. <style type="text/css">
  9. body{background-color: transparent;}
  10. .evo-colorind, .evo-colorind-ie, .evo-colorind-ff{width: 21px;height: 28px;border: solid #CCC;border-width: 1px 1px 1px 0;float: right;}
  11. .iframe-box{width: 100%;max-height: 550px;overflow: hidden;position: relative;}
  12. .iframe-content{width: 100%;}
  13. </style>
  14. </head>
  15. <body>
  16. <div id="append_parent"></div>
  17. <div id="ajaxwaitid"></div>
  18. <form id="spec_form" method="post" action="{:url('Sellerspec/save_spec')}">
  19. <input type="hidden" name="sp_id" value="{$sp_info.sp_id}" />
  20. <input type="hidden" name="gc_id" value="{$gc_info.gc_id}" />
  21. <div class="dssc-spec-info" style=" width: 960px;"><span>{$Think.lang.specification_name}:{$sp_info.sp_name}</span><span>{$Think.lang.belong_classification}:{$gc_info.gc_name}</span><a href="javascript:void(0);" dstype="add_sv" class="dssc-btn"><i class="iconfont">&#xe600;</i>{$Think.lang.add_specification_value}</a></div>
  22. <table class="dssc-default-table" style="width: 960px;">
  23. <thead>
  24. <tr>
  25. <th class="w80">{$Think.lang.ds_sort}</th>
  26. <th class="tl">{$Think.lang.specification_value_name}</th>
  27. {if $sp_info.sp_id== $Think.DEFAULT_SPEC_COLOR_ID}
  28. <th class="w300 tl">{$Think.lang.color_block}</th>
  29. {/if}
  30. <th class="w110">{$Think.lang.ds_handle}</th>
  31. </tr>
  32. </thead>
  33. </table>
  34. <div id="iframe" class="iframe-box" style=" width: 960px;">
  35. <div class="iframe-content">
  36. <table class="dssc-default-table">
  37. <tbody dstype="spec_tbody">
  38. {notempty name="sp_value_list"}
  39. {foreach name="sp_value_list" item="value"}
  40. <tr class="bd-line">
  41. <td class="w80"><input type="text" class="text w40" name="sv[old][{$value.spvalue_id}][sort]" value="{$value.spvalue_sort}" /></td>
  42. <td class="tl"><input type="text" class="text w250" name="sv[old][{$value.spvalue_id}][name]" value="{$value.spvalue_name}" /></td>
  43. {if $sp_info.sp_id == $Think.DEFAULT_SPEC_COLOR_ID}
  44. <td class="w300 tl"><input type="text" class="text w100" name="sv[old][{$value.spvalue_id}][color]" value="{$value.spvalue_color}" dstype="spec_color" /></td>
  45. {/if}
  46. <td class="w110 dscs-table-handle"><span><a href="javascript:void(0);" class="btn-red" dstype="spec_del" data-param="{id:{$value.spvalue_id}}"><i class="iconfont">&#xe725;</i>
  47. <p>{$Think.lang.ds_del}</p>
  48. </a></span></td>
  49. </tr>
  50. {/foreach}
  51. {else /}
  52. <tr class="bd-line">
  53. <td class="w80"><input type="text" class="text w40" name="sv[new][1][sort]" value="0" /></td>
  54. <td class="tl"><input type="text" class="text w250" name="sv[new][1][name]" /></td>
  55. {if $sp_info.sp_id == $Think.DEFAULT_SPEC_COLOR_ID}
  56. <td class="w300 tl"><input type="text" class="text w100" name="sv[new][1][color]" dstype="spec_color" /></td>
  57. {/if}
  58. <td class="w110 dscs-table-handle"><span><a href="javascript:void(0);" class="btn-orange" dstype="tr_remove"><i class="iconfont">&#xe658;</i>
  59. <p>{$Think.lang.remove}</p>
  60. </a></span></td>
  61. </tr>
  62. {/notempty}
  63. </tbody>
  64. <tfoot>
  65. <tr>
  66. <td colspan="20" class="bottom"><a href="javascript:void(0);" dstype="submit-btn" class="submit mt20">{$Think.lang.submit_save_specification_values}</a></td></tr><tr>
  67. <td colspan="20" class="h200"></td>
  68. </tr>
  69. </tfoot>
  70. </table>
  71. </div>
  72. </div>
  73. </form>
  74. </body>
  75. </html>
  76. <script>
  77. var BASESITEROOT = "{$Think.BASE_SITE_ROOT}";
  78. var HOMESITEROOT = "{$Think.HOME_SITE_ROOT}";
  79. var BASESITEURL = "{$Think.BASE_SITE_URL}";
  80. var HOMESITEURL = "{$Think.HOME_SITE_URL}";
  81. </script>
  82. <script src="{$Think.PLUGINS_SITE_ROOT}/jquery-2.1.4.min.js"></script>
  83. <script src="{$Think.PLUGINS_SITE_ROOT}/layer/layer.js"></script>
  84. <script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui/jquery-ui.min.js"></script>
  85. <script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui/jquery.ui.datepicker-zh-CN.js"></script>
  86. <script src="{$Think.PLUGINS_SITE_ROOT}/jquery.validate.min.js"></script>
  87. <script src="{$Think.PLUGINS_SITE_ROOT}/common.js"></script>
  88. <script src="{$Think.HOME_SITE_ROOT}/js/member.js"></script>
  89. <script src="{$Think.PLUGINS_SITE_ROOT}/js/dialog/dialog.js" id="dialog_js" charset="utf-8"></script>
  90. <script src="{$Think.PLUGINS_SITE_ROOT}/colorpicker/evol.colorpicker.min.js"></script>
  91. <script src="{$Think.PLUGINS_SITE_ROOT}/perfect-scrollbar.min.js"></script>
  92. <script>
  93. $(function(){
  94. // 提交表单
  95. $('a[dstype="submit-btn"]').click(function(){
  96. var _submit = true;
  97. $('#spec_form').find('input[name$="[name]"]').each(function(){
  98. if ($(this).val() == '') {
  99. _submit = false;
  100. if (!$(this).hasClass('error')) {
  101. $(this).addClass('error').parents('td:first').append('<label class="error"><i class="iconfont">&#xe64c;</i>{$Think.lang.please_fill_content}</label>');
  102. }
  103. }
  104. });
  105. if (_submit) {
  106. ds_ajaxpost('spec_form');
  107. }
  108. });
  109. // 颜色选择器
  110. $('input[dstype="spec_color"]').colorpicker({showOn:'both'}).removeAttr('dstype');
  111. // 移除
  112. $('a[dstype="tr_remove"]').click(function(){
  113. $(this).parents('tr:first').remove();
  114. });
  115. // 删除
  116. $('a[dstype="spec_del"]').click(function(){
  117. var $this = $(this);
  118. eval('data_str = ' + $this.attr('data-param'));
  119. $.getJSON("{:url('Sellerspec/ajax_delspec')}"+'?id='+data_str.id, function(data){
  120. if(data){
  121. $this.parents('tr:first').remove();
  122. }
  123. });
  124. });
  125. // 添加规格值
  126. var i = 2; // 自增,防止冲突
  127. $('a[dstype="add_sv"]').click(function(){
  128. var _tr = $('<tr class="bd-line"></tr>');
  129. $('<td class="w80"><input type="text" class="text w40" name="sv[new]['+ i +'][sort]" value="0" /></td>').appendTo(_tr); // 排序
  130. $('<td class="tl"><input type="text" class="text w250" name="sv[new]['+ i +'][name]" /></td>').appendTo(_tr); // 规格名称
  131. {if $sp_info.sp_id == $Think.DEFAULT_SPEC_COLOR_ID}
  132. $('<td class="w300 tl"><input type="text" class="text w100" name="sv[new]['+ i +'][color]" dstype="spec_color" /></td>').appendTo(_tr); // 颜色色块
  133. {/if}
  134. $('<td class="w110 dscs-table-handle"><span><a href="javascript:void(0);" class="btn-orange"><i class="iconfont">&#xe658;</i><p>{$Think.lang.remove}</p></a</span></td>').find('a').click(function(){
  135. $(this).parents('tr:first').remove();
  136. }).end().appendTo(_tr); // 操作
  137. _tr.appendTo('tbody[dstype="spec_tbody"]');
  138. // 颜色选择器
  139. $('tbody[dstype="spec_tbody"]').find('input[dstype="spec_color"]').colorpicker({showOn:'both'}).removeAttr('dstype');
  140. i++;
  141. });
  142. });
  143. //超出父级页面iframe设定高度时滚动条
  144. $(document).ready(function() {
  145. $('#iframe').perfectScrollbar();
  146. });
  147. </script>