goods_class_edit.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. {include file="public/header" /}
  2. <div class="page">
  3. <div class="fixed-bar">
  4. <div class="item-title">
  5. <div class="subject">
  6. <h3>{$Think.lang.goods_class_index_class}</h3>
  7. </div>
  8. {include file="public/admin_items" /}
  9. </div>
  10. </div>
  11. <div class="explanation" id="explanation">
  12. <div class="title" id="checkZoom">
  13. <h4 title="{$Think.lang.ds_explanation_tip}">{$Think.lang.ds_explanation}</h4>
  14. <span id="explanationZoom" title="{$Think.lang.ds_explanation_close}" class="arrow"></span>
  15. </div>
  16. <ul>
  17. <li>{$Think.lang.goods_class_edit_prompts_one}</li>
  18. <li>{$Think.lang.goods_class_edit_prompts_two}</li>
  19. </ul>
  20. </div>
  21. <form id="goods_class_form" name="goodsClassForm" enctype="multipart/form-data" method="post">
  22. <input type="hidden" name="gc_id" value="{$class_array.gc_id}" />
  23. <input type="hidden" name="gc_parent_id" id="gc_parent_id" value="{$class_array.gc_parent_id}" />
  24. <input type="hidden" name="old_type_id" value="{$class_array.type_id}">
  25. <table class="ds-default-table">
  26. <tbody>
  27. <tr class="noborder">
  28. <td colspan="2" class="required"><label class="gc_name validation" for="gc_name">{$Think.lang.goods_class_index_name}:</label></td>
  29. </tr>
  30. <tr class="noborder">
  31. <td class="vatop rowform"><input type="text" maxlength="20" value="{$class_array.gc_name}" name="gc_name" id="gc_name" class="txt"></td>
  32. <td class="vatop tips"></td>
  33. </tr>
  34. <tr>
  35. <td colspan="2" class="required"><label for="parent_id">{$Think.lang.goods_class_add_sup_class}:</label></td>
  36. </tr>
  37. <tr class="noborder">
  38. <td class="vatop rowform"><select name="gc_parent_id" id="gc_parent_id">
  39. <option value="{$class_array.gc_parent_id}">{$Think.lang.gc_parent_id_selected}</option>
  40. {notempty name="parent_list"}
  41. {foreach name="parent_list" item="v" key="k" }
  42. <option {if $class_array.gc_parent_id == $v.gc_id}selected='selected'{/if} value="{$v.gc_id}">{$v.gc_name|raw}</option>
  43. {/foreach}
  44. {/notempty}
  45. </select></td>
  46. <td class="vatop tips"><span style="color:#ff0000">{$Think.lang.goods_class_edit_sup_class_notice}</span> {$Think.lang.goods_class_add_sup_class_notice}</td>
  47. </tr>
  48. <tr>
  49. <td colspan="2" class="required"><label for="pic">{$Think.lang.goods_class_pic}:</label></td>
  50. </tr>
  51. <tr class="noborder">
  52. <td class="vatop rowform">
  53. {notempty name="$class_array.pic"}
  54. <span class="type-file-show"><img class="show_image" src="{$Think.ADMIN_SITE_ROOT}/images/preview.png">
  55. <div class="type-file-preview"><img src="{$class_array.pic}"></div>
  56. </span>
  57. {/notempty}
  58. <span class="type-file-box">
  59. <input type='text' name='textfield' id='textfield1' class='type-file-text' />
  60. <input type='button' name='button' id='button1' value='上传' class='type-file-button' />
  61. <input name="pic" type="file" class="type-file-file" id="pic" size="30" hidefocus="true" ds_type="change_pic">
  62. </span>
  63. </td>
  64. <td class="vatop tips">{$Think.lang.goods_class_pic_tips}</td>
  65. </tr>
  66. <tr>
  67. <td colspan="2" class="required"><label>{$Think.lang.gc_virtual}:</label>
  68. <span>
  69. <label for="t_gc_virtual"><input id="t_gc_virtual" type="checkbox" class="checkbox" checked="checked" value="1" name="t_gc_virtual">{$Think.lang.goods_class_edit_related_to_subclass}</label>
  70. </span>
  71. </td>
  72. </tr>
  73. <tr class="noborder">
  74. <td class="vatop rowform"><label><input type="checkbox" name="gc_virtual" id="gc_virtual" value="1" {if $class_array.gc_virtual == 1}checked{/if}>{$Think.lang.ds_allow}</label></td>
  75. <td class="vatop tips">{$Think.lang.gc_virtual_tips}</td>
  76. </tr>
  77. <tr>
  78. <td colspan="2" class="required"><label class="validation">{$Think.lang.commis_rate}:</label>
  79. <span>
  80. <label for="t_commis_rate"><input id="t_commis_rate" class="checkbox" type="checkbox" checked="checked" value="1" name="t_commis_rate">{$Think.lang.goods_class_edit_related_to_subclass}</label>
  81. </span></td>
  82. </tr>
  83. <tr class="noborder">
  84. <td class="vatop rowform"><input id="commis_rate" class="w60" type="text" value="{$class_array.commis_rate}" name="commis_rate">
  85. % </td>
  86. <td class="vatop tips">{$Think.lang.commis_rate_tips}</td>
  87. </tr>
  88. <tr>
  89. <td colspan="2" class="required"><label class="validation">{$Think.lang.goods_class_add_type}:</label>
  90. <span>
  91. <label for="t_associated">
  92. <input class="checkbox" type="checkbox" name="t_associated" value="1" checked="checked" id="t_associated" />
  93. {$Think.lang.goods_class_edit_related_to_subclass}</label>
  94. </span>
  95. </td>
  96. </tr>
  97. <tr class="noborder">
  98. <td colspan="2" id="gcategory">
  99. <select class="class-select">
  100. <option value="0">{$Think.lang.ds_please_choose}...</option>
  101. {notempty name="gc_list"}
  102. {foreach name="gc_list" item="v" key="k" }
  103. {if $v.gc_parent_id == 0}
  104. <option value="{$v.gc_id}">{$v.gc_name}</option>
  105. {/if}
  106. {/foreach}
  107. {/notempty}
  108. </select>
  109. {$Think.lang.ds_quickly_targeted}
  110. </td>
  111. </tr>
  112. <tr class="noborder">
  113. <td class="vatop rowform"><input type="hidden" name="t_name" id="t_name" value="{$class_array.type_name}" />
  114. <input type="hidden" name="t_sign" id="t_sign" value="" />
  115. <div id="type_div" class="goods-sort-type">
  116. <div class="container">
  117. <dl>
  118. <dd>
  119. <input type="radio" name="t_id" value="0" {if $class_array.type_id}checked="checked"{/if} />{$Think.lang.goods_class_null_type}
  120. </dd>
  121. </dl>
  122. {notempty name="type_list"}
  123. {foreach name="type_list" item="val" key="k" }
  124. {notempty name="$val.type"}
  125. <dl>
  126. <dt id="type_dt_{$k}">{$val.name}</dt>
  127. {foreach name="$val.type" item="v" }
  128. <dd><input type="radio" class="radio" name="t_id" value="{$v.type_id}" {if $class_array.type_id == $v.type_id}checked="checked"{/if} /><span>{$v.type_name}</span></dd>
  129. {/foreach}
  130. </dl>
  131. {/notempty}
  132. {/foreach}
  133. {/notempty}
  134. </div>
  135. </div></td>
  136. <td class="vatop tips">{$Think.lang.goods_class_add_type_desc_one}<a onclick="window.parent.openItem('index,type,goods')" href="JavaScript:void(0);">{$Think.lang.ds_type}</a>{$Think.lang.goods_class_add_type_desc_two}</td>
  137. </tr>
  138. <tr>
  139. <td colspan="2" class="required"><label for="gc_sort">{$Think.lang.ds_sort}:</label></td>
  140. </tr>
  141. <tr class="noborder">
  142. <td class="vatop rowform"><input type="text" value="{if $class_array.gc_sort == ''}0{else/}{$class_array.gc_sort}{/if}" name="gc_sort" id="gc_sort" class="txt"></td>
  143. <td class="vatop tips">{$Think.lang.goods_class_add_update_sort}</td>
  144. </tr>
  145. </tbody>
  146. <tfoot>
  147. <tr class="tfoot">
  148. <td colspan="15" ><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
  149. </tr>
  150. </tfoot>
  151. </table>
  152. </form>
  153. </div>
  154. <script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js" charset="utf-8"></script>
  155. <script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/jquery.mousewheel.js"></script>
  156. <script>
  157. $(function() {
  158. $("#pic").change(function() {
  159. $("#textfield1").val($(this).val());
  160. });
  161. $('input[type="radio"][name="t_id"]').change(function() {
  162. // 标记类型时候修改 修改为ok
  163. var t_id = {$class_array.type_id};
  164. if (t_id != $(this).val()) {
  165. $('#t_sign').val('ok');
  166. } else {
  167. $('#t_sign').val('');
  168. }
  169. if ($(this).val() == '0') {
  170. $('#t_name').val('');
  171. } else {
  172. $('#t_name').val($(this).next('span').html());
  173. }
  174. });
  175. $('#goods_class_form').validate({
  176. errorPlacement: function(error, element) {
  177. error.appendTo(element.parent().parent().prev().find('td:first'));
  178. },
  179. rules: {
  180. gc_name: {
  181. required: true,
  182. remote: {
  183. url: "{:url('Goodsclass/ajax',['branch'=>'check_class_name'])}",
  184. type: 'get',
  185. data: {
  186. gc_name: function() {
  187. return $('#gc_name').val();
  188. },
  189. gc_parent_id: function() {
  190. return $('#gc_parent_id').val();
  191. },
  192. gc_id: '{$class_array.gc_id}'
  193. }
  194. }
  195. },
  196. commis_rate: {
  197. required: true,
  198. max: 100,
  199. min: 0,
  200. digits: true
  201. },
  202. gc_sort: {
  203. number: true
  204. }
  205. },
  206. messages: {
  207. gc_name: {
  208. required: '{$Think.lang.goods_class_add_name_null}',
  209. remote: '{$Think.lang.goods_class_add_name_exists}'
  210. },
  211. commis_rate: {
  212. required: '{$Think.lang.goods_class_add_commis_rate_error}',
  213. max: '{$Think.lang.goods_class_add_commis_rate_error}',
  214. min: '{$Think.lang.goods_class_add_commis_rate_error}',
  215. digits: '{$Think.lang.goods_class_add_commis_rate_error}'
  216. },
  217. gc_sort: {
  218. number: '{$Think.lang.goods_class_add_sort_int}'
  219. }
  220. }
  221. });
  222. // 类型搜索
  223. $(document).off('change',"#gcategory > select").on("change","#gcategory > select", function() {
  224. type_scroll($(this));
  225. });
  226. });
  227. var typeScroll = 0;
  228. function type_scroll(o) {
  229. var id = o.val();
  230. if (!$('#type_dt_' + id).is('dt')) {
  231. return false;
  232. }
  233. $('#type_div').scrollTop(-typeScroll);
  234. var sp_top = $('#type_dt_' + id).offset().top;
  235. var div_top = $('#type_div').offset().top;
  236. $('#type_div').scrollTop(sp_top - div_top);
  237. typeScroll = sp_top - div_top;
  238. }
  239. gcategoryInit('gcategory');
  240. </script>