query.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. <th>操作</th>
  13. </thead>
  14. <tbody>
  15. <?php foreach( $ds as $row ){ ?>
  16. <tr>
  17. <td><img src="{$row['room_logo']}" style='width:30px;height:30px;padding1px;border:1px solid #ccc' />&nbsp;&nbsp;{$row['room_name']}</td>
  18. <td>{$row['room_address']}</td>
  19. <td>{$row['supply_name']}</td>
  20. <td>{$row['mobile']}</td>
  21. <?php if($row['exist'] == 0){ ?>
  22. <?php if($gpc['template'] == 'mult'){ ?>
  23. <td style="width:80px;"><a href="javascript:;" class="choose_mult_link" data-json='{:json_encode($row);}'>选择</a></td>
  24. <?php }else if($gpc['template'] == 'mult_goods'){ ?>
  25. <td style="width:80px;"><a href="javascript:;" class="choose_mult_goods_link" data-json='{:json_encode($row);}'>选择</a></td>
  26. <?php }else{ ?>
  27. <td style="width:80px;"><a href="javascript:;" class="choose_dan_link" data-json='{:json_encode($row);}'>选择</a></td>
  28. <?php }?>
  29. <?php }else{ ?>
  30. <td style="width:80px; border: #ccc">选择</td>
  31. <?php } ?>
  32. </tr>
  33. <?php } ?>
  34. <?php if( count($ds)<=0){ ?>
  35. <tr>
  36. <td colspan='5' align='center'>
  37. <?php if(!empty($supply_id)){ ?>
  38. 该独立供应商还没有门店
  39. <?php }else{ ?>
  40. 平台还没有门店
  41. <?php } ?>
  42. </td>
  43. </tr>
  44. <?php } ?>
  45. </tbody>
  46. <?php if( count($ds) > 0){ ?>
  47. <tfoot>
  48. <tr>
  49. <td colspan='5' align='center' id="pager_ajax">{$pager}</td>
  50. </tr>
  51. </tfoot>
  52. <?php } ?>
  53. </table>
  54. </div>
  55. <script>
  56. var query_kwd = '{$kwd}';
  57. <?php if( !empty($url)){ ?>
  58. var query_url = "{:U($url, array('template' => $gpc['template']))}";
  59. <?php }else{ ?>
  60. var query_url = "{:U('salesroom/query', array('template' => $gpc['template']))}";
  61. <?php } ?>
  62. var can_next = true;
  63. $(document).delegate(".choose_dan_link","click",function(){
  64. //data-json
  65. var json_obj = JSON.parse($(this).attr('data-json'));
  66. var p_html = '';
  67. p_html+= '<div class="input-group " style="margin: 0;">';
  68. p_html+= ' <div class="layadmin-text-center choose_user">';
  69. p_html+= ' <img style="" src="'+json_obj.room_logo+'">';
  70. p_html+= ' <div class="layadmin-maillist-img" style="">'+json_obj.room_name+'</div>';
  71. p_html+= ' <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_room_bind(this)"><i class="layui-icon">&#xe640;</i></button>';
  72. p_html+= ' </div>';
  73. p_html+= '</div>';
  74. $(cur_open_div).parent().siblings().remove();
  75. $(cur_open_div).parent().after(p_html);
  76. $(cur_open_div).val( json_obj.id );
  77. layer.close(layer.index);
  78. });
  79. $(document).delegate(".choose_mult_link","click",function(){
  80. //data-json
  81. var json_obj = JSON.parse($(this).attr('data-json'));
  82. var p_html = '';
  83. p_html+= '<div class="input-group mult_choose_roomid" data-roomid="'+json_obj.id+'" style="border-radius: 0;float: left;margin: 10px;margin-left:0px;">';
  84. p_html+= ' <div class="layadmin-text-center choose_user">';
  85. p_html+= ' <img style="" src="'+json_obj.room_logo+'">';
  86. p_html+= ' <div class="layadmin-maillist-img" style="">'+json_obj.room_name+'</div>';
  87. p_html+= ' <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_room_bind(this)"><i class="layui-icon">&#xe640;</i></button>';
  88. p_html+= ' </div>';
  89. p_html+= '</div>';
  90. //$(cur_open_div).parent().siblings().remove();
  91. var can_tr = true;
  92. $(cur_open_div).parent().siblings().each(function(){
  93. if( $(this).attr('data-roomid') == json_obj.id )
  94. {
  95. can_tr = false;
  96. }
  97. })
  98. if( can_tr )
  99. {
  100. $(cur_open_div).parent().after(p_html);
  101. //$(cur_open_div).val( json_obj.gid );
  102. }
  103. //layer.close(layer.index);
  104. });
  105. $(document).delegate(".choose_mult_goods_link","click",function(){
  106. var room_count = $('.mult_choose_roomid').length;
  107. room_count = room_count + 1;
  108. //data-json
  109. var json_obj = JSON.parse($(this).attr('data-json'));
  110. var p_html = '';
  111. p_html+= '<div class="input-group mult_choose_room_list" style="width:100%">';
  112. p_html+= '<div class="input-group mult_choose_roomid" data-roomid="'+json_obj.id+'" style="border-radius: 0;margin: 10px;margin-left:0px;">';
  113. p_html+= ' <div class="choose_room_title">指定门店'+room_count+'</div>';
  114. p_html+= ' <div class="layadmin-text-center choose_user">';
  115. p_html+= ' <img style="" src="'+json_obj.room_logo+'">';
  116. p_html+= ' <div class="layadmin-maillist-img" style="">'+json_obj.room_name+'</div>';
  117. p_html+= ' <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_room_bind(this)"><i class="layui-icon">&#xe640;</i></button>';
  118. p_html+= ' </div>';
  119. p_html+= '</div>';
  120. p_html+= ' <div class="input-group" style="margin-top: 10px;">';
  121. p_html+= ' <input type="checkbox" class="is_hx_member" lay-filter="is_hx_member" lay-skin="primary" name="is_hx_member" value="1" title="是否指定核销人员"/>';
  122. p_html+= ' </div>';
  123. p_html+= ' <div class="input-group selectHxMember" style="margin-top: 10px;display:none;">';
  124. p_html+= ' <input type="text" disabled value="" class="form-control valid" name="smember_id" placeholder="">';
  125. p_html+= ' <span class="input-group-btn">';
  126. p_html+= ' <span data-input="#hexiao_smember_list_'+json_obj.id+'" class="btn btn-default chose_smember_id">选择核销人员</span>';
  127. p_html+= ' </span>';
  128. p_html+= ' </div>';
  129. p_html+= ' <div class="form-group hx_smember_list" id="hx_smember_list">';
  130. p_html+= ' <div class="col-sm-12 col-xs-12">';
  131. p_html+= ' <div id="hexiao_smember_list_'+json_obj.id+'"></div>';
  132. p_html+= ' </div>';
  133. p_html+= ' </div>';
  134. p_html+= ' </div>';
  135. //$(cur_open_div).parent().siblings().remove();
  136. var can_tr = true;
  137. $(cur_open_div).parent().find('.mult_choose_roomid').each(function(){
  138. if( $(this).attr('data-roomid') == json_obj.id )
  139. {
  140. can_tr = false;
  141. }
  142. })
  143. if( can_tr )
  144. {
  145. $(cur_open_div).before(p_html);
  146. }
  147. form.render('checkbox');
  148. //layer.close(layer.index);
  149. });
  150. $(".select-btn").click(function(){
  151. query_kwd = $.trim($("#select-url-kw").val());
  152. var s_page = $(this).attr('page');
  153. if(!can_next)
  154. {
  155. return false;
  156. }
  157. can_next = false;
  158. $.ajax({
  159. url:query_url,
  160. type:'post',
  161. dataType:'json',
  162. data:{keyword:query_kwd, page:1,is_ajax:1},
  163. success:function(ret){
  164. console.log(ret);
  165. if(ret.code == 0)
  166. {
  167. $('.supplyquery tbody').html(ret.html);
  168. $('#pager_ajax').html(ret.pager);
  169. }
  170. can_next = true;
  171. }
  172. })
  173. });
  174. $("body").delegate(".pagination a","click",function(){
  175. var s_page = $(this).attr('page');
  176. if(!can_next)
  177. {
  178. return false;
  179. }
  180. can_next = false;
  181. $.ajax({
  182. url:query_url,
  183. type:'post',
  184. dataType:'json',
  185. data:{keyword:query_kwd, page:s_page,is_ajax:1},
  186. success:function(ret){
  187. if(ret.code == 0)
  188. {
  189. $('.supplyquery tbody').html(ret.html);
  190. $('#pager_ajax').html(ret.pager);
  191. }
  192. can_next = true;
  193. }
  194. })
  195. })
  196. </script>