create.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. @extends('layouts.app')
  2. @section('title')新建价格模型@endsection
  3. @section('content')
  4. <div id="nav2">
  5. @component('maintenance.menu')@endcomponent
  6. @component('maintenance.priceModel.waybillPriceModel.menu')@endcomponent
  7. </div>
  8. <div class="container-fluid" id="list">
  9. <div class="card col-md-8 offset-md-2">
  10. <div class="card-body">
  11. <form method="POST" action="{{ url('maintenance/priceModel/waybillPriceModel') }}">
  12. @if(Session::has('successTip'))
  13. <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
  14. @endif
  15. @csrf
  16. <div class="form-group row">
  17. <label for="carrier_id" class="col-2 col-form-label text-right">承运商</label>
  18. <div class="col-8">
  19. <select class="form-control" name="WaybillPriceModel[carrier_id]" style="width: 30%;" v-model="inputting.WaybillPriceModel.carrier_id">
  20. <option v-for="carrier in carriers" :value="carrier.id">@{{carrier.name}}</option>
  21. </select>
  22. <div class="col-sm-5">
  23. <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.carrier_id') }}</p>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="form-group row">
  28. <label for="province_id" class="col-2 col-form-label text-right">选择省份</label>
  29. <div class="col-8" >
  30. <select class="form-control" name="WaybillPriceModel[province_id]" style="width: 30%;" v-model="inputting.WaybillPriceModel.province_id" @change="changeProvince($event)">
  31. <option v-for="province in provinces" :value="province.id">@{{province.name}}</option>
  32. </select>
  33. <div class="col-sm-5">
  34. <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.province_id') }}</p>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="form-group row">
  39. <label for="city_id" class="col-2 col-form-label text-right">选择城市</label>
  40. <div class="col-8" >
  41. <select class="form-control" name="WaybillPriceModel[city_id]" style="width: 30%;" v-model="inputting.WaybillPriceModel.city_id">
  42. <option v-for="city in cities" :value="city.id">@{{city.name}}</option>
  43. </select>
  44. <div class="col-sm-5">
  45. <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.city_id') }}</p>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="form-group row">
  50. <label for="unit_id" class="col-2 col-form-label text-right">货物单位</label>
  51. <div class="col-8" >
  52. <select class="form-control" name="WaybillPriceModel[unit_id]" style="width: 30%;" v-model="inputting.WaybillPriceModel.unit_id">
  53. <option v-for="unit in units" :value="unit.id">@{{unit.name}}</option>
  54. </select>
  55. <div class="col-sm-5">
  56. <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.unit_id') }}</p>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="form-group row">
  61. <label for="range_min" class="col-2 col-form-label text-right">计价区间</label>
  62. <div class="col-8 form-inline">
  63. <input type="text" style="width: 20%" class="form-control @error('WaybillPriceModel.range_min') is-invalid @enderror"
  64. name="WaybillPriceModel[range_min]" autocomplete="off" value="{{ old('WaybillPriceModel')['range_min'] }}" >&nbsp;&nbsp;--&nbsp;&nbsp;
  65. <input type="text" style="width: 20%" class="form-control @error('WaybillPriceModel.range_max') is-invalid @enderror"
  66. name="WaybillPriceModel[range_max]" autocomplete="off" value="{{ old('WaybillPriceModel')['range_max'] }}" >
  67. @error('WaybillPriceModel.range_min')
  68. <span class="invalid-feedback" role="alert">
  69. <strong>{{ $message }}</strong>
  70. </span>
  71. @enderror
  72. @error('WaybillPriceModel.range_max')
  73. <span class="invalid-feedback" role="alert">
  74. <strong>{{ $message }}</strong>
  75. </span>
  76. @enderror
  77. </div>
  78. </div>
  79. <div class="form-group row">
  80. <label for="unit_price" class="col-2 col-form-label text-right">单价</label>
  81. <div class="col-8">
  82. <input type="text" class="form-control @error('WaybillPriceModel.unit_price') is-invalid @enderror"
  83. name="WaybillPriceModel[unit_price]" autocomplete="off" value="{{ old('WaybillPriceModel')['unit_price'] }}" >
  84. @error('WaybillPriceModel.unit_price')
  85. <span class="invalid-feedback" role="alert">
  86. <strong>{{ $message }}</strong>
  87. </span>
  88. @enderror
  89. </div>
  90. </div>
  91. <div class="form-group row">
  92. <label for="base_fee" class="col-2 col-form-label text-right">起步费(元)</label>
  93. <div class="col-8">
  94. <input type="text" class="form-control @error('WaybillPriceModel.base_fee') is-invalid @enderror"
  95. name="WaybillPriceModel[base_fee]" autocomplete="off" value="{{ old('WaybillPriceModel')['base_fee'] }}" >
  96. @error('WaybillPriceModel.base_fee')
  97. <span class="invalid-feedback" role="alert">
  98. <strong>{{ $message }}</strong>
  99. </span>
  100. @enderror
  101. </div>
  102. </div>
  103. <div class="form-group row">
  104. <label for="initial_weight" class="col-2 col-form-label text-right">最低计数</label>
  105. <div class="col-8">
  106. <input type="text" class="form-control @error('WaybillPriceModel.initial_weight') is-invalid @enderror"
  107. name="WaybillPriceModel[initial_weight]" autocomplete="off" value="{{ old('WaybillPriceModel')['initial_weight'] }}" >
  108. @error('WaybillPriceModel.initial_weight')
  109. <span class="invalid-feedback" role="alert">
  110. <strong>{{ $message }}</strong>
  111. </span>
  112. @enderror
  113. </div>
  114. </div>
  115. <div class="form-group row">
  116. <div class="col-8 offset-2">
  117. <input type="submit" class="btn btn-success form-control">
  118. </div>
  119. </div>
  120. </form>
  121. </div>
  122. </div>
  123. </div>
  124. @endsection
  125. @section('lastScript')
  126. <script>
  127. let insertVue=new Vue({
  128. el:'#list',
  129. data:{
  130. inputting:{
  131. WaybillPriceModel:{
  132. @if(isset(old('WaybillPriceModel')['province_id']))
  133. province_id:'{{old('WaybillPriceModel')['province_id']}}',
  134. @endif
  135. @if(isset(old('WaybillPriceModel')['city_id']))
  136. city_id:'{{old('WaybillPriceModel')['city_id']}}',
  137. @endif
  138. @if(isset(old('WaybillPriceModel')['carrier_id']))
  139. carrier_id:'{{old('WaybillPriceModel')['carrier_id']}}',
  140. @endif
  141. @if(isset(old('WaybillPriceModel')['unit_id']))
  142. unit_id:'{{old('WaybillPriceModel')['unit_id']}}',
  143. @endif
  144. }
  145. },
  146. provinces:[
  147. @foreach($provinces as $province)
  148. {id:'{{$province->id}}',name:'{{$province->name}}' },
  149. @endforeach
  150. ],
  151. cities:[
  152. ],
  153. carriers:[
  154. @foreach($carriers as $carrier)
  155. {id:'{{$carrier->id}}',name:'{{$carrier->name}}'},
  156. @endforeach
  157. ],
  158. units:[
  159. @foreach($units as $unit)
  160. {id:'{{$unit->id}}',name:'{{$unit->name}}'},
  161. @endforeach
  162. ],
  163. },
  164. methods:{
  165. changeProvince(e){
  166. let _this=this;
  167. let val=e.target.value;
  168. axios.get('cities/'+val).then(
  169. function (response) {
  170. _this.cities=response.data.cities;
  171. }
  172. );
  173. }
  174. },
  175. });
  176. </script>
  177. @endsection