couponquery.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <div style='max-height:500px;overflow:auto;min-width:850px;'>
  2. <div class="input-group layui-row" style="margin:10px;">
  3. <input type="text" placeholder="请输入名称进行搜索" id="select-url-kw" value="" class="form-control">
  4. <span class="input-group-addon btn btn-default select-btn" data-type="url">搜索</span>
  5. </div>
  6. <table class="table table-hover couponquery" style="min-width:850px;">
  7. <tbody>
  8. <thead>
  9. <tr>
  10. <th>ID</th>
  11. <th>优惠券名称</th>
  12. <th>优惠使用条件</th>
  13. <th>剩余数量</th>
  14. <th>操作</th>
  15. </tr>
  16. </thead>
  17. <?php foreach( $ds as $row ){ ?>
  18. <tr>
  19. <td style="width:50px;">{$row['id']}</td>
  20. <td style="width:200px;">
  21. {$row['voucher_title']} <label class="label label-success">购物</label>
  22. <?php if($row['catid'] == 1){ ?>
  23. <label class="label label-primary">'.$category[$value['catid']].'</label>
  24. <?php } ?>
  25. <?php if($row['is_new_man'] == 1){ ?>
  26. <label class="layui-badge">新人券</label>
  27. <?php } ?>
  28. </td>
  29. <td>
  30. {$row['credit']} 元<br/>
  31. <?php if( $row['limit_money']>0){ ?>
  32. <span class="text-danger">满{$row['limit_money']}可用</span>
  33. <?php }else{ ?>
  34. <span class="text-warning">不限</span>
  35. <?php } ?>
  36. </td>
  37. <td>
  38. <?php if( $row['total_count']==-1){ ?>无限<?php }else{ ?>剩余:<?php echo ($row['total_count'] - $row['send_count']) < 0 ? 0:$row['total_count'] - $row['send_count']; ?> <?php } ?>
  39. </td>
  40. <td style="width:80px;">
  41. <?php if($row['is_exist'] == 1){ ?>
  42. <a href="javascript:;" disabled="disabled" style="color:#999;">选择</a>
  43. <?php }else{ ?>
  44. <a href="javascript:;" class="choose_dan_head" data-json='{:json_encode($row);}'>选择</a>
  45. <?php } ?>
  46. </td>
  47. </tr>
  48. <?php } ?>
  49. <?php if( count($ds)<=0){ ?>
  50. <tr>
  51. <td colspan='4' align='center'>未找到优惠券</td>
  52. </tr>
  53. <?php } ?>
  54. </tbody>
  55. <?php if( count($ds) > 0){ ?>
  56. <tfoot>
  57. <tr>
  58. <td colspan='5' align='center' id="pager_ajax">{$pager}</td>
  59. </tr>
  60. </tfoot>
  61. <?php } ?>
  62. </table>
  63. </div>
  64. <script>
  65. var query_kwd = '{$kwd}';
  66. var query_url = "{:U('Marketing/couponquery')}";
  67. var can_next = true;
  68. $(document).undelegate(".choose_dan_head","click").delegate(".choose_dan_head","click",function(){
  69. var json_obj = JSON.parse($(this).attr('data-json'));
  70. var p_html = '';
  71. p_html+= '<div class="multi-audio-item " data-id="'+json_obj.id+'">';
  72. p_html+= ' <div class="input-group">';
  73. p_html+= ' <input type="text" class="form-control img-textname" readonly="" value="'+json_obj.voucher_title+'">';
  74. p_html+= ' <input type="hidden" value="'+json_obj.id+'" name="'+iptname+'[]">';
  75. p_html+= ' <div class="input-group-btn">';
  76. p_html+= ' <button class="btn btn-default" data-id="'+json_obj.id+'" onclick="cancle_coupon(this, '+json_obj.id+')" type="button"><i class="fa fa-remove"></i></button>';
  77. p_html+= ' </div>';
  78. p_html+= ' </div>';
  79. p_html+= '</div>';
  80. $(cur_open_div).append(p_html);
  81. layer.close(layer.index);
  82. });
  83. $(".select-btn").click(function(){
  84. query_kwd = $.trim($("#select-url-kw").val());
  85. var s_page = $(this).attr('page');
  86. if(!can_next)
  87. {
  88. return false;
  89. }
  90. can_next = false;
  91. $.ajax({
  92. url:query_url,
  93. type:'post',
  94. dataType:'json',
  95. data:{keyword:query_kwd, page:1,is_ajax:1},
  96. success:function(ret){
  97. if(ret.code == 0)
  98. {
  99. $('.couponquery tbody').html(ret.html);
  100. $('#pager_ajax').html(ret.pager);
  101. }
  102. can_next = true;
  103. }
  104. })
  105. });
  106. $("body").delegate(".pagination a","click",function(){
  107. var s_page = $(this).attr('page');
  108. if(!can_next)
  109. {
  110. return false;
  111. }
  112. can_next = false;
  113. $.ajax({
  114. url:query_url,
  115. type:'post',
  116. dataType:'json',
  117. data:{keyword:query_kwd, page:s_page,is_ajax:1},
  118. success:function(ret){
  119. if(ret.code == 0)
  120. {
  121. $('.couponquery tbody').html(ret.html);
  122. $('#pager_ajax').html(ret.pager);
  123. }
  124. can_next = true;
  125. }
  126. })
  127. })
  128. </script>