query.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. <thead>
  8. <th>核销员姓名</th>
  9. <th>手机号</th>
  10. <th>会员名</th>
  11. <th>操作</th>
  12. </thead>
  13. <tbody>
  14. <?php foreach( $ds as $row ){ ?>
  15. <tr>
  16. <td><img src="{$row['avatar']}" style="width:30px;height: 30px;padding:1px;border:1px solid #ccc" />{$row['username']}</td>
  17. <td>{$row['mobile']}</td>
  18. <td>{$row['member_name']}</td>
  19. <?php if($row['exist'] == 0){ ?>
  20. <?php if($gpc['template'] == 'mult'){ ?>
  21. <td style="width:80px;"><a href="javascript:;" class="choose_mult_link" data-json='{:json_encode($row);}'>选择</a></td>
  22. <?php }else if($gpc['template'] == 'mult_goods'){ ?>
  23. <td style="width:80px;"><a href="javascript:;" class="choose_mult_goods_smember_link" data-json='{:json_encode($row);}'>选择</a></td>
  24. <?php }else{ ?>
  25. <td style="width:80px;"><a href="javascript:;" class="choose_dan_link" data-json='{:json_encode($row);}'>选择</a></td>
  26. <?php }?>
  27. <?php }else{ ?>
  28. <td style="width:80px; border: #ccc">选择</td>
  29. <?php } ?>
  30. </tr>
  31. <?php } ?>
  32. <?php if( count($ds)<=0){ ?>
  33. <tr>
  34. <td colspan='5' align='center'>未找到核销员</td>
  35. </tr>
  36. <?php } ?>
  37. </tbody>
  38. <?php if( count($ds) > 0){ ?>
  39. <tfoot>
  40. <tr>
  41. <td colspan='5' align='center' id="pager_ajax">{$pager}</td>
  42. </tr>
  43. </tfoot>
  44. <?php } ?>
  45. </table>
  46. </div>
  47. <script>
  48. var query_kwd = '{$kwd}';
  49. <?php if( !empty($url)){ ?>
  50. var query_url = "{:U($url, array('template' => $gpc['template']))}";
  51. <?php }else{ ?>
  52. var query_url = "{:U('salesroom_member/query', array('template' => $gpc['template']))}";
  53. <?php } ?>
  54. var can_next = true;
  55. $(document).delegate(".choose_dan_link","click",function(){
  56. //data-json
  57. var json_obj = JSON.parse($(this).attr('data-json'));
  58. var p_html = '';
  59. p_html+= '<div class="input-group " style="margin: 0;">';
  60. p_html+= ' <div class="layadmin-text-center choose_user">';
  61. p_html+= ' <img src="'+json_obj.avatar+'" style="padding:1px;border:1px solid #ccc" />';
  62. p_html+= ' <div class="layadmin-maillist-img" style="">'+json_obj.username+'</div>';
  63. p_html+= ' <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)"><i class="layui-icon">&#xe640;</i></button>';
  64. p_html+= ' </div>';
  65. p_html+= '</div>';
  66. $(cur_open_div).parent().siblings().remove();
  67. $(cur_open_div).parent().after(p_html);
  68. $(cur_open_div).val( json_obj.id );
  69. layer.close(layer.index);
  70. });
  71. $(document).delegate(".choose_mult_link","click",function(){
  72. //data-json
  73. var json_obj = JSON.parse($(this).attr('data-json'));
  74. var p_html = '';
  75. p_html+= '<div class="input-group mult_choose_smemberid" data-smemberid="'+json_obj.id+'" style="border-radius: 0;float: left;margin: 10px;margin-left:0px;">';
  76. p_html+= ' <div class="layadmin-text-center choose_user">';
  77. p_html+= ' <img src="'+json_obj.avatar+'" style="padding:1px;border:1px solid #ccc" />';
  78. p_html+= ' <div class="layadmin-maillist-img" style="">'+json_obj.username+'</div>';
  79. p_html+= ' <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)"><i class="layui-icon">&#xe640;</i></button>';
  80. p_html+= ' </div>';
  81. p_html+= '</div>';
  82. //$(cur_open_div).parent().siblings().remove();
  83. var can_tr = true;
  84. $(cur_open_div).parent().siblings().each(function(){
  85. if( $(this).attr('data-smemberid') == json_obj.id )
  86. {
  87. can_tr = false;
  88. }
  89. })
  90. if( can_tr )
  91. {
  92. $(cur_open_div).parent().after(p_html);
  93. //$(cur_open_div).val( json_obj.gid );
  94. }
  95. //layer.close(layer.index);
  96. });
  97. $(document).delegate(".choose_mult_goods_smember_link","click",function(){
  98. //data-json
  99. var json_obj = JSON.parse($(this).attr('data-json'));
  100. var p_html = '';
  101. p_html+= '<div class="input-group mult_choose_smemberid" data-smemberid="'+json_obj.id+'" style="border-radius: 0;float: left;margin: 10px;margin-left:0px;">';
  102. p_html+= ' <div class="layadmin-text-center choose_user">';
  103. p_html+= ' <img src="'+json_obj.avatar+'" style="padding1px;border:1px solid #ccc" />';
  104. p_html+= ' <div class="layadmin-maillist-img" style="">'+json_obj.username+'</div>';
  105. p_html+= ' <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)"><i class="layui-icon">&#xe640;</i></button>';
  106. p_html+= ' </div>';
  107. p_html+= '</div>';
  108. //$(cur_open_div).parent().siblings().remove();
  109. var can_tr = true;
  110. $(cur_open_div).parent().find('.mult_choose_smemberid').each(function(){
  111. if( $(this).attr('data-smemberid') == json_obj.id )
  112. {
  113. can_tr = false;
  114. }
  115. })
  116. if( can_tr )
  117. {
  118. $(cur_open_div).after(p_html);
  119. //$(cur_open_div).val( json_obj.gid );
  120. }
  121. //layer.close(layer.index);
  122. });
  123. $(".select-btn").click(function(){
  124. query_kwd = $.trim($("#select-url-kw").val());
  125. var s_page = $(this).attr('page');
  126. if(!can_next)
  127. {
  128. return false;
  129. }
  130. can_next = false;
  131. $.ajax({
  132. url:query_url,
  133. type:'post',
  134. dataType:'json',
  135. data:{keyword:query_kwd, page:1,is_ajax:1},
  136. success:function(ret){
  137. console.log(ret);
  138. if(ret.code == 0)
  139. {
  140. $('.supplyquery tbody').html(ret.html);
  141. $('#pager_ajax').html(ret.pager);
  142. }
  143. can_next = true;
  144. }
  145. })
  146. });
  147. $("body").delegate(".pagination a","click",function(){
  148. var s_page = $(this).attr('page');
  149. if(!can_next)
  150. {
  151. return false;
  152. }
  153. can_next = false;
  154. $.ajax({
  155. url:query_url,
  156. type:'post',
  157. dataType:'json',
  158. data:{keyword:query_kwd, page:s_page,is_ajax:1},
  159. success:function(ret){
  160. if(ret.code == 0)
  161. {
  162. $('.supplyquery tbody').html(ret.html);
  163. $('#pager_ajax').html(ret.pager);
  164. }
  165. can_next = true;
  166. }
  167. })
  168. })
  169. </script>