index.blade.php 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. <th>录入时间</th>
  24. <th>操作</th>
  25. </tr>
  26. <tr v-for="(model,i) in models" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
  27. <td>@{{ i+1 }}</td>
  28. <td>@{{ model.name }}</td>
  29. <td>@{{ model.counting_type }}</td>
  30. <td>@{{ model.using_type }}</td>
  31. <td>@{{ model.minimum_area }}</td>
  32. <td>
  33. <small v-for="owner in model.owners">@{{ owner.name }}<br></small>
  34. </td>
  35. <td>@{{ model.price }}/@{{ model.unit_name }}/@{{ model.time_unit_name }}</td>
  36. <td>@{{ model.discount_type }}</td>
  37. <td>@{{ model.discount_value }}</td>
  38. <td>@{{ model.created_at }}</td>
  39. <td>
  40. @can("计费模型-仓储-编辑")<a :href="'{{url('maintenance/priceModel/storage')}}/'+model.id+'/edit'"><button class="btn btn-sm btn-outline-info">改</button></a>@endcan
  41. @can("计费模型-仓储-删除")<button class="btn btn-sm btn-outline-danger" @click="destroy(model.id,i)">删</button>@endcan
  42. </td>
  43. </tr>
  44. </table>
  45. {{$models->links()}}
  46. </div>
  47. @stop
  48. @section("lastScript")
  49. <script>
  50. new Vue({
  51. el:"#container",
  52. data:{
  53. models : [
  54. @foreach($models as $model)
  55. {
  56. id : "{{$model->id}}",
  57. name : "{{$model->name}}",
  58. counting_type : "{{$model->counting_type}}",
  59. using_type : "{{$model->using_type}}",
  60. minimum_area : "{{$model->minimum_area}}",
  61. price : "{{$model->price}}",
  62. discount_type : "{{$model->discount_type}}",
  63. discount_value : "{{$model->discount_value}}",
  64. unit_name : "{{$model->unit ? $model->unit->name : ''}}",
  65. time_unit_name : "{{$model->timeUnit ? $model->timeUnit->name : ''}}",
  66. created_at : "{{$model->created_at}}",
  67. owners:{!! $model->owners !!},
  68. },
  69. @endforeach
  70. ],
  71. selectTr:0
  72. },
  73. methods:{
  74. destroy(id,index){
  75. window.tempTip.confirm("确定要删除该仓储计费吗?",()=>{
  76. window.axios.delete("{{url('maintenance/priceModel/storage')}}/"+id)
  77. .then(res=>{
  78. if (res.data.success){
  79. this.$delete(this.models,index);
  80. window.tempTip.setDuration(2000);
  81. window.tempTip.showSuccess("删除成功");
  82. return;
  83. }
  84. window.tempTip.setDuration(3000);
  85. window.tempTip.show(res.data.data);
  86. }).catch(err=>{
  87. window.tempTip.setDuration(3000);
  88. window.tempTip.show("网络错误:"+err);
  89. })
  90. })
  91. }
  92. },
  93. });
  94. </script>
  95. @stop