edit.blade.php 10 KB

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