123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2017/3/17 0017
- * Time: 上午 10:52
- */
- use yii\helpers\Url;
- use yii\widgets\LinkPager;
- ?>
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title"><?=$name ?></h3>
- </div>
- <div class="panel-body">
- <form id="search_form" action="<?=Url::toRoute(['offerdesign/offer']);?>" method="get">
- <div class="row">
- <div class="form-group">
- <div class="col-sm-6">
- <input placeholder="开始日期" value="<?= $search['start']?>" name="start" class="form-control layer-date" id="start">
- <input placeholder="结束日期" value="<?= $search['end']?>" name="end" class="form-control layer-date" id="end">
- </div>
- <div class="col-sm-3">
- <div class="input-group">
- <button id="search_button" type="submit" class="btn btn-sm btn-primary search-button"> 搜索</button>
- </div>
- </div>
- </div>
- </div>
- </form>
- </div>
- <table class="table">
- <tr>
- <th>姓名</th>
- <th>电话</th>
- <th>城市</th>
- <th>面积</th>
- <th>户型</th>
- <th>创建时间</th>
- <th>操作</th>
- </tr>
- <?php foreach ($models as $vo):?>
- <tr >
- <td><?=$vo->nickname;?></td>
- <td><?=$vo->tel;?></td>
- <td><?= isset($vo->city)?$vo->city->area:"" ?></td>
- <td><?=$vo->acreage;?></td>
- <td><?=$vo->layout;?></td>
- <td><?=date('Y-m-d H:i',$vo->c_time);?></td>
- <td>
- <a data-id="<?=$vo->id?>" class="btn btn-danger btn-sm " href="javascript:void(0);" ><i class="fa fa-trash"></i> 删除</a>
- </td>
- </tr>
- <?php endforeach;?>
- </table>
- </div>
- <?=LinkPager::widget(['pagination' => $pages]); ?>
- <script type="text/javascript">
- var start = {
- elem: "#start",
- //format: "YYYY/MM/DD hh:mm:ss",
- //min: laydate.now(),
- max: "<?=date('Y-m-d')?>",
- //istime: true,
- istoday: false,
- choose: function(datas) {
- //console.log(datas);
- //end.min = datas;
- //end.start = datas;
- }
- };
- var end = {
- elem: "#end",
- //format: "YYYY/MM/DD hh:mm:ss",
- //min: laydate.now(),
- max: "<?=date('Y-m-d')?>",
- //istime: true,
- istoday: false,
- choose: function(datas) {
- // start.max = datas;
- }
- };
- laydate(start);
- laydate(end);
- $('.btn-danger').on('click',function(){
- var id = $(this).attr('data-id');
- var text = $(this);
- swal({
- title: "确定删除该记录?",
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- closeOnConfirm: true,
- closeOnCancel: true },
- function(isConfirm){
- if (isConfirm) {
- $.ajax({
- url:'<?=Url::toRoute(['offerdesign/del-offer']);?>',
- type:'POST',
- dataType:'json',
- data:{id:id,'<?=Yii::$app->request->csrfParam;?>':'<?=Yii::$app->request->csrfToken;?>'},
- success:function(data){
- if(data.sign==1){
- text.parents('tr').remove();
- toastr.success("", data.msg);
- }else{
- swal("", data.msg, "error");
- }
- }
- })
- }
- });
- });
- </script>
|