customer.blade.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. @extends('admin/layout')
  2. @section('content')
  3. <body class="gray-bg">
  4. <div class="wrapper wrapper-content animated fadeInRight">
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <div class="ibox float-e-margins">
  8. <div class="ibox-title"></div>
  9. <div class="ibox-content">
  10. <form class="row" id="searchForm">
  11. <div class="col-md-4">
  12. <div class="input-group">
  13. <span class="input-group-btn">
  14. <button type="button" class="btn btn-md btn-primary"
  15. style="margin-left: 10px" onclick="units.edit(0)"> <span
  16. class="glyphicon glyphicon-plus"></span> 添加</button>
  17. <button type="button" class="btn btn-md btn-danger" onclick="units.delete()"
  18. style="margin-left: 10px"><span
  19. class="glyphicon glyphicon-remove"></span> 删除</button>
  20. </span>
  21. </div>
  22. </div>
  23. <div class="col-md-6 pull-right">
  24. <div class="input-group">
  25. <input type="text" placeholder="请输入客户名称,联系人或联系方式" class="input-md form-control"
  26. name="keyword"
  27. id="keyword">
  28. <span class="input-group-btn">
  29. <button type="button" class="btn btn-md btn-primary"
  30. onclick="units.search()"> 搜索</button>
  31. <button type="reset" class="btn btn-md btn-primary" style="margin-left: 10px"
  32. name="resetBtn"> 重置</button> </span>
  33. </div>
  34. </div>
  35. </form>
  36. <hr>
  37. <div class="table-responsive">
  38. <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </body>
  46. @endsection
  47. @section('footer')
  48. <script>
  49. var units = {
  50. search: function () {
  51. tips.selectPage();
  52. },
  53. getIdsBySelections: function () {
  54. var selections = $("#table").bootstrapTable('getSelections');
  55. var ids = [];
  56. $.each(selections, function (inx, val) {
  57. ids.push(val.id);
  58. });
  59. return ids;
  60. },
  61. edit: function (id) {
  62. var title = '添加';
  63. if (id > 0) {
  64. title = '编辑';
  65. }
  66. layer.open({
  67. type: 2,
  68. content: ['/admin/agents/customer/' + id],
  69. area: ['100%', '100%'],
  70. title: title
  71. });
  72. },
  73. delete: function () {
  74. var ids = units.getIdsBySelections();
  75. if (ids.length === 0) {
  76. layer.alert('请先选择您所要操作的对象', {icon: 0});
  77. return;
  78. }
  79. layer.confirm('您确定要删除吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  80. layer.close(index);
  81. tips.ajax({
  82. url: '/admin/agents',
  83. type: 'delete',
  84. data: {ids: ids},
  85. tableRefresh: '#table'
  86. });
  87. });
  88. }
  89. };
  90. var config = {};
  91. config.url = '/admin/agents/customer';
  92. config.columns = [ //字段
  93. {checkbox: true},
  94. {
  95. title: '序号', align: 'center', formatter: function (value, item, index) {
  96. return index + 1;
  97. }
  98. },
  99. {title: '客户名称', field: 'customer_name', align: 'center'},
  100. {title: '域名', field: 'domain', align: 'center'},
  101. {title: '联系人', field: 'contact_user', align: 'center'},
  102. {title: '联系方式', field: 'contact_phone', align: 'center'},
  103. {title: '创建人', field: 'createUsername', align: 'center'},
  104. {
  105. title: '来源', field: 'origin', align: 'center', formatter: function (value, row) {
  106. if (value === 1) {
  107. return '<button class="btn btn-xs btn-info">代理商</button>';
  108. } else if (value === 2) {
  109. return '<button class="btn btn-xs btn-primary">渠道</button>'
  110. } else {
  111. return '';
  112. }
  113. }
  114. },
  115. {title: '创建时间', field: 'created_at', align: 'center'},
  116. {
  117. title: '操作', field: 'id', align: 'center',
  118. formatter: function (value, row) {
  119. return (
  120. '<button onclick="units.edit(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>&nbsp;'
  121. );
  122. }
  123. }
  124. ];
  125. tips.bootstrapTable(config);
  126. </script>
  127. @endsection