houselist.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2017/5/23 0023
  6. * Time: 下午 8:24
  7. */
  8. use yii\helpers\Url;
  9. use yii\widgets\LinkPager;
  10. ?>
  11. <div class="row">
  12. <div class="col-sm-12">
  13. <div class="ibox float-e-margins">
  14. <div class="ibox-content">
  15. <div class="row">
  16. <div class="col-sm-5 m-b-xs">
  17. <div class="col-sm-9">
  18. </div>
  19. </div>
  20. </div>
  21. <div class="table-responsive">
  22. <table class="table table-striped">
  23. <thead>
  24. <tr>
  25. <th>id</th>
  26. <th>房屋主人</th>
  27. <th>小区名称</th>
  28. <th>户型</th>
  29. <th>面积</th>
  30. <th>预算</th>
  31. <th>位置</th>
  32. <th>更新时间</th>
  33. <th>删除</th>
  34. </tr>
  35. </thead>
  36. <tbody>
  37. <?php if(!empty($datas)):?>
  38. <?php foreach($datas as $data):?>
  39. <tr>
  40. <td><?=$data->id?></td>
  41. <?php $nickname = isset($data->nickname)?$data->nickname:''?>
  42. <td><?=isset($nickname->nickname)?$nickname->nickname:''?></td>
  43. <?php $userinfo = isset($data->userinfo)?$data->userinfo:''?>
  44. <td><?=isset($data->compound)?$data->compound:''?></td>
  45. <td><?=isset($data->layout)?$data->layout:''?></td>
  46. <td><?=isset($data->acreage)?$data->acreage:''?></td>
  47. <td><?=isset($data->amount)?$data->amount:''?></td>
  48. <td><?=isset($data->province)?$data->province:''?>
  49. <?=isset($data->city)?$data->city:''?>
  50. <?=isset($data->district)?$data->district:''?>
  51. <?=isset($data->address)?$data->address:''?></td>
  52. <?unset($userinfo)?>
  53. <td><?=date('Y-m-d H:i',$data->updated_at)?></td>
  54. <td>
  55. <a class="btn btn-sm btn-danger del"data="<?= $data->id?>">删除</a>
  56. </td>
  57. </tr>
  58. <?php endforeach;?>
  59. <?php endif?>
  60. </tbody>
  61. </table>
  62. </div>
  63. </div>
  64. </div>
  65. <?= LinkPager::widget(['pagination' => $pages]); ?>
  66. </div>
  67. </div>
  68. <script>
  69. $(".introduce").click(function(){
  70. var introduce = $(this).find('.introduce-val').val();
  71. var company = $(this).text();
  72. parent.layer.open({//layer弹窗插件语法
  73. title: company+'简介',//标题
  74. anim: 1 ,//动画类型有0-6,不想显示动画,设置 anim: -1
  75. scrollbar: false,//默认允许浏览器滚动,如果设定scrollbar: false,则屏蔽
  76. area: ['500px', '300px'],//自定义宽高
  77. content: '<textarea class="content" rows="6" cols="62">'+introduce+'</textarea>',//自定义内容
  78. shade: [0.8, '#393D49'],//默认是0.3透明度的黑色背景('#000'),不想显示遮罩shade: 0
  79. shadeClose:true,//控制点击弹层外区域关闭
  80. btn: ['确认'],//自定义按钮,默认第一个为确定按钮
  81. btnAlign: 'c',//按钮显示方式 'l' 按钮左对齐 'c' 按钮居中对齐 'r' 按钮右对齐(默认)
  82. btn1:function(index, content){
  83. }
  84. });
  85. });
  86. $('.table-responsive').on('click','.del',function(){
  87. var id = $(this).attr('data');
  88. var text = $(this);
  89. swal({
  90. title: "确定删除?",
  91. type: "warning",
  92. showCancelButton: true,
  93. confirmButtonColor: "#DD6B55",
  94. confirmButtonText: "确定",
  95. cancelButtonText: "取消",
  96. closeOnConfirm: true,
  97. closeOnCancel: true },
  98. function(isConfirm){
  99. if (isConfirm) {
  100. $.ajax({
  101. url:'<?=Url::toRoute(['user/del_house']);?>',
  102. type:'POST',
  103. dataType:'json',
  104. data:{id:id,'_csrf-backend':'<?=Yii::$app->request->csrfToken;?>'},
  105. success:function(data){
  106. if(data.sign==1){
  107. text.parents('tr').remove();
  108. }else{
  109. swal("", data.msg, "error");
  110. }
  111. }
  112. })
  113. }
  114. });
  115. })
  116. </script>