Bez popisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.htm 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. {include file="public/layout" /}
  2. <body class="bodystyle">
  3. <div id="append_parent"></div>
  4. <div id="ajaxwaitid"></div>
  5. <div class="page" style="min-width:auto;">
  6. <div class="flexigrid">
  7. <div class="hDiv">
  8. <div class="hDivBox">
  9. <table cellspacing="0" cellpadding="0" style="width: 100%">
  10. <thead>
  11. <tr>
  12. <th class="sign w20 none" axis="col0">
  13. <div class="tc"></div>
  14. </th>
  15. <th abbr="ac_id" axis="col4">
  16. <div class="text-l10">产品名称</div>
  17. </th>
  18. <th abbr="article_time" axis="col4" class="w120">
  19. <div class="tc">会员级别</div>
  20. </th>
  21. <th abbr="article_time" axis="col4" class="w100">
  22. <div class="tc">产品价格(元)</div>
  23. </th>
  24. <th abbr="article_time" axis="col4" class="w120">
  25. <div class="tc">会员期限(天)</div>
  26. </th>
  27. <th abbr="article_time" axis="col4" class="w150">
  28. <div class="tc">营销文案</div>
  29. </th>
  30. <th abbr="article_time" axis="col6" class="w60">
  31. <div class="tc">操作</div>
  32. </th>
  33. <th abbr="article_time" axis="col6" class="w60">
  34. <div class="tc">排序</div>
  35. </th>
  36. </tr>
  37. </thead>
  38. </table>
  39. </div>
  40. </div>
  41. <div class="bDiv" style="height: auto; min-height: auto;">
  42. <form id="PostForm">
  43. <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
  44. <table style="width: 100%">
  45. <tbody>
  46. {empty name="users_type"}
  47. <tr>
  48. <td class="no-data" align="center" axis="col0" colspan="50">
  49. <div class="no_row">
  50. <div class="no_pic"><img src="__SKIN__/images/null-data.png"></div>
  51. </div>
  52. </td>
  53. </tr>
  54. {else/}
  55. {foreach name="users_type" item="vo" key="k" }
  56. <tr class="tr">
  57. <td class="sign none">
  58. <div class="w20 tc">
  59. <input type="hidden" name="type_id[]" value="{$vo.type_id}">
  60. </div>
  61. </td>
  62. <td style="width: 100%">
  63. <div style="">
  64. <input type="text" name="type_name[]" value="{$vo.type_name}" style="width: 93%;">
  65. </div>
  66. </td>
  67. <td>
  68. <div class="w120 tc">
  69. <select name="level_id[]" class="tc w100">
  70. {volist name="$list" id="level"}
  71. <option value="{$level.level_id}" {eq name="$level.level_id" value="$vo.level_id"}selected{/eq} >{$level.level_name}</option>
  72. {/volist}
  73. </select>
  74. </div>
  75. </td>
  76. <td>
  77. <div class="w100 tc">
  78. <input type="text" name="price[]" value="{$vo.price}" onkeyup="this.value=this.value.replace(/[^0-9\.]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9\.]/g,'')" class="tc w80">
  79. </div>
  80. </td>
  81. <td>
  82. <div class="w120 tc">
  83. <select name="limit_id[]" class="tc w100" >
  84. {volist name="$member_limit_arr" id="limit"}
  85. <option value="{$limit.limit_id}" {eq name="$limit.limit_id" value="$vo.limit_id"}selected{/eq} >{$limit.limit_name}</option>
  86. {/volist}
  87. </select>
  88. </div>
  89. </td>
  90. <td>
  91. <div class="w150 tc">
  92. <input class="tc w130" type="text" onchange="changeTableVal('users_type_manage','type_id','{$vo.type_id}','activity',this);" name="activity[]" value="{$vo.activity}" placeholder="比如:限时特价" autocomplete="off" />
  93. </div>
  94. </td>
  95. <td class="operation">
  96. <div class="w60 tc">
  97. <a class="btn red" href="javascript:void(0);" data-url="{:url('Level/level_type_del')}" data-name="{$vo.type_name}" data-id="{$vo.type_id}" onclick="LevelTypeDel(this)">删除</a>
  98. </div>
  99. </td>
  100. <td class="sort">
  101. <div class="w60 tc">
  102. <input class="tc" type="text" onchange="changeTableVal('users_type_manage','type_id','{$vo.type_id}','sort_order',this);" name="sort_order[]" size="4" value="{$vo.sort_order}" />
  103. </div>
  104. </td>
  105. </tr>
  106. {/foreach}
  107. {/empty}
  108. </tbody>
  109. </table>
  110. <div id='Template'></div>
  111. </div>
  112. </form>
  113. <div class="iDiv" style="display: none;"></div>
  114. </div>
  115. <div class="tDiv">
  116. <div class="tDiv2">
  117. <div class="fbutton">
  118. <a href="javascript:void(0);" onclick="AddLevelType();" class="layui-btn layui-btn-primary">
  119. <span class="red">新增会员产品</span>
  120. </a>
  121. </div>
  122. <div class="fbutton">
  123. <a href="javascript:void(0);" data-url="{:url('Level/add_level_data', ['_ajax'=>1])}" onclick="AddLevelData(this);" class="layui-btn layui-btn-primary">
  124. <span class="">保存</span>
  125. </a>
  126. </div>
  127. </div>
  128. <div style="clear:both"></div>
  129. </div>
  130. <!--分页位置-->
  131. {$page}
  132. </div>
  133. </div>
  134. <script type="text/javascript">
  135. var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  136. $(document).ready(function(){
  137. // 表格行点击选中切换
  138. $('#flexigrid > table>tbody >tr').click(function(){
  139. $(this).toggleClass('trSelected');
  140. });
  141. // 点击刷新数据
  142. $('.fa-refresh').click(function(){
  143. location.href = location.href;
  144. });
  145. });
  146. // 删除
  147. function LevelTypeDel(obj){
  148. layer.confirm('确认彻底删除<span style="color:red;">'+$(obj).attr('data-name')+'</span>?', {
  149. shade: layer_shade,
  150. area: ['480px', '190px'],
  151. move: false,
  152. title: '提示',
  153. btnAlign:'r',
  154. closeBtn: 3,
  155. btn: ['确定','取消'] ,//按钮
  156. success: function () {
  157. $(".layui-layer-content").css('text-align', 'left');
  158. }
  159. }, function(){
  160. layer_loading('正在处理');
  161. // 确定
  162. $.ajax({
  163. type : 'post',
  164. url : $(obj).attr('data-url'),
  165. data : {type_id:$(obj).attr('data-id'),_ajax:1},
  166. dataType : 'json',
  167. success : function(data){
  168. layer.closeAll();
  169. if(data.code == 1){
  170. layer.msg(data.msg, {icon: 1, time:1000},function(){
  171. window.location.reload();
  172. });
  173. }else{
  174. layer.alert(data.msg, {icon: 2, title:false});
  175. }
  176. }
  177. })
  178. }, function(index){
  179. layer.close(index);
  180. });
  181. }
  182. function AddLevelType(){
  183. // tr数,取唯一标识
  184. var SerialNum = $('.tr').length;
  185. var AddHtml = [];
  186. AddHtml +=
  187. [
  188. '<tr class="tr" id="tr_'+SerialNum+'">'+
  189. '<td class="sign none">'+
  190. '<div class="w20 tc"><input type="hidden" name="type_id[]"></div>'+
  191. '</td>'+
  192. '<td style="width: 100%">'+
  193. '<div style="">'+
  194. '<input type="text" name="type_name[]" style="width: 93%;">'+
  195. '</div>'+
  196. '</td>'+
  197. '<td>'+
  198. '<div class="w120 tc">'+
  199. '<select name="level_id[]" class="tc w100">'+
  200. '{volist name="$list" id="level"}'+
  201. '<option value="{$level.level_id}" >{$level.level_name}</option>'+
  202. '{/volist}'+
  203. '</select>'+
  204. '</div>'+
  205. '</td>'+
  206. '<td>'+
  207. '<div class="w100 tc">'+
  208. '<input type="text" name="price[]" onkeyup="this.value=this.value.replace(/[^0-9\.]/g,\'\')" onafterpaste="this.value=this.value.replace(/[^0-9\.]/g,\'\')" class="tc w80">'+
  209. '</div>'+
  210. '</td>'+
  211. '<td>'+
  212. '<div class="w120 tc">'+
  213. '<select name="limit_id[]" class="tc w100">'+
  214. '{volist name="$member_limit_arr" id="limit"}'+
  215. '<option value="{$limit.limit_id}">{$limit.limit_name}</option>'+
  216. '{/volist}'+
  217. '</select>'+
  218. '</div>'+
  219. '</td>'+
  220. '<td>'+
  221. '<div class="w150 tc">'+
  222. '<input class="tc w130" type="text" onchange="changeTableVal(\'users_type_manage\',\'type_id\',\'{$vo.type_id}\',\'activity\',this);" name="activity[]" placeholder="比如:限时特价" autocomplete="off">'+
  223. '</div>'+
  224. '</td>'+
  225. '<td class="">'+
  226. '<div class="w60 tc">'+
  227. '<a class="btn red" href="javascript:void(0);" data-id="tr_'+SerialNum+'" onclick="DelHtml(this)"><i class="fa fa-trash-o"></i>删除</a>'+
  228. '</div>'+
  229. '</td>'+
  230. '<td class="sort">'+
  231. '<div class="w60 tc">'+
  232. '<input class="tc" name="sort_order[]" type="text" size="4" value="100" />'+
  233. '</div>'+
  234. '</td>'+
  235. '</tr>'
  236. ];
  237. $('#Template').append(AddHtml);
  238. }
  239. // 删除未保存的级别
  240. function DelHtml(obj){
  241. $('#'+$(obj).attr('data-id')).remove();
  242. }
  243. // 添加新增数据
  244. function AddLevelData(obj){
  245. layer_loading('正在处理');
  246. $.ajax({
  247. type : 'post',
  248. url : $(obj).attr('data-url'),
  249. data : $('#PostForm').serialize(),
  250. dataType : 'json',
  251. success : function(res){
  252. layer.closeAll();
  253. if(res.code == 1){
  254. var _parent = parent;
  255. _parent.layer.close(parentObj);
  256. _parent.layer.msg(res.msg, {shade: layer_shade, time: 1000});
  257. }else{
  258. showErrorMsg(res.msg);
  259. }
  260. },
  261. error: function(e){
  262. layer.closeAll();
  263. layer.alert(e.responseText, {icon: 5, title:false});
  264. }
  265. })
  266. }
  267. </script>
  268. {include file="public/footer" /}