index.blade.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. @extends('layouts.app')
  2. @section('title')计费模型-仓储计费@endsection
  3. @section('content')
  4. <div id="nav2">
  5. @component('maintenance.menu')@endcomponent
  6. @component('maintenance.priceModel.storage.menu')@endcomponent
  7. </div>
  8. <div class="container-fluid mt-2" id="container">
  9. @if(Session::has('successTip'))
  10. <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
  11. @endif
  12. <table class="table table-hover table-striped text-nowrap">
  13. <tr>
  14. <th>序号</th>
  15. <th>计费类型</th>
  16. <th>用仓类型</th>
  17. <th>最低起租面积</th>
  18. <th>单价</th>
  19. <th>减免类型</th>
  20. <th>减免值</th>
  21. <th>录入时间</th>
  22. <th>操作</th>
  23. </tr>
  24. <tr v-for="(model,i) in models">
  25. <td>@{{ i+1 }}</td>
  26. <td>@{{ model.counting_type }}</td>
  27. <td>@{{ model.using_type }}</td>
  28. <td>@{{ model.minimum_area }}</td>
  29. <td>@{{ model.price }}/@{{ model.unit_name }}</td>
  30. <td>@{{ model.discount_type }}</td>
  31. <td>@{{ model.discount_value }}</td>
  32. <td>@{{ model.created_at }}</td>
  33. <td>
  34. @can("计费模型-仓储-编辑")<a :href="'{{url('maintenance/priceModel/storage')}}/'+model.id+'/edit'"><button class="btn btn-sm btn-outline-info">改</button></a>@endcan
  35. @can("计费模型-仓储-删除")<button class="btn btn-sm btn-outline-danger" @click="destroy(model.id,i)">删</button>@endcan
  36. </td>
  37. </tr>
  38. </table>
  39. {{$models->links()}}
  40. </div>
  41. @stop
  42. @section("lastScript")
  43. <script>
  44. new Vue({
  45. el:"#container",
  46. data:{
  47. models : [
  48. @foreach($models as $model)
  49. {
  50. id : "{{$model->id}}",
  51. counting_type : "{{$model->counting_type}}",
  52. using_type : "{{$model->using_type}}",
  53. minimum_area : "{{$model->minimum_area}}",
  54. price : "{{$model->price}}",
  55. discount_type : "{{$model->discount_type}}",
  56. discount_value : "{{$model->discount_value}}",
  57. unit_name : "{{$model->unit ? $model->unit->name : ''}}",
  58. created_at : "{{$model->created_at}}",
  59. },
  60. @endforeach
  61. ],
  62. },
  63. methods:{
  64. destroy(id,index){
  65. window.tempTip.confirm("确定要删除该仓储计费吗?",()=>{
  66. window.axios.delete("{{url('maintenance/priceModel/storage')}}/"+id)
  67. .then(res=>{
  68. if (res.data.success){
  69. this.$delete(this.models,index);
  70. window.tempTip.setDuration(2000);
  71. window.tempTip.showSuccess("删除成功");
  72. return;
  73. }
  74. window.tempTip.setDuration(3000);
  75. window.tempTip.show(res.data.data);
  76. }).catch(err=>{
  77. window.tempTip.setDuration(3000);
  78. window.tempTip.show("网络错误:"+err);
  79. })
  80. })
  81. }
  82. },
  83. });
  84. </script>
  85. @stop