pricesetting.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. {extend name="default/base/base_seller" /}
  2. {block name="seller_main"}
  3. <div class="alert mt10" style="clear:both;">
  4. <ul class="mt5">
  5. <li>{$Think.lang.set_order_amount_range}</li>
  6. <li>{$Think.lang.set_price_range_recommended}</li>
  7. </ul>
  8. </div>
  9. <form id="pricerangeform" method="post" target="_self" onsubmit="return checksubmit();">
  10. <table id="pricerang_table" class="dssc-default-table">
  11. <thead>
  12. <tr>
  13. <th class="tl" style="padding-left:10px;">{$Think.lang.starting_forehead}</th>
  14. <th class="tl">{$Think.lang.finish_forehead}</th>
  15. <th class="w120">{$Think.lang.ds_handle}</th>
  16. </tr>
  17. <tr>
  18. <td colspan="20">
  19. <a id="addrow" href="javascript:void(0);" class="dssc-btn-mini"><span>{$Think.lang.add_line}</span></a>
  20. </td>
  21. </tr>
  22. </thead>
  23. <tbody>
  24. {notempty name="pricerange"}
  25. {foreach name="pricerange" item="v"}
  26. <tr id="row_{$key}">
  27. <td class="tl">
  28. <input type="text" class="txt" value="{$v.s}" name="pricerange[{$key}][s]">
  29. </td>
  30. <td class="tl">
  31. <input type="text" class="txt" value="{$v.e}" name="pricerange[{$key}][e]">
  32. </td>
  33. <td class="dscs-table-handle">
  34. <span>
  35. <a class="btn-red" href="JavaScript:void(0);" onclick="delrow({$key});">
  36. <i class="iconfont">&#xe725;</i>
  37. <p>{$Think.lang.ds_del}</p>
  38. </a>
  39. </span>
  40. </td>
  41. </tr>
  42. {/foreach}
  43. {else /}
  44. <tr id="row_0">
  45. <td class="tl">
  46. <input type="text" class="txt" value="0" name="pricerange[0][s]">
  47. </td>
  48. <td class="tl">
  49. <input type="text" class="txt" value="0" name="pricerange[0][e]">
  50. </td>
  51. <td class="dscs-table-handle">
  52. <span>
  53. <a class="btn-red" href="JavaScript:void(0);" onclick="delrow(0);">
  54. <i class="iconfont">&#xe725;</i>
  55. <p>{$Think.lang.ds_del}</p>
  56. </a>
  57. </span>
  58. </td>
  59. </tr>
  60. {/notempty}
  61. </tbody>
  62. <tfoot>
  63. <tr class="tfoot">
  64. <td colspan="4" class="align-center">
  65. <div class="bottom">
  66. <input type="submit" value="{$Think.lang.ds_submit}" class="submit">
  67. </div>
  68. </td>
  69. </tr>
  70. </tfoot>
  71. </table>
  72. </form>
  73. <script type="text/javascript">
  74. function delrow(i){
  75. $("#row_"+i).remove();
  76. }
  77. function checksubmit(){
  78. var result = true;
  79. $("#pricerang_table").find("[name^='pricerange']").each(function(){
  80. if(!$(this).val()){
  81. result = false;
  82. }
  83. });
  84. if(!result){
  85. layer.alert('{$Think.lang.please_complete_price_range}');
  86. }
  87. return result;
  88. }
  89. $(function(){
  90. var i = {:count($pricerange)};
  91. i += 1;
  92. var html = '';
  93. /*新增一行*/
  94. $('#addrow').click(function(){
  95. html = '<tr id="row_'+i+'">';
  96. html += '<td class="tl"><input type="text" name="pricerange['+i+'][s]" value=""/></td>';
  97. html += '<td class="tl"><input type="text" name="pricerange['+i+'][e]" value=""/></td>';
  98. html += '<td class="dscs-table-handle"><span><a class="btn-red" href="JavaScript:void(0);" onclick="delrow('+i+');"><i class="iconfont">&#xe725;</i><p>{$Think.lang.ds_del}</p></a></span></td>';
  99. $('#pricerang_table').find('tbody').append(html);
  100. i += 1;
  101. });
  102. });
  103. </script>
  104. {/block}