index.blade.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. @extends('admin/site/side_layout')
  2. @section('header_extend')
  3. @endsection
  4. @section('right')
  5. <form class="row" id="searchForm" onsubmit="units.search();return false;">
  6. <div class="col-md-4">
  7. <div class="input-group">
  8. 询盘总数:<span style="font-weight: 600" id="allInquire">0</span>
  9. 真实询盘:<span style="font-weight: 600;" id="realInquire">0</span>
  10. <button type="button" class="btn btn-warning btn-sm" style="margin-left: 10px"
  11. onclick="units.exportExcel()">下载
  12. </button>
  13. <button type="button" class="btn btn-warning btn-sm" style="margin-left: 10px"
  14. onclick="units.exportAllExcel()">下载近两个月全部询盘
  15. </button>
  16. </div>
  17. </div>
  18. <div class="col-md-6 pull-right">
  19. <div class="input-group">
  20. <input type="hidden" value="all" name="time_range" id="time_range">
  21. <span class="input-group-btn">
  22. <button type="button" class="btn btn-md" onclick="units.search('week')"
  23. style="margin-right: 2px"> 最近七天</button>
  24. <button type="button" class="btn btn-md" onclick="units.search('month')"
  25. style="margin-right: 2px"> 最近30天</button>
  26. <button type="button" class="btn btn-md" onclick="units.search('year')"
  27. style="margin-right: 2px"> 最近一年</button>
  28. <button type="button" class="btn btn-md" onclick="units.search('all')"
  29. style="margin-right: 2px"> 全部</button>
  30. </span>
  31. <input type="text" placeholder="请选择日期范围" class="input-md form-control" id="date_range">
  32. </div>
  33. </div>
  34. </form>
  35. <hr>
  36. <div class="table-responsive">
  37. <div>
  38. </div>
  39. <table id="table" class="table table-condensed"
  40. data-mobile-responsive="true"></table>
  41. </div>
  42. @endsection
  43. @section('footer_extend')
  44. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  45. <script>
  46. laydate.render({
  47. elem: '#date_range',
  48. type: 'date',
  49. range: true,
  50. done: function (value, date, endDate) {
  51. units.search(value);
  52. }
  53. });
  54. var units = {
  55. exportExcel: function () {
  56. var time_range = $("#time_range").val();
  57. window.open('/admin/inquires/{{$siteId}}/export-excel?notCustomer=1&time_range=' + time_range);
  58. },
  59. exportAllExcel: function () {
  60. window.open('/admin/inquires/{{$siteId}}/export-all-excel');
  61. },
  62. search: function ($time_range) {
  63. $("#time_range").val($time_range);
  64. tips.selectPage();
  65. },
  66. detail: function (id) {
  67. layer.open({
  68. type: 2,
  69. content: ['/admin/inquires/' + id + '?siteId=' + "{{$siteId}}"],
  70. area: ['90%', '100%'],
  71. title: '',
  72. closeBtn: 0
  73. });
  74. },
  75. mailDetail: function (id) {
  76. layer.open({
  77. type: 2,
  78. content: ['/admin/inquires-mail/' + id + '?siteId=' + "{{$siteId}}"],
  79. area: ['90%', '100%'],
  80. title: '',
  81. closeBtn: 0
  82. });
  83. }
  84. };
  85. var config = {};
  86. config.url = '/admin/site/' + "{{$siteId}}" + '/inquires';
  87. config.columns = [ //字段
  88. {
  89. title: '序号', align: 'center', formatter: function (value, item, index) {
  90. return index + 1;
  91. }
  92. },
  93. {
  94. title: '姓名', field: 'sender_name', align: 'center',
  95. formatter: function (value, row) {
  96. return '<a href="javascript:;" onclick="units.detail(' + row.id + ')">' + (value.length < 1 ? "详情" : value) + '</a>'
  97. }
  98. },
  99. {title: '邮箱', field: 'sender_email', align: 'center'},
  100. {title: '国家', field: 'location', align: 'center'},
  101. {title: '电话', field: 'phone', align: 'center'},
  102. {title: '状态', field: 'is_read', align: 'center'},
  103. {
  104. title: '是否真实询盘', field: 'is_delete', align: 'center', formatter: function (value, row) {
  105. return value ? '否' : '是';
  106. }
  107. },
  108. {title: '询盘时间', field: 'created_at', align: 'center'},
  109. {
  110. title: '邮件时间', field: 'mail_date', align: 'center',
  111. formatter: function (value, row) {
  112. return '<a href="javascript:;" onclick="units.mailDetail(' + row.id + ')">' + (value.length < 1 ? "详情" : value) + '</a>'
  113. }
  114. }
  115. ];
  116. config.onLoadError = function (status, jqXHR) {
  117. $(".no-records-found td").text('数据请求异常,请检查分配的服务器是否正确');
  118. };
  119. config.onLoadSuccess = function (data) {
  120. var extra = data.extra;
  121. $("#allInquire").text(extra.allInquire);
  122. $("#realInquire").text(extra.realInquire);
  123. };
  124. tips.bootstrapTable(config);
  125. </script>
  126. @endsection