index.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="ibox">
  4. <div class="ibox-content">
  5. <div class="row">
  6. <div class="col-xs-12" style="text-align: right;">
  7. <form class="form-inline" id="form-search" action="{:url('index')}">
  8. <div class="input-group">
  9. <input type="text" class="form-control" name="orderSn" placeholder="订单编号">
  10. </div>
  11. <div class="input-group">
  12. <input type="text" class="form-control" name="name" placeholder="姓名">
  13. </div>
  14. <!--<div class="input-group">
  15. <select name="cate" class="form-control">
  16. <option value="">选择类型</option>
  17. <option value="1">早餐</option>
  18. <option value="2">午餐</option>
  19. <option value="3">晚餐</option>
  20. <option value="4">当日餐</option>
  21. </select>
  22. </div>-->
  23. <div class="input-group">
  24. <select name="status" class="form-control">
  25. <option value="">选择状态</option>
  26. <option value="1">已预订</option>
  27. <option value="2">已取消</option>
  28. </select>
  29. </div>
  30. <div class="input-group">
  31. <span class="input-group-btn">
  32. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  33. </span>
  34. <span class="input-group-btn">
  35. <button class="btn-sm btn-warning " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  36. </span>
  37. </div>
  38. </form>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="ibox-content">
  43. <div class="jqGrid_wrapper">
  44. <table id="table" style="border-collapse: collapse"></table>
  45. <div id="pager"></div>
  46. </div>
  47. </div>
  48. </div>
  49. {/block}
  50. {block name="script"}
  51. <script>
  52. $(function () {
  53. $(window).bind("resize",function(){
  54. var width=$(".jqGrid_wrapper").width();
  55. $("#table").setGridWidth(width);
  56. });
  57. $.jgrid.defaults.styleUI="Bootstrap";
  58. $("#table").jqGrid({
  59. url:"{:url('index')}",
  60. datatype: "json",
  61. colModel:[
  62. {label:'订单号',name:'order_sn',index:'order_sn', width:60,sortable: false},
  63. {label:'价格',name:'amount',index:'amount', width:40,sortable: false},
  64. /*{label:'类型',name:'cate',index:'cate', width:40,sortable: false,formatter:function (a,b,c){
  65. if(a == 1){
  66. return '早餐';
  67. } else if(a == 2){
  68. return '午餐';
  69. } else if(a == 3){
  70. return '晚餐';
  71. } else{
  72. return '当日餐';
  73. }
  74. }},*/
  75. // {label:'配送时间',name:'delivery_time',index:'delivery_time', width:40,sortable: false},
  76. {label:'姓名',name:'name',index:'name', width:40,sortable: false},
  77. {label:'电话',name:'phone',index:'phone', width:40,sortable: false},
  78. {label:'下单日期',name:'create_time',index:'create_time', width:60,sortable: false},
  79. {label:'状态',name:'status',index:'status',width:40,editable: false,sortable: false,formatter:function (a,b,c){
  80. if(a == 1){
  81. return '已预订';
  82. } else{
  83. return '已取消';
  84. }
  85. }},
  86. {label:'操作',width:80,sortable: false,formatter: function (a, b, c) {
  87. var editurl = "{:url('detail',[],'')}/id/"+c.id;
  88. var cancelurl = "{:url('cancel',[],'')}/id/"+c.id;
  89. var delurl = "{:url('del',[],'')}/id/"+c.id;
  90. var btn = '<a href="'+editurl+'"><span class="label label-primary" title="详情">详情</span></a>&nbsp;';
  91. if(c.status == 1){
  92. btn += '<a href="'+cancelurl+'" class="confirm ajax-get" data-confirm="确定要取消此订单吗?" data-table="1"><span class="label label-warning" title="取消">取消</span></a>&nbsp;';
  93. }
  94. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此订单吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  95. return btn;
  96. }},
  97. ],
  98. rowNum:10,
  99. rowList:[10,20,30,50,100],
  100. pager: '#pager',
  101. sortname: 'id',
  102. viewrecords: true,
  103. autowidth:true,
  104. mtype: 'post',
  105. height: 'auto',
  106. emptyrecords: "暂无数据",
  107. sortorder: "desc",
  108. caption:"{$meta_title}",
  109. loadComplete: function (xhr) {
  110. if(xhr.code==0){
  111. layer.msg(xhr.msg);
  112. return false;
  113. }
  114. },
  115. });
  116. });
  117. </script>
  118. {/block}