rechargecard.add_card.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?php defined('InShopNC') or exit('Access Invalid!');?>
  2. <style>
  3. .switch-tab-title {font-size:14px; margin-right:15px; }
  4. </style>
  5. <div class="page">
  6. <div class="fixed-bar">
  7. <div class="item-title">
  8. <h3>平台充值卡</h3>
  9. <ul class="tab-base">
  10. <li><a href="<?php echo urlAdmin('rechargecard', 'index'); ?>"><span>列表</span></a></li>
  11. <li><a href="javascript:void(0);" class="current"><span>新增</span></a></li>
  12. </ul>
  13. </div>
  14. </div>
  15. <div class="fixed-empty"></div>
  16. <table class="table tb-type2" id="prompt">
  17. <tbody>
  18. <tr class="space odd">
  19. <th colspan="12"><div class="title"><h5><?php echo $lang['nc_prompts'];?></h5><span class="arrow"></span></div></th>
  20. </tr>
  21. <tr>
  22. <td>
  23. <ul>
  24. <li>平台发布充值卡有3种方式:</li>
  25. <li>1. 输入总数,以及可选输入的卡号前缀,由系统自动生成指定总数、前缀的充值卡卡号(系统自动生成部分长度为32);</li>
  26. <li>2. 上传文本文件导入充值卡卡号,文件中每行为一个卡号。</li>
  27. <li>3. 在文本框中手动输入多个充值卡卡号,每行为一个卡号;</li>
  28. <li>充值卡卡号为50位之内的字母数字组合;可以设置本批次添加卡号的批次标识,方便检索。</li>
  29. <li>如新增的充值卡卡号与已有的卡号冲突,则系统自动忽略它们。</li>
  30. </ul>
  31. </td>
  32. </tr>
  33. </tbody>
  34. </table>
  35. <form method="post" enctype="multipart/form-data" name="form_add" id="form_add">
  36. <input type="hidden" name="form_submit" value="ok" />
  37. <table class="table tb-type2">
  38. <tbody>
  39. <tr>
  40. <td colspan="2" class="required"><label class="validation">请选择发布方式:</label></td>
  41. </tr>
  42. </tbody>
  43. <tbody>
  44. <tr class="noborder">
  45. <td colspan="2" class="required">
  46. <label class="switch-tab-title">
  47. <input type="radio" name="type" value="0" checked="checked" class="tabswitch" />
  48. 输入总数,自动生成
  49. </label>
  50. <label class="switch-tab-title">
  51. <input type="radio" name="type" value="1" class="tabswitch" />
  52. 上传文件,导入卡号
  53. </label>
  54. <label class="switch-tab-title">
  55. <input type="radio" name="type" value="2" class="tabswitch" />
  56. 手动输入,每行一号
  57. </label>
  58. </td>
  59. </tr>
  60. <tr class="noborder tabswitch-target">
  61. <td class="vatop rowform">
  62. 总数:
  63. <input type="text" class="txt" name="total" style="width:40px;" />
  64. 前缀:
  65. <input type="text" class="txt" name="prefix" style="width:130px;" />
  66. </td>
  67. <td class="vatop tips">请输入总数,总数为1~9999之间的整数;可以输入随机生成卡号的统一前缀,16字之内字母数字的组合</td>
  68. </tr>
  69. <tr class="noborder tabswitch-target" style="display:none;">
  70. <td class="vatop rowform">
  71. <span class="type-file-box">
  72. <input type="text" name="textfile" id="textfile" class="type-file-text" />
  73. <input type="button" name="button" id="button" value="" class="type-file-button" />
  74. <input type="file" name="_textfile" class="type-file-file" size="30" hidefocus="true" onchange="$('#textfile').val(this.value);" />
  75. </span>
  76. </td>
  77. <td class="vatop tips">请上传卡号文件,文件为纯文本格式,每行一个卡号;卡号为字母数字组合,限制50字之内;不合法卡号将被自动过滤</td>
  78. </tr>
  79. <tr class="noborder tabswitch-target" style="display:none;">
  80. <td class="vatop rowform">
  81. <textarea name="manual" style="width:300px;height:150px;"></textarea>
  82. </td>
  83. <td class="vatop tips">请输入卡号,每行一个卡号;卡号为字母数字组合,限制50字之内;不合法卡号将被自动过滤</td>
  84. </tr>
  85. </tbody>
  86. <tbody>
  87. <tr>
  88. <td colspan="2" class="required"><label class="validation">面额(元):</label></td>
  89. </tr>
  90. <tr class="noborder">
  91. <td class="vatop rowform"><input class="txt" type="text" name="denomination" style="width:150px;" /></td>
  92. <td class="vatop tips">请输入面额,面额不可超过1000</td>
  93. </tr>
  94. <tr>
  95. <td colspan="2" class="required"><label>批次标识:</label></td>
  96. </tr>
  97. <tr class="noborder">
  98. <td class="vatop rowform"><input class="txt" type="text" name="batchflag" /></td>
  99. <td class="vatop tips">可以输入20字之内“批次标识”,用于标识和区分不同批次添加的充值卡,便于检索</td>
  100. </tr>
  101. </tbody>
  102. <tfoot>
  103. <tr class="tfoot">
  104. <td colspan="2" ><a href="javascript:void(0);" class="btn" id="submitBtn"><span><?php echo $lang['nc_submit'];?></span></a></td>
  105. </tr>
  106. </tfoot>
  107. </table>
  108. </form>
  109. </div>
  110. <script type="text/javascript">
  111. $(function(){
  112. $('.tabswitch').click(function() {
  113. var i = parseInt(this.value);
  114. $('.tabswitch-target').hide().eq(i).show();
  115. });
  116. $("#submitBtn").click(function(){
  117. $("#form_add").submit();
  118. });
  119. jQuery.validator.addMethod("r0total", function(value, element) {
  120. var v = parseInt(value);
  121. return $(":radio[name='type']:checked").val() != '0' || (value == v && v >= 1 && v <= 9999);
  122. }, "总数必须是1~9999之间的整数");
  123. jQuery.validator.addMethod("r0prefix", function(value, element) {
  124. return $(":radio[name='type']:checked").val() != '0' || this.optional(element) || /^[0-9a-zA-Z]{0,16}$/.test(value);
  125. }, "前缀必须是16字之内字母数字的组合");
  126. jQuery.validator.addMethod("r1textfile", function(value, element) {
  127. return $(":radio[name='type']:checked").val() != '1' || value;
  128. }, "请选择纯文本格式充值卡卡号文件");
  129. jQuery.validator.addMethod("r2manual", function(value, element) {
  130. return $(":radio[name='type']:checked").val() != '2' || value;
  131. }, "请输入充值卡卡号");
  132. $("#form_add").validate({
  133. errorPlacement: function(error, element){
  134. error.appendTo(element.parents('tbody').find('tr:first td:first'));
  135. },
  136. rules : {
  137. denomination : {
  138. required : true,
  139. min: 0.01,
  140. max: 1000
  141. },
  142. batchflag : {
  143. maxlength: 20
  144. },
  145. total : {
  146. r0total : true
  147. },
  148. prefix : {
  149. r0prefix : true
  150. },
  151. textfile : {
  152. r1textfile : true
  153. },
  154. manual : {
  155. r2manual : true
  156. }
  157. },
  158. messages : {
  159. denomination : {
  160. required : '请填写面额',
  161. min : '面额不能小于0.01',
  162. max: '面额不能大于1000'
  163. },
  164. batchflag : {
  165. maxlength: '请输入20字之内的批次标识'
  166. }
  167. }
  168. });
  169. });
  170. </script>