create.blade.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. @extends('layouts.app')
  2. @section('title')手动录入@endsection
  3. @section('content')
  4. <div id="nav2">
  5. @component('weight.menu')@endcomponent
  6. </div>
  7. <div class="container-fluid" id="package">
  8. <div class="card col-md-8 offset-md-2">
  9. <div class="card-body">
  10. <form method="POST" action="{{ url('package') }}">
  11. @csrf
  12. @if(Session::has('successTip'))
  13. <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
  14. @endif
  15. @if(Session::has('successError'))
  16. <div class="alert alert-danger h1">{{Session::get('successError')}}</div>
  17. @endif
  18. <ul class="nav nav-tabs col-8 offset-2" style="transform: scale(0.97)">
  19. <li class="nav-item" @click="windowSwitchBatch">
  20. <a class="nav-link" :class="[windowStatus.batch_input ?'active' : '']" href="#">波次号</a></li>
  21. <li class="nav-item" @click="windowSwitchLogistic">
  22. <a class="nav-link" :class="[windowStatus.logistic_input ?'active' : '']" href="#">快递单号</a></li>
  23. </ul>
  24. <div class="" v-if="windowStatus.logistic_input">
  25. <div class="form-group row">
  26. <label for="name" class="col-2 col-form-label text-right">快递单号</label>
  27. <div class="col-8">
  28. <input type="text" class="form-control @error('logistic_number') is-invalid @enderror"
  29. name="logistic_number" autocomplete="off" value="{{ old('logistic_number')}}">
  30. @error('logistic_number')
  31. <span class="invalid-feedback" role="alert">
  32. <strong>{{ $errors->first('logistic_number') }}</strong>
  33. </span>
  34. @enderror
  35. </div>
  36. </div>
  37. </div>
  38. <div class="text-danger" v-if="windowStatus.batch_input">
  39. <div class="form-group row">
  40. <label for="batch_number" class="col-2 col-form-label text-right">波次号</label>
  41. <div class="col-8">
  42. <input type="text" class="form-control @error('batch_number') is-invalid @enderror"
  43. name="batch_number" autocomplete="off" value="{{ old('batch_number')}}">
  44. @error('batch_number')
  45. <span class="invalid-feedback" role="alert">
  46. <strong>{{ $errors->first('batch_number') }}</strong>
  47. </span>
  48. @enderror
  49. </div>
  50. </div>
  51. </div>
  52. <div class="form-group row">
  53. <label for="weight" class="col-2 col-form-label text-right">重量</label>
  54. <div class="col-8">
  55. <input type="text" class="form-control @error('weight') is-invalid @enderror"
  56. name="weight" autocomplete="off" value="{{ old('weight')}}" required>
  57. @error('weight')
  58. <span class="invalid-feedback" role="alert">
  59. <strong>{{ $errors->first('weight') }}</strong>
  60. </span>
  61. @enderror
  62. </div>
  63. </div>
  64. <div class="form-group row" v-if="windowStatus.batch_input">
  65. <label for="weight" class="col-2 col-form-label text-right">强行当作活动波次</label>
  66. <div class="col-8">
  67. <input type="checkbox" class="form-control-sm" name="is_same_pack_batch" v-model="inputting.is_same_pack_batch">
  68. </div>
  69. </div>
  70. <div class="form-group row">
  71. <label for="paper_box_id" class="col-2 col-form-label text-right">纸箱</label>
  72. <div class="col-8 form-inline">
  73. <select name="paper_box_id" class="form-control @error('paper_box_id') is-invalid @enderror" v-model="paperBox_id" style="width: 30%;">
  74. <option v-for="paperBox in paperBoxes" :value="paperBox.id">@{{paperBox.model}}</option>
  75. </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  76. <input class="form-control-sm" style="width: 150px" placeholder="搜索定位" @input="paperBox_seek">&nbsp;&nbsp;&nbsp;
  77. </div>
  78. </div>
  79. <div class="form-group row">
  80. <div class="col-8 offset-2">
  81. <input type="button" @click="x" class="btn btn-success form-control" value="提交"/>
  82. </div>
  83. </div>
  84. </form>
  85. </div>
  86. </div>
  87. </div>
  88. @endsection
  89. @section('lastScript')
  90. <script>
  91. let vue=new Vue({
  92. el:"#package",
  93. data:{
  94. inputting:{is_same_pack_batch:false},
  95. paperBoxes:[
  96. @foreach($paperBoxes as $paperBox)
  97. {id:'{{$paperBox->id}}',model:'{{$paperBox->model}}'},
  98. @endforeach
  99. ],
  100. paperBox_id:'',
  101. windowStatus:{logistic_input:false, batch_input:true},
  102. },
  103. methods:{
  104. paperBox_seek:function (e) {
  105. let _this=this;
  106. let $val=e.target.value;
  107. if($val==='')_this.paperBox_id='';
  108. else
  109. _this.paperBoxes.forEach(function (paperBox) {
  110. if (paperBox.model.includes($val)){
  111. _this.paperBox_id=paperBox.id;
  112. }
  113. });
  114. },
  115. windowSwitchLogistic:function (e) {
  116. this.windowStatus.logistic_input=true;
  117. this.windowStatus.batch_input=false;
  118. this.inputting.is_same_pack_batch=false;
  119. },
  120. windowSwitchBatch:function (e) {
  121. this.windowStatus.logistic_input=false;
  122. this.windowStatus.batch_input=true;
  123. this.inputting.is_same_pack_batch=false;
  124. },
  125. x:function (e) {
  126. if(this.inputting.is_same_pack_batch){
  127. if(!confirm('当前波次将被强行当作活动波次处理,该操作会将波次内所有订单重量统一,请确定您的操作无误!')){
  128. return false;
  129. }
  130. }
  131. $(e.target).parents('form').submit();
  132. return true;
  133. },
  134. },
  135. });
  136. </script>
  137. @endsection