edit.blade.php 11 KB

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