query.html 3.1 KB

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