create.blade.php 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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')
  7. @if(isset($model))
  8. <li class="nav-item">
  9. <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',5)}">编辑</a>
  10. </li>
  11. @endif
  12. @endcomponent
  13. </div>
  14. <div class="container-fluid mt-2 card" id="container">
  15. <form method="POST" :action="model.id ? '{{url('maintenance/priceModel/storage/update')}}' : '{{url('maintenance/priceModel/storage/store')}}'" class="card-body offset-3">
  16. @csrf
  17. <label hidden><input :value="model.id" name="id"></label>
  18. <div class="row">
  19. <label for="name" class="col-2">名称</label>
  20. <input id="name" type="text" name="name" class="col-6 form-control"
  21. :class="errors.name ? 'is-invalid' : ''" v-model="model.name">
  22. <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.name">
  23. <strong>@{{ errors.name[0] }}</strong>
  24. </span>
  25. </div>
  26. <div class="row mt-3">
  27. <label class="col-2" for="owner_id">项目</label>
  28. <select id="owner_id" class="selectpicker" multiple data-live-search="true" title="项目(多选)" v-model="model.owner_id">
  29. <option v-for="owner in owners" :value="owner.id">@{{ owner.name }}</option>
  30. </select>
  31. <label hidden><input :value="model.owner_id" name="owner_id"></label>
  32. </div>
  33. <div class="row mt-3">
  34. <label for="counting_type" class="col-2 text-info">计费类型</label>
  35. <select id="counting_type" name="counting_type" class="col-3 form-control"
  36. :class="errors.counting_type ? 'is-invalid' : ''" v-model="model.counting_type">
  37. <option v-for="type in counting_type" :value="type">@{{ type }}</option>
  38. </select>
  39. <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.counting_type">
  40. <strong>@{{ errors.counting_type[0] }}</strong>
  41. </span>
  42. </div>
  43. <div class="row mt-3">
  44. <label for="using_type" class="col-2 text-info">用仓类型</label>
  45. <select id="using_type" name="using_type" class="col-3 form-control"
  46. :class="errors.using_type ? 'is-invalid' : ''" v-model="model.using_type">
  47. <option v-for="type in using_type" :value="type">@{{ type }}</option>
  48. </select>
  49. <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.using_type">
  50. <strong>@{{ errors.using_type[0] }}</strong>
  51. </span>
  52. </div>
  53. <div class="row mt-3">
  54. <label for="minimum_area" class="col-2">最低起租面积</label>
  55. <input id="minimum_area" type="number" min="0" step="0.001" name="minimum_area" class="col-6 form-control"
  56. :class="errors.minimum_area ? 'is-invalid' : ''" v-model="model.minimum_area">
  57. <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.minimum_area">
  58. <strong>@{{ errors.minimum_area[0] }}</strong>
  59. </span>
  60. </div>
  61. <div class="row mt-3">
  62. <div class="col-5 row">
  63. <label for="price" class="col-4 text-info">单价</label>
  64. <input id="price" type="number" min="0" step="0.001" name="price" class="col-7 offset-1 form-control" required
  65. :class="errors.price ? 'is-invalid' : ''" v-model="model.price">
  66. <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.price">
  67. <strong>@{{ errors.price[0] }}</strong>
  68. </span>
  69. </div>
  70. <div class="col-3 row">
  71. <label for="unit_id" class="col-4 text-info">单位</label>
  72. <select id="unit_id" name="unit_id" class="col-8 form-control" required
  73. :class="errors.unit_id ? 'is-invalid' : ''" v-model="model.unit_id">
  74. <option v-for="unit in units" :value="unit.id" v-if="unit.name == 'm²' || unit.name == '㎡' || unit.name == 'm³'">@{{ unit.name }}</option>
  75. </select>
  76. <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.unit_id">
  77. <strong>@{{ errors.unit_id[0] }}</strong>
  78. </span>
  79. </div>
  80. <div class="col-3 row">
  81. <label for="time_unit_id" class="col-4 text-info">计时</label>
  82. <select id="time_unit_id" name="time_unit_id" class="col-8 form-control" required
  83. :class="errors.time_unit_id ? 'is-invalid' : ''" v-model="model.time_unit_id">
  84. <option v-for="unit in units" :value="unit.id" v-if="unit.name == '日' || unit.name == '月'">@{{ unit.name }}</option>
  85. </select>
  86. <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.unit_id">
  87. <strong>@{{ errors.unit_id[0] }}</strong>
  88. </span>
  89. </div>
  90. </div>
  91. <div class="row mt-3">
  92. <label for="discount_type" class="col-2 text-info">减免类型</label>
  93. <select id="discount_type" name="discount_type" class="col-3 form-control"
  94. :class="errors.discount_type ? 'is-invalid' : ''" v-model="model.discount_type">
  95. <option v-for="type in discount_type" :value="type">@{{ type }}</option>
  96. </select>
  97. <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.discount_type">
  98. <strong>@{{ errors.discount_type[0] }}</strong>
  99. </span>
  100. </div>
  101. <div class="row mt-3">
  102. <label for="discount_value" class="col-2">减免值</label>
  103. <input id="discount_value" type="number" min="0" step="0.001" name="discount_value" class="col-6 form-control"
  104. :class="errors.discount_value ? 'is-invalid' : ''" v-model="model.discount_value">
  105. <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.discount_value">
  106. <strong>@{{ errors.discount_value[0] }}</strong>
  107. </span>
  108. </div>
  109. <div class="row mt-3 offset-1">
  110. <button type="submit" class="btn btn-success col-7">提交</button>
  111. </div>
  112. </form>
  113. </div>
  114. @stop
  115. @section("lastScript")
  116. <script>
  117. new Vue({
  118. el:"#container",
  119. data:{
  120. model : {
  121. 'id' : "{{isset($model) ? $model->id : ''}}",
  122. 'counting_type' : "{{old('counting_type') ?? (isset($model) ? $model->counting_type : '')}}",
  123. name : "{{old('name') ?? (isset($model) ? $model->name : '')}}",
  124. 'using_type' : "{{old('using_type') ?? (isset($model) ? $model->using_type : '')}}",
  125. 'minimum_area' : "{{old('minimum_area') ?? (isset($model) ? $model->minimum_area : '')}}",
  126. 'discount_value' : "{{old('discount_value') ?? (isset($model) ? $model->discount_value : '')}}",
  127. 'price' : "{{old('price') ?? (isset($model) ? $model->price : '')}}",
  128. 'discount_type' : "{{old('discount_type') ?? (isset($model) ? $model->discount_type : '')}}",
  129. 'unit_id' : "{{old('unit_id') ?? (isset($model) ? $model->unit_id : '')}}",
  130. 'time_unit_id' : "{{old('time_unit_id') ?? (isset($model) ? $model->time_unit_id : '')}}",
  131. owner_id:{!! old('owner_id') ? json_encode(old('owner_id')) : (isset($model) ? json_encode(array_column($model->owners->toArray(),"id")) : '[]') !!},
  132. },
  133. counting_type : ['包仓','灵活用仓','统单价'],
  134. using_type : ['常温','恒温'],
  135. discount_type : ['无减免','按单减免','固定减免'],
  136. units : [
  137. @foreach($units as $unit)
  138. {id:"{{$unit->id}}", name:"{{$unit->name}}"},
  139. @endforeach
  140. ],
  141. errors:{!! $errors !!},
  142. owners:[
  143. @foreach($owners as $model)
  144. {id:"{{$model->id}}",name:"{{$model->name}}"},
  145. @endforeach
  146. ],
  147. },
  148. });
  149. </script>
  150. @stop