index.blade.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. @extends('admin.layouts.app')
  2. @section('content')
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox float-e-margins">
  6. <div class="ibox-title">
  7. <h5>我的线索</h5>
  8. <div class="ibox-tools">
  9. <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
  10. </a>
  11. </div>
  12. </div>
  13. <div class="ibox-content">
  14. <div class="form-group">
  15. @if(role('User/Threads/addCallList'))
  16. <div class="col-sm-8 pull-right">
  17. <span id="addCallList" class="btn btn-primary pull-right fa fa-phone"
  18. style="display: none">添加到电话列表</span>
  19. </div>
  20. @endif
  21. </div>
  22. </div>
  23. {{--添加过滤条件--}}
  24. <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
  25. <tr>
  26. <th> 过滤条件</th>
  27. <form method="GET" action="" accept-charset="UTF-8" id="filter_threads">
  28. <th>
  29. <select name="process" class="form-control filter_threads">
  30. <option value="">有无跟进</option>
  31. <option value="1">有</option>
  32. <option value="2">无</option>
  33. </select>
  34. </th>
  35. {{--<th style="width: 40%">--}}
  36. {{--<div class="row">--}}
  37. {{--<div class="col-sm-5" id="data_1">--}}
  38. {{--<div class="input-group date">--}}
  39. {{--<span class="input-group-addon">--}}
  40. {{--<i class="fa fa-calendar"></i></span>--}}
  41. {{--<input type="text" id="start" class="form-control" placeholder="领取日期"--}}
  42. {{--name="start"--}}
  43. {{--value="{{Request::get('start') ? : ''}}">--}}
  44. {{--</div>--}}
  45. {{--</div>--}}
  46. {{--_--}}
  47. {{--<div class="col-sm-5" id="data_2">--}}
  48. {{--<div class="input-group date">--}}
  49. {{--<span class="input-group-addon">--}}
  50. {{--<i class="fa fa-calendar"></i></span>--}}
  51. {{--<input type="text" id="end" class="form-control" placeholder="领取日期"--}}
  52. {{--name="end"--}}
  53. {{--value="{{Request::get('end') ? : ''}}">--}}
  54. {{--</div>--}}
  55. {{--</div>--}}
  56. {{--</div>--}}
  57. {{--</th>--}}
  58. <th>
  59. <div class="input-group">
  60. <input type="text" class="form-control" value="{{Request::get('keyword')}}"
  61. placeholder="请输入企业名称"
  62. name="keyword">
  63. <span class="input-group-append">
  64. <span class="btn btn-sm btn-default filter_threads"
  65. style="height: 100%">搜索</span>
  66. </span>
  67. </div>
  68. </th>
  69. </form>
  70. </tr>
  71. </table>
  72. <div id="threads-list">
  73. @include('admin.user.threads.data')
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. @endsection
  80. @section('js')
  81. <script type="text/javascript">
  82. /*电话全选功能*/
  83. var items = $('.contacts')
  84. $('#checkAll').click(function () {
  85. isChecked = $(this).prop('checked')
  86. items.prop('checked', isChecked)
  87. if (isChecked == true) {
  88. $('#addCallList').show()
  89. } else {
  90. $('#addCallList').hide()
  91. }
  92. })
  93. items.click(function () {
  94. checkedLength = $('.contacts:checked').length
  95. if (checkedLength) {
  96. $('#addCallList').show()
  97. } else {
  98. $('#addCallList').hide()
  99. }
  100. if (items.length == checkedLength) {
  101. $('#addCallList').show()
  102. } else {
  103. $('#checkAll').prop('checked', false)
  104. }
  105. })
  106. /*添加选择的电话到拨打列表*/
  107. $('#addCallList').click(function () {
  108. contact_ids = []
  109. csrf_token = "{{ csrf_token() }}"
  110. $('.contacts:checked').each(function () {
  111. contact_ids.push($(this).val())
  112. })
  113. $.ajax({
  114. type: 'post',
  115. url: '{{ U('User/Threads/addCallList') }}',
  116. data: {contact_ids: contact_ids, _token: csrf_token},
  117. success: function (data) {
  118. if (data == 200) {
  119. layer.msg('导入成功', {
  120. icon: 1,
  121. time: 2000 //2秒关闭(如果不配置,默认是3秒)
  122. }, function () {
  123. window.location.href = window.location.href
  124. });
  125. }
  126. }
  127. })
  128. console.log(contact_ids)
  129. })
  130. /*线索筛选*/
  131. $('.filter_threads').change(function () {
  132. data = $('#filter_threads').serialize()
  133. $.ajax({
  134. type: 'get',
  135. data: data,
  136. }).done(function (data) {
  137. $('#threads-list').html(data.html)
  138. })
  139. })
  140. $('.filter_threads').click(function () {
  141. data = $('#filter_threads').serialize()
  142. $.ajax({
  143. type: 'get',
  144. data: data,
  145. }).done(function (data) {
  146. $('#threads-list').html(data.html)
  147. })
  148. })
  149. /*Ajax 分页*/
  150. $('body').on('click', '.pagination a', function(e) {
  151. e.preventDefault();
  152. if ($(this).attr('href') != '#' ) {
  153. data = $('#filter_threads').serialize()
  154. $.ajax({
  155. url: $(this).attr('href'),
  156. type: 'get',
  157. data: data,
  158. }).done(function (data) {
  159. $('#threads-list').html(data.html)
  160. })
  161. }
  162. });
  163. </script>
  164. @endsection