add_card.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. {include file="public/header" /}
  2. <div class="page">
  3. <div class="explanation" id="explanation">
  4. <div class="title" id="checkZoom">
  5. <h4 title="{$Think.lang.ds_explanation_tip}">{$Think.lang.ds_explanation}</h4>
  6. <span id="explanationZoom" title="{$Think.lang.ds_explanation_close}" class="arrow"></span>
  7. </div>
  8. <ul>
  9. <li>{$Think.lang.rechargecard_add_card_help1}</li>
  10. <li>{$Think.lang.rechargecard_add_card_help2}</li>
  11. <li>{$Think.lang.rechargecard_add_card_help3}</li>
  12. <li>{$Think.lang.rechargecard_add_card_help4}</li>
  13. <li>{$Think.lang.rechargecard_add_card_help5}</li>
  14. <li>{$Think.lang.rechargecard_add_card_help6}</li>
  15. </ul>
  16. </div>
  17. <form method="post" enctype="multipart/form-data" name="form_add" id="form_add">
  18. <table class="ds-default-table">
  19. <tbody>
  20. <tr>
  21. <td colspan="2" class="required"><label class="validation">{$Think.lang.choose_publishing_mode}:</label></td>
  22. </tr>
  23. </tbody>
  24. <tbody>
  25. <tr class="noborder">
  26. <td colspan="2" class="required">
  27. <label class="switch-tab-title">
  28. <input type="radio" name="type" value="0" checked="checked" class="tabswitch" />
  29. {$Think.lang.choose_publishing_mode_0}
  30. </label>
  31. <label class="switch-tab-title">
  32. <input type="radio" name="type" value="1" class="tabswitch" />
  33. {$Think.lang.choose_publishing_mode_1}
  34. </label>
  35. <label class="switch-tab-title">
  36. <input type="radio" name="type" value="2" class="tabswitch" />
  37. {$Think.lang.choose_publishing_mode_2}
  38. </label>
  39. </td>
  40. </tr>
  41. <tr class="noborder tabswitch-target">
  42. <td class="vatop rowform">
  43. {$Think.lang.rechargecard_total}:
  44. <input type="text" class="txt" name="total" style="width:40px;" />
  45. {$Think.lang.rechargecard_prefix}:
  46. <input type="text" class="txt" name="prefix" style="width:100px;" />
  47. </td>
  48. <td class="vatop tips">{$Think.lang.rechargecard_total_tips}</td>
  49. </tr>
  50. <tr class="noborder tabswitch-target" style="display:none;">
  51. <td class="vatop rowform">
  52. <span class="type-file-box">
  53. <input type="text" name="textfile" id="textfile" class="type-file-text" />
  54. <input type="button" name="button" id="button" value="上传" class="type-file-button" />
  55. <input type="file" name="_textfile" class="type-file-file" size="30" hidefocus="true" onchange="$('#textfile').val(this.value);" />
  56. </span>
  57. </td>
  58. <td class="vatop tips">{$Think.lang.rechargecard_file_tips}</td>
  59. </tr>
  60. <tr class="noborder tabswitch-target" style="display:none;">
  61. <td class="vatop rowform">
  62. <textarea name="manual" style="width:300px;height:150px;"></textarea>
  63. </td>
  64. <td class="vatop tips">{$Think.lang.rechargecard_manual_tips}</td>
  65. </tr>
  66. </tbody>
  67. <tbody>
  68. <tr>
  69. <td colspan="2" class="required"><label class="validation">{$Think.lang.rechargecard_denomination}:</label></td>
  70. </tr>
  71. <tr class="noborder">
  72. <td class="vatop rowform"><input class="txt" type="text" name="denomination" style="width:150px;" /></td>
  73. <td class="vatop tips">{$Think.lang.rechargecard_denomination_tips}</td>
  74. </tr>
  75. <tr>
  76. <td colspan="2" class="required"><label>{$Think.lang.rechargecard_batchflag}:</label></td>
  77. </tr>
  78. <tr class="noborder">
  79. <td class="vatop rowform"><input class="txt" type="text" name="batchflag" /></td>
  80. <td class="vatop tips">{$Think.lang.rechargecard_batchflag_tips}</td>
  81. </tr>
  82. </tbody>
  83. <tfoot>
  84. <tr class="tfoot">
  85. <td colspan="2" ><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
  86. </tr>
  87. </tfoot>
  88. </table>
  89. </form>
  90. </div>
  91. <script type="text/javascript">
  92. $(function(){
  93. $('.tabswitch').click(function() {
  94. var i = parseInt(this.value);
  95. $('.tabswitch-target').hide().eq(i).show();
  96. });
  97. jQuery.validator.addMethod("r0total", function(value, element) {
  98. var v = parseInt(value);
  99. return $(":radio[name='type']:checked").val() != '0' || (value == v && v >= 1 && v <= 5000);
  100. }, "{$Think.lang.r0total_message}");
  101. jQuery.validator.addMethod("r0prefix", function(value, element) {
  102. return $(":radio[name='type']:checked").val() != '0' || this.optional(element) || /^[0-9a-zA-Z]{0,16}$/.test(value);
  103. }, "{$Think.lang.r0prefix_message}");
  104. jQuery.validator.addMethod("r1textfile", function(value, element) {
  105. return $(":radio[name='type']:checked").val() != '1' || value;
  106. }, "{$Think.lang.r1textfile_message}");
  107. jQuery.validator.addMethod("r2manual", function(value, element) {
  108. return $(":radio[name='type']:checked").val() != '2' || value;
  109. }, "{$Think.lang.r2manual_message}");
  110. $("#form_add").validate({
  111. errorPlacement: function(error, element){
  112. error.appendTo(element.parents('tbody').find('tr:first td:first'));
  113. },
  114. rules : {
  115. denomination : {
  116. required : true,
  117. min: 0.01,
  118. max: 1000
  119. },
  120. batchflag : {
  121. maxlength: 20
  122. },
  123. total : {
  124. r0total : true
  125. },
  126. prefix : {
  127. r0prefix : true
  128. },
  129. textfile : {
  130. r1textfile : true
  131. },
  132. manual : {
  133. r2manual : true
  134. }
  135. },
  136. messages : {
  137. denomination : {
  138. required : '{$Think.lang.rechargecard_denomination_required}',
  139. min : '{$Think.lang.rechargecard_denomination_min}',
  140. max: '{$Think.lang.rechargecard_denomination_max}'
  141. },
  142. batchflag : {
  143. maxlength: '{$Think.lang.rechargecard_batchflag_maxlength}'
  144. }
  145. }
  146. });
  147. });
  148. </script>