choosemember.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <div class="modal-dialog">
  2. <div style='max-height:500px;overflow:auto;min-width:400px;background-color:#fff;'>
  3. <table class="table supplyquery table-hover" style="min-width:400px;">
  4. <div class="input-group layui-row" style="margin:10px;">
  5. <input type="text" placeholder="请输入昵称进行搜索" id="select-url-kw" value="" class="form-control">
  6. <span class="input-group-addon btn btn-default select-btn" data-type="url" id="sarchBtn">搜索</span>
  7. </div>
  8. <tbody>
  9. <?php foreach( $ds as $row ){ ?>
  10. <tr>
  11. <td> {$row['username']}</td>
  12. <td>{$row['mobile']}</td>
  13. <td style="width:80px;"><a href="javascript:;" class="choose_dan_link" data-json='{:json_encode($row);}'>选择</a></td>
  14. </tr>
  15. <?php } ?>
  16. <?php if( count($ds)<=0){ ?>
  17. <tr>
  18. <td colspan='4' align='center'>未找到配送员</td>
  19. </tr>
  20. <?php } ?>
  21. </tbody>
  22. <?php if( count($ds) > 0){ ?>
  23. <tfoot>
  24. <tr>
  25. <td colspan='4' align='center' id="pager_ajax">{$pager}</td>
  26. </tr>
  27. </tfoot>
  28. <?php } ?>
  29. </table>
  30. </div>
  31. </div>
  32. <script>
  33. var query_kwd = '{$kwd}';
  34. var query_url = "{:U('orderdistribution/choosemember')}";
  35. var can_next = true;
  36. var order_id = "{$id}";
  37. $(document).delegate(".choose_dan_link","click",function(){
  38. var loadingIndex = layer.load(); // 加载中动画遮罩层(1)
  39. //data-json
  40. var json_obj = JSON.parse($(this).attr('data-json'));
  41. var id = json_obj.id;
  42. console.log(order_id);
  43. console.log(id);
  44. $.ajax({
  45. url:"{:U('Orderdistribution/sub_orderchoose_distribution')}",
  46. type:'post',
  47. dataType:'json',
  48. data:{order_id:order_id, id:id},
  49. success:function(info)
  50. {
  51. if(info.status == 0)
  52. {
  53. layer.msg(info.result.message,{icon: 1,time: 2000});
  54. layer.close(loadingIndex); // 提交成功失败都需要关闭
  55. }else if(info.status == 1){
  56. var go_url = location.href;
  57. if( info.result.hasOwnProperty("url") )
  58. {
  59. go_url = info.result.url;
  60. }
  61. layer.msg('分配成功',{time: 1000,
  62. end:function(){
  63. var backurl = "{:U('Order/index',array('ok'=>'1'))}";
  64. location.href = backurl;
  65. // location.href = info.result.url;
  66. }
  67. });
  68. }
  69. }
  70. })
  71. return false;
  72. // layer.close(layer.index);
  73. });
  74. $("body").delegate(".pagination a","click",function(){
  75. var s_page = $(this).attr('page');
  76. if(!can_next)
  77. {
  78. return false;
  79. }
  80. can_next = false;
  81. $.ajax({
  82. url:query_url,
  83. type:'post',
  84. dataType:'json',
  85. data:{keyword:query_kwd, page:s_page,is_ajax:1},
  86. success:function(ret){
  87. if(ret.code == 0)
  88. {
  89. $('.supplyquery tbody').html(ret.html);
  90. $('#pager_ajax').html(ret.pager);
  91. }
  92. can_next = true;
  93. }
  94. })
  95. })
  96. $("body").delegate("#sarchBtn","click",function(){
  97. var keyword = $('#select-url-kw').val();
  98. $.ajax({
  99. url:query_url,
  100. type:'post',
  101. dataType:'json',
  102. data:{keyword:keyword,page:1,is_ajax:1, id:<?php echo $id; ?>},
  103. success:function(ret){
  104. if(ret.code == 0)
  105. {
  106. $('.supplyquery tbody').html(ret.html);
  107. $('#pager_ajax').html(ret.pager);
  108. }
  109. }
  110. })
  111. })
  112. </script>