bind_class_add.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <style>
  2. #gcategory select {margin-left:4px}
  3. </style>
  4. <div class="dssc-form-default">
  5. <form method="post" action="{:url('Sellerinfo/bind_class_save')}" target="_parent" name="store_bind_class_form" id="store_bind_class_form">
  6. <input id="goods_class" name="goods_class" type="hidden" value="">
  7. <dl>
  8. <dt>{$Think.lang.choose_classification}{$Think.lang.ds_colon}</dt>
  9. <dd id="gcategory">
  10. <select id="gcategory_class1" style="width: auto;">
  11. <option value="0">{$Think.lang.ds_please_choose}</option>
  12. {notempty name="gc_list"}
  13. {foreach name="gc_list" item="gc"}
  14. <option value="{$gc.gc_id}" data-explain="{$gc.commis_rate}">{$gc.gc_name}</option>
  15. {/foreach}
  16. {/notempty}
  17. </select>
  18. <span>
  19. <label id="error_message" style="display: none" class="error" for="storenav_title"><i class="iconfont">&#xe64c;</i>{$Think.lang.choose_classification}</label>
  20. </span>
  21. </dd>
  22. </dl>
  23. <div class="bottom">
  24. <input type="button" id="btn_add_bind_class" class="submit" value="{$Think.lang.ds_submit}" />
  25. </div>
  26. </form>
  27. </div>
  28. <script src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js"></script>
  29. <script type="text/javascript">
  30. $(document).ready(function() {
  31. gcategoryInit("gcategory");
  32. //页面输入内容验证
  33. $('#btn_add_bind_class').on('click', function() {
  34. $('#error_message').hide();
  35. var category_id = '';
  36. var validation = true;
  37. $('#gcategory').find('select').each(function() {
  38. if (parseInt($(this).val(), 10) > 0) {
  39. category_id += $(this).val() + ',';
  40. } else {
  41. validation = false;
  42. }
  43. });
  44. if (!validation) {
  45. $('#error_message').show();
  46. return false;
  47. }
  48. $('#goods_class').val(category_id);
  49. var rate = $('#gcategory').find('select').last().find('option:selected').attr('data-explain') + '%';
  50. layer.confirm('{$Think.lang.percentage_commission_selected}' + rate + '{$Think.lang.confirm_application}', {
  51. btn: ['{$Think.lang.ds_ok}', '{$Think.lang.ds_cancel}'],
  52. title: false,
  53. }, function () {
  54. ds_ajaxpost('store_bind_class_form');
  55. });
  56. });
  57. });
  58. </script>