labelquery.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. <div class="active" id="sut_shop">
  7. <div style="padding:0;margin-top:10px;" id="supplyquery">
  8. <?php foreach( $labels as $row ){ ?>
  9. <nav class="btn btn-default btn-sm choose_dan_link" data-id="{$row['id']}" data-json='{:json_encode(array("id"=>$row["id"],"tagname"=>$row["tagname"]))}'>
  10. {$row['tagname']}
  11. </nav>
  12. <?php } ?>
  13. </div>
  14. <?php if( count($labels)<=0){ ?>
  15. <tr>
  16. <td colspan='2' align='center'>未找到</td>
  17. </tr>
  18. <?php } ?>
  19. </div>
  20. </div>
  21. <script>
  22. var query_kwd = '{$kwd}';
  23. var query_url = "{:U('goods/labelquery', array('type' => $type))}";
  24. var can_next = true;
  25. $(document).delegate(".choose_dan_link","click",function(){
  26. //data-json
  27. var json_obj = JSON.parse($(this).attr('data-json'));
  28. var p_html = '';
  29. p_html+= '<div class="input-group " style="margin: 0;">';
  30. p_html+= ' <div class="layadmin-text-center choose_user">';
  31. p_html+= ' <div class="" style="">'+json_obj.tagname+'</div>';
  32. p_html+= ' <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)"><i class="layui-icon">&#xe640;</i></button>';
  33. p_html+= ' </div>';
  34. p_html+= '</div>';
  35. $(cur_open_div).parent().siblings().remove();
  36. $(cur_open_div).parent().after(p_html);
  37. $(cur_open_div).val( json_obj.id );
  38. layer.close(layer.index);
  39. });
  40. $(".select-btn").click(function(){
  41. query_kwd = $.trim($("#select-url-kw").val());
  42. var s_page = $(this).attr('page');
  43. if(!can_next)
  44. {
  45. return false;
  46. }
  47. can_next = false;
  48. $.ajax({
  49. url:query_url,
  50. type:'post',
  51. dataType:'json',
  52. data:{keyword:query_kwd, page:1,is_ajax:1},
  53. success:function(ret){
  54. if(ret.code == 0)
  55. {
  56. $('#supplyquery').html(ret.html);
  57. }
  58. can_next = true;
  59. }
  60. })
  61. });
  62. </script>