index.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <style>
  4. .av{
  5. background-color: #23c6c8 !important;
  6. border-color: #23c6c8 !important;
  7. }
  8. .btn-sm{
  9. color: #ffffff !important;
  10. }
  11. .btn-a{
  12. background-color: #abbac3;
  13. }
  14. .pr{
  15. background-color: #23c6c8 !important;
  16. border-color: #23c6c8 !important;
  17. }
  18. </style>
  19. <div class="ibox">
  20. <div class="ibox-content">
  21. <ul class="nav nav-tabs" id="myTab">
  22. <li class="active" onclick="load_index(this,0)">
  23. <a href="javascript:;">
  24. 预定餐
  25. </a>
  26. </li>
  27. <li onclick="load_index(this,1)">
  28. <a href="javascript:;">
  29. 当日餐
  30. </a>
  31. </li>
  32. <li onclick="load_index(this,2)">
  33. <a href="javascript:;">
  34. 特殊套餐
  35. </a>
  36. </li>
  37. </ul>
  38. </div>
  39. <div class="ibox-content">
  40. <div class="row">
  41. <div class="col-xs-12" style="text-align: right;">
  42. <form class="form-inline" id="form-search" action="{:url('index')}">
  43. <input type="hidden" name="is_spot" id="is_spot" value="0">
  44. <input type="hidden" name="is_ok" id="is_ok" value="0">
  45. <div class="input-group">
  46. <input type="text" class="form-control" name="title" placeholder="下单人/单号">
  47. </div>
  48. <div class="input-group">
  49. {:widget_view('common/laydate',['name'=>'start','placeholder' => '下单日期','type' => 'date','val'=>$start])}
  50. </div>
  51. <div class="input-group">
  52. <select name="type" class="form-control">
  53. <option value="">请选择分类</option>
  54. {foreach $typeList as $k=>$v}
  55. <option value="{$v.id}">{$v.name}</option>
  56. {/foreach}
  57. </select>
  58. </div>
  59. <div class="input-group">
  60. <span class="input-group-btn">
  61. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  62. </span> &nbsp;
  63. <span class="input-group-btn">
  64. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  65. </span> &nbsp;
  66. <span class="input-group-btn">
  67. <button class="btn-sm btn-primary" data-url="{:url('export')}" type="button" id="down">导出</button>
  68. </span>&nbsp;
  69. <span class="input-group-btn">
  70. <button class="btn-sm btn-warning" data-url="{:url('export')}" type="button" id="down1">发饭表导出</button>
  71. </span>
  72. &nbsp;
  73. <span class="input-group-btn">
  74. <button class="btn-sm btn-danger" data-url="{:url('print_all')}" type="button" id="down2">发饭表打印</button>
  75. </span>
  76. </div>
  77. </form>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="ibox-content">
  82. <div class="row">
  83. <div class="col-xs-4" style="text-align: left;">
  84. <span style="color:#ccc;" id="timermsglabel">30秒后自动刷新本页面</span>
  85. </div>
  86. <div class="col-xs-8" style="text-align: right;">
  87. <a href="javascript:;" onclick="load_index1(this,0)" style="padding: 8px 10px;color: white !important;" class="btn-sm btn-a av">
  88. 待处理</a>
  89. <a href="javascript:;" onclick="load_index1(this,1)" style="padding: 8px 10px;color: white !important;" class="btn-sm btn-a">
  90. 已完成</a>
  91. <a href="javascript:;" onclick="load_index1(this,2)" style="padding: 8px 10px;color: white !important;" class="btn-sm btn-a">
  92. 已取消</a>
  93. <a href="javascript:;" onclick="print()" style="padding: 8px 10px;color: white !important;" class="btn-sm btn-a pr">
  94. 打印</a>
  95. </div>
  96. </div>
  97. </div>
  98. <div class="ibox-content" id="printer">
  99. <div class="jqGrid_wrapper">
  100. <table id="table" style="border-collapse: collapse"></table>
  101. <div id="pager"></div>
  102. </div>
  103. </div>
  104. </div>
  105. {/block}
  106. {block name="script"}
  107. <script src="/static/browser.js"></script>
  108. <script src="/static/jquery.jqprint-0.3.js"></script>
  109. <script>
  110. $ppp=30;
  111. function print(){
  112. $ppp = 3000;
  113. $("#printer").jqprint();
  114. }
  115. $(document).ready(function() {
  116. var interval = setInterval(function () {
  117. if($ppp<1)
  118. {
  119. // clearInterval(interval);
  120. $ppp = 30;
  121. $("#search-btn").click();
  122. }else{
  123. $("#timermsglabel").html($ppp+"秒后自动刷新页面");
  124. $ppp--;
  125. }
  126. },1000);
  127. });
  128. function load_index(self,key){
  129. $(self).addClass('active').siblings().removeClass('active')
  130. $("#is_spot").val(key);
  131. $("#search-btn").click();
  132. }
  133. function load_index1(self,key){
  134. $(self).addClass('av').siblings().removeClass('av')
  135. $("#is_ok").val(key);
  136. $("#search-btn").click();
  137. }
  138. $('#down').click(function () {
  139. var url = "{:url('export')}";
  140. var param = $('#form-search').serialize();
  141. window.location.href = url+'?ex_type=1&'+param;
  142. })
  143. $('#down1').click(function () {
  144. var url = "{:url('export')}";
  145. var param = $('#form-search').serialize();
  146. window.location.href = url+'?ex_type=2&'+param;
  147. })
  148. //print_all
  149. $('#down2').click(function () {
  150. var url = "{:url('print_all')}";
  151. var param = $('#form-search').serialize();
  152. // var tempwindow=window.open('_blank'); // 先打开页面
  153. // tempwindow.location=url+'?'+param;// 后更改页面地址
  154. window.location.href = url+'?'+param;
  155. })
  156. $(function () {
  157. $(window).bind("resize",function(){
  158. var width=$(".jqGrid_wrapper").width();
  159. $("#table").setGridWidth(width);
  160. });
  161. $.jgrid.defaults.styleUI="Bootstrap";
  162. $("#table").jqGrid({
  163. url:"{:url('index')}",
  164. datatype: "json",
  165. colModel:[
  166. // {label:'编号',name:'id',index:'id',width:100,editable: false,sortable: false,formatter:function (a,b,c){
  167. // return '<span style="background-color: black;color: white" class="label">#'+a+'</span>'
  168. // }},
  169. {label:'订单号',name:'sn',index:'sn',width:150,sortable: false},
  170. {label:'总价',name:'price',index:'price',width:100,sortable: false},
  171. {label:'下单人',name:'name',index:'name',width:200,editable: false,sortable: false,formatter:function (a,b,c){
  172. return ''+c.name+'<br />'+c.mobile+'<br />'+c.address+''
  173. }},
  174. {label:'下单时间',name:'pay_time',index:'pay_time',width:150,sortable: false},
  175. // {label:'类型',name:'tName',index:'tName',width:120,editable: false,sortable: false,formatter:function (a,b,c){
  176. // return a;
  177. //
  178. // }},
  179. {label:'购买物品',name:'item',index:'item',width:150,editable: false,sortable: false,formatter:function (a,b,c){
  180. return a;
  181. }},
  182. {label:'床号及备注',name:'remark',index:'remark',width:120,sortable: false},
  183. {label:'操作',width:200,sortable: false,formatter: function (a, b, c) {
  184. var print = "{:url('print',[],'')}/id/"+c.id;
  185. var url1 = "{:url('option',[],'')}/fv/1/id/"+c.id;
  186. var url2 = "{:url('option',[],'')}/fv/2/id/"+c.id;
  187. var btn = '<a url="'+print+'" href="javascript:;" data-title="打印" onclick="layer_open(this,0)"><span class="label label-primary" title="打印">打印</span></a>&nbsp;';
  188. if(c.is_ok==0 && c.cate == 0){
  189. btn += '<a href="'+url1+'" class="confirm ajax-get" data-confirm="确定要操作此记录吗?" data-table="1"><span class="label label-primary" title="标记为完成">完成</span></a>&nbsp;';
  190. btn += '<a href="'+url2+'" class="confirm ajax-get" data-confirm="确定要操作此记录吗?" data-table="1"><span class="label label-primary" title="标记为取消">取消</span></a>';
  191. }
  192. if(c.cate == 1){
  193. var print = "{:url('refund',[],'')}/id/"+c.id;
  194. btn += '<a url="'+print+'" href="javascript:;" data-title="退餐" onclick="layer_open(this,0)"><span class="label label-primary" title="退餐">退餐</span></a>&nbsp;';
  195. }
  196. return btn;
  197. }},
  198. ],
  199. rowNum:10,
  200. rowList:[10,20,30,50,100],
  201. pager: '#pager',
  202. sortname: 'id',
  203. viewrecords: true,
  204. autowidth:true,
  205. autoScroll: false,
  206. shrinkToFit: true,
  207. mtype: 'post',
  208. height: 'auto',
  209. emptyrecords: "暂无数据",
  210. sortorder: "desc",
  211. caption:"订单列表",
  212. loadComplete: function (xhr) {
  213. if(xhr.code==0){
  214. layer.msg(xhr.msg);
  215. return false;
  216. }
  217. },
  218. });
  219. /*固定表头及侧边*/
  220. $("#table").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "auto" });
  221. $("#table").jqGrid('setFrozenColumns');
  222. });
  223. </script>
  224. {/block}