setting.html 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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.ds_statgeneral}</h3>
  7. <h5></h5>
  8. </div>
  9. {include file="public/admin_items" /}
  10. </div>
  11. </div>
  12. <div class="explanation" id="explanation">
  13. <div class="title" id="checkZoom">
  14. <h4 title="{$Think.lang.ds_explanation_tip}">{$Think.lang.ds_explanation}</h4>
  15. <span id="explanationZoom" title="{$Think.lang.ds_explanation_close}" class="arrow"></span>
  16. </div>
  17. <ul>
  18. <li>{$Think.lang.statgeneral_setting_help1}</li>
  19. <li>{$Think.lang.statgeneral_setting_help2}</li>
  20. </ul>
  21. </div>
  22. <form method="post" name="pricerangeform" id="pricerangeform">
  23. <table id="pricerang_table" class="ds-default-table">
  24. <thead class="thead">
  25. <tr class="space">
  26. <th colspan='4'><a id="addrow" href="javascript:void(0);" class="btn btn-mini"><span>{$Think.lang.add_line}</span></a></th>
  27. </tr>
  28. <tr>
  29. <th>{$Think.lang.pricerange_start}</th>
  30. <th>{$Think.lang.pricerange_end}</th>
  31. <th>{$Think.lang.ds_handle}</th>
  32. </tr>
  33. </thead>
  34. <tbody>
  35. {notempty name="list_setting.stat_pricerange"}
  36. {foreach name="list_setting.stat_pricerange" item="v"}
  37. <tr id="row_{$key}">
  38. <td><input type="number" class="txt" value="{$v.s}" name="pricerange[{$key}][s]"></td>
  39. <td><input type="number" class="txt" value="{$v.e}" name="pricerange[{$key}][e]"></td>
  40. <td><a href="JavaScript:void(0);" onclick="delrow({$key});">{$Think.lang.ds_del}</a></td>
  41. </tr>
  42. {/foreach}
  43. {/notempty}
  44. </tbody>
  45. <tfoot>
  46. <tr class="tfoot">
  47. <td colspan="4" class="align-center"><a id="dssubmit" class="btn" href="JavaScript:void(0);"><span>{$Think.lang.ds_submit}</span></a></td>
  48. </tr>
  49. </tfoot>
  50. </table>
  51. </form>
  52. </div>
  53. <script type="text/javascript">
  54. function delrow(i){
  55. $("#row_"+i).remove();
  56. }
  57. $(function(){
  58. var i = {:count($list_setting.stat_pricerange)};
  59. i += 1;
  60. var html = '';
  61. /*新增一行*/
  62. $('#addrow').click(function(){
  63. html = '<tr id="row_'+i+'">';
  64. html += '<td><input type="number" class="txt" name="pricerange['+i+'][s]" value="0"/></td>';
  65. html += '<td><input type="number" class="txt" name="pricerange['+i+'][e]" value="0"/></td>';
  66. html += '<td><a href="JavaScript:void(0);" onclick="delrow('+i+');">{$Think.lang.ds_del}</a></td>';
  67. $('#pricerang_table').find('tbody').append(html);
  68. i += 1;
  69. });
  70. $('#dssubmit').click(function(){
  71. var result = true;
  72. $("#pricerang_table").find("[name^='pricerange']").each(function(){
  73. if(!$(this).val()){
  74. result = false;
  75. }
  76. });
  77. if(result){
  78. $('#pricerangeform').submit();
  79. } else {
  80. layer.alert('{$Think.lang.pricerange_required}');
  81. }
  82. });
  83. })
  84. </script>