edit.blade.php 11 KB

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