create.blade.php 10 KB

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