query.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 supplyquery table-hover supplyquery" style="min-width:850px;">
  7. <tbody>
  8. <?php foreach( $ds as $row ){ ?>
  9. <tr>
  10. <td><img src="{$row['avatar']}" style='width:30px;height:30px;padding1px;border:1px solid #ccc' /> {$row['nickname']}</td>
  11. <td>{$row['mobile']}</td>
  12. <?php if($row['exist'] == 0){ ?>
  13. <td style="width:80px;"><a href="javascript:;" class="choose_dan_link" data-json='{:json_encode($row);}'>选择</a></td>
  14. <?php }else{ ?>
  15. <td style="width:80px; border: #ccc">选择</td>
  16. <?php } ?>
  17. </tr>
  18. <?php } ?>
  19. <?php if( count($ds)<=0){ ?>
  20. <tr>
  21. <td colspan='4' align='center'>未找到会员</td>
  22. </tr>
  23. <?php } ?>
  24. </tbody>
  25. <?php if( count($ds) > 0){ ?>
  26. <tfoot>
  27. <tr>
  28. <td colspan='4' align='center' id="pager_ajax">{$pager}</td>
  29. </tr>
  30. </tfoot>
  31. <?php } ?>
  32. </table>
  33. </div>
  34. <script>
  35. var query_kwd = '{$kwd}';
  36. <?php if( !empty($url)){ ?>
  37. var query_url = "{:U($url, array('is_not_hexiao' => $is_not_hexiao))}";
  38. <?php }else{ ?>
  39. var query_url = "{:U('user/zhenquery', array('is_not_hexiao' => $is_not_hexiao))}";
  40. <?php } ?>
  41. var can_next = true;
  42. $(document).delegate(".choose_dan_link","click",function(){
  43. //data-json
  44. var json_obj = JSON.parse($(this).attr('data-json'));
  45. var p_html = '';
  46. p_html+= '<div class="input-group " style="margin: 0;">';
  47. p_html+= ' <div class="layadmin-text-center choose_user">';
  48. p_html+= ' <img style="" src="'+json_obj.avatar+'">';
  49. p_html+= ' <div class="layadmin-maillist-img" style="">'+json_obj.username+'</div>';
  50. p_html+= ' <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)"><i class="layui-icon">&#xe640;</i></button>';
  51. p_html+= ' </div>';
  52. p_html+= '</div>';
  53. $(cur_open_div).parent().siblings().remove();
  54. $(cur_open_div).parent().after(p_html);
  55. $(cur_open_div).val( json_obj.member_id );
  56. layer.close(layer.index);
  57. });
  58. $(".select-btn").click(function(){
  59. query_kwd = $.trim($("#select-url-kw").val());
  60. var s_page = $(this).attr('page');
  61. if(!can_next)
  62. {
  63. return false;
  64. }
  65. can_next = false;
  66. $.ajax({
  67. url:query_url,
  68. type:'post',
  69. dataType:'json',
  70. data:{keyword:query_kwd, page:1,is_ajax:1},
  71. success:function(ret){
  72. if(ret.code == 0)
  73. {
  74. $('.supplyquery tbody').html(ret.html);
  75. $('#pager_ajax').html(ret.pager);
  76. }
  77. can_next = true;
  78. }
  79. })
  80. });
  81. $("body").delegate(".pagination a","click",function(){
  82. var s_page = $(this).attr('page');
  83. if(!can_next)
  84. {
  85. return false;
  86. }
  87. can_next = false;
  88. $.ajax({
  89. url:query_url,
  90. type:'post',
  91. dataType:'json',
  92. data:{keyword:query_kwd, page:s_page,is_ajax:1},
  93. success:function(ret){
  94. if(ret.code == 0)
  95. {
  96. $('.supplyquery tbody').html(ret.html);
  97. $('#pager_ajax').html(ret.pager);
  98. }
  99. can_next = true;
  100. }
  101. })
  102. })
  103. </script>