query_normal_mult.html 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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>
  11. <img src='{:tomedia($row['thumb'])}' style='width:30px;height:30px;padding1px;border:1px solid #ccc' />
  12. <?php if($row['is_finished'] == 1){ ?>
  13. <span style="color:red;">[已结束]&nbsp;</span>
  14. <?php } ?>
  15. <?php if($row['is_grab'] == 1){ ?>
  16. <span style="color:red;">[已抢光]</span>
  17. <?php } ?>
  18. {$row['goodsname']}
  19. </td>
  20. <td style="width:80px;"><a href="javascript:;" class="choose_dan_link_goods" data-json='{:json_encode($row);}'>选择</a></td>
  21. </tr>
  22. <?php } ?>
  23. <?php if(count($ds)<=0){ ?>
  24. <tr>
  25. <td colspan='4' align='center'>未找到商品</td>
  26. </tr>
  27. <?php } ?>
  28. </tbody>
  29. </table>
  30. </div>
  31. <script>
  32. var query_kwd = '{$kwd}';
  33. var query_url = "{:U('goods/query_normal', array('type' => $type,'template' => 'mult','is_not_hexiao' => $is_not_hexiao,'unselect_goodsid' => $_GPC['unselect_goodsid']))}";
  34. var can_next = true;
  35. $(".select-btn").click(function(){
  36. query_kwd = $.trim($("#select-url-kw").val());
  37. if(!can_next)
  38. {
  39. return false;
  40. }
  41. can_next = false;
  42. $.ajax({
  43. url:query_url,
  44. type:'post',
  45. dataType:'json',
  46. data:{keyword:query_kwd,is_ajax:1},
  47. success:function(ret){
  48. if(ret.code == 0)
  49. {
  50. $('.supplyquery tbody').html(ret.html);
  51. // $('#pager_ajax').html(ret.pager);
  52. }
  53. can_next = true;
  54. }
  55. })
  56. });
  57. $(document).delegate(".choose_dan_link_goods","click",function(){
  58. //data-json
  59. var json_obj = JSON.parse($(this).attr('data-json'));
  60. var p_html = '';
  61. p_html+= '<div class="input-group mult_choose_goodsid" data-gid="'+json_obj.gid+'" style="border-radius: 0;float: left;margin: 10px;margin-left:0px;">';
  62. p_html+= ' <div class="layadmin-text-center choose_user">';
  63. p_html+= ' <img style="" src="'+json_obj.thumb+'">';
  64. p_html+= ' <div class="layadmin-maillist-img" style="">'+json_obj.goodsname+'</div>';
  65. p_html+= ' <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)"><i class="layui-icon">&#xe640;</i></button>';
  66. p_html+= ' </div>';
  67. p_html+= '</div>';
  68. //$(cur_open_div).parent().siblings().remove();
  69. var can_tr = true;
  70. $(cur_open_div).parent().siblings().each(function(){
  71. if( $(this).attr('data-gid') == json_obj.gid )
  72. {
  73. can_tr = false;
  74. }
  75. })
  76. if( can_tr )
  77. {
  78. $(cur_open_div).parent().after(p_html);
  79. //$(cur_open_div).val( json_obj.gid );
  80. }
  81. //layer.close(layer.index);
  82. });
  83. </script>