offer.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2017/3/17 0017
  6. * Time: 上午 10:52
  7. */
  8. use yii\helpers\Url;
  9. use yii\widgets\LinkPager;
  10. ?>
  11. <div class="panel panel-default">
  12. <div class="panel-heading">
  13. <h3 class="panel-title"><?=$name ?></h3>
  14. </div>
  15. <div class="panel-body">
  16. <form id="search_form" action="<?=Url::toRoute(['offerdesign/offer']);?>" method="get">
  17. <div class="row">
  18. <div class="form-group">
  19. <div class="col-sm-6">
  20. <input placeholder="开始日期" value="<?= $search['start']?>" name="start" class="form-control layer-date" id="start">
  21. <input placeholder="结束日期" value="<?= $search['end']?>" name="end" class="form-control layer-date" id="end">
  22. </div>
  23. <div class="col-sm-3">
  24. <div class="input-group">
  25. <button id="search_button" type="submit" class="btn btn-sm btn-primary search-button"> 搜索</button>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. </form>
  31. </div>
  32. <table class="table">
  33. <tr>
  34. <th>姓名</th>
  35. <th>电话</th>
  36. <th>城市</th>
  37. <th>面积</th>
  38. <th>户型</th>
  39. <th>创建时间</th>
  40. <th>操作</th>
  41. </tr>
  42. <?php foreach ($models as $vo):?>
  43. <tr >
  44. <td><?=$vo->nickname;?></td>
  45. <td><?=$vo->tel;?></td>
  46. <td><?= isset($vo->city)?$vo->city->area:"" ?></td>
  47. <td><?=$vo->acreage;?></td>
  48. <td><?=$vo->layout;?></td>
  49. <td><?=date('Y-m-d H:i',$vo->c_time);?></td>
  50. <td>
  51. <a data-id="<?=$vo->id?>" class="btn btn-danger btn-sm " href="javascript:void(0);" ><i class="fa fa-trash"></i> 删除</a>
  52. </td>
  53. </tr>
  54. <?php endforeach;?>
  55. </table>
  56. </div>
  57. <?=LinkPager::widget(['pagination' => $pages]); ?>
  58. <script type="text/javascript">
  59. var start = {
  60. elem: "#start",
  61. //format: "YYYY/MM/DD hh:mm:ss",
  62. //min: laydate.now(),
  63. max: "<?=date('Y-m-d')?>",
  64. //istime: true,
  65. istoday: false,
  66. choose: function(datas) {
  67. //console.log(datas);
  68. //end.min = datas;
  69. //end.start = datas;
  70. }
  71. };
  72. var end = {
  73. elem: "#end",
  74. //format: "YYYY/MM/DD hh:mm:ss",
  75. //min: laydate.now(),
  76. max: "<?=date('Y-m-d')?>",
  77. //istime: true,
  78. istoday: false,
  79. choose: function(datas) {
  80. // start.max = datas;
  81. }
  82. };
  83. laydate(start);
  84. laydate(end);
  85. $('.btn-danger').on('click',function(){
  86. var id = $(this).attr('data-id');
  87. var text = $(this);
  88. swal({
  89. title: "确定删除该记录?",
  90. type: "warning",
  91. showCancelButton: true,
  92. confirmButtonColor: "#DD6B55",
  93. confirmButtonText: "确定",
  94. cancelButtonText: "取消",
  95. closeOnConfirm: true,
  96. closeOnCancel: true },
  97. function(isConfirm){
  98. if (isConfirm) {
  99. $.ajax({
  100. url:'<?=Url::toRoute(['offerdesign/del-offer']);?>',
  101. type:'POST',
  102. dataType:'json',
  103. data:{id:id,'<?=Yii::$app->request->csrfParam;?>':'<?=Yii::$app->request->csrfToken;?>'},
  104. success:function(data){
  105. if(data.sign==1){
  106. text.parents('tr').remove();
  107. toastr.success("", data.msg);
  108. }else{
  109. swal("", data.msg, "error");
  110. }
  111. }
  112. })
  113. }
  114. });
  115. });
  116. </script>