mission.blade.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. @extends('layouts.app')
  2. @section('title')盘收一体-任务@endsection
  3. @section('content')
  4. <span id="nav2">
  5. @component('store.menu')@endcomponent
  6. @component('store.checkingReceive.menu')@endcomponent
  7. </span>
  8. <div id="container" class="d-none container-fluid">
  9. @include('store.checkingReceive._modal')
  10. <div class="modal fade" id="import" tabindex="-1" role="dialog" aria-hidden="true">
  11. <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
  12. <div class="modal-content">
  13. <div class="modal-body" style="text-align:center;height: 200px">
  14. <button type="button" id="popover" class="btn btn-danger"
  15. data-container="body" data-toggle="popover" data-placement="bottom"
  16. :data-content="popoverContent" data-html="true">
  17. 部分数据导入失败
  18. </button>
  19. <div class="mt-3">
  20. <label class="text-muted">表头字段示意(蓝色为必填项):</label><br>
  21. <label><b class="text-primary">货主</b>,SKU,商品名称,<b class="text-primary">条码</b>,<b class="text-primary">数量</b>,生产日期,失效日期,批号,唯一码</label><br>
  22. <label>
  23. <input name="file" hidden type="file" class="col-5" id="excelFile" @change="getFile($event)"
  24. {{--accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"--}}
  25. accept=".csv, .xlsx, .xls">
  26. </label>
  27. <button class="btn btn-dark col-5" @click="selectFile()">选择Excel文件</button><br>
  28. <small class="text-primary">@{{ excel.file ? excel.file.name : '' }}</small>
  29. </div>
  30. </div>
  31. <div class="modal-footer">
  32. <button class="col-12 btn btn-success" @click="importMission()">开始导入</button>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. <div id="form_div"></div>
  38. <div class="ml-2">
  39. <button class="btn btn-sm btn-outline-info" @click="openImport()">导入</button>
  40. </div>
  41. <table class="table table-sm text-nowrap table-bordered d-none" id="headerRoll"></table>
  42. <table class="table table-striped table-sm text-nowrap table-hover mt-1" id="headerParent">
  43. <tr id="header"></tr>
  44. <tr v-for="(storeCheckingReceive,i) in storeCheckingReceives">
  45. <td>@{{ i+1 }}</td>
  46. <td>@{{ storeCheckingReceive.id }}</td>
  47. <td>@{{ storeCheckingReceive.owner_name }}</td>
  48. <td class="font-weight-bold">@{{ storeCheckingReceive.status }}</td>
  49. <td>@{{ storeCheckingReceive.is_receive_diff }}</td>
  50. <td>@{{ storeCheckingReceive.asn }}</td>
  51. <td>@{{ storeCheckingReceive.is_asn_diff }}</td>
  52. <td>@{{ storeCheckingReceive.created_at }}</td>
  53. <td>
  54. @can('入库管理-盘收一体-盘收')<a v-if="storeCheckingReceive.status != '已收货'" target="_blank" :href="'{{url('store/checkingReceive/mission')}}/'+storeCheckingReceive.id">
  55. <button class="btn btn-sm btn-outline-dark">盘收</button>
  56. </a>@endcan
  57. <a target="_blank" :href="'{{url('store/checkingReceive/mission')}}/'+storeCheckingReceive.id+'?is_show=false'">
  58. <button class="btn btn-sm btn-outline-primary">查看</button>
  59. </a>
  60. @can('入库管理-盘收一体-盘收-编辑')
  61. <button v-if="storeCheckingReceive.status != '已收货'" class="btn btn-sm btn-outline-success" data-toggle="modal" data-target="#asnWindow" @click="thisIndex=i">
  62. <span v-if="storeCheckingReceive.asn">重新</span>匹配ASN号
  63. </button>@endcan
  64. @can('入库管理-快速入库')
  65. <button v-if="storeCheckingReceive.status=='已ASN入库' && storeCheckingReceive.is_receive_diff != '是' && storeCheckingReceive.is_asn_diff != '是' && storeCheckingReceive.status != '已收货'"
  66. class="btn btn-sm btn-outline-info" @click="receipt(i)">快速入库</button>
  67. @endcan
  68. </td>
  69. </tr>
  70. </table>
  71. {{$storeCheckingReceives->appends($params)->links()}}
  72. </div>
  73. @stop
  74. @section('lastScript')
  75. <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
  76. <script type="text/javascript" src="{{asset('js/queryForm/queryForm201010.js')}}"></script>
  77. <script>
  78. let vue = new Vue({
  79. el:"#container",
  80. data:{
  81. storeCheckingReceives:[
  82. @foreach($storeCheckingReceives as $storeCheckingReceive)
  83. {id:'{{$storeCheckingReceive->id}}',owner_name:'{{$storeCheckingReceive->owner ? $storeCheckingReceive->owner->name : ''}}',
  84. created_at:'{{$storeCheckingReceive->created_at}}',status:'{{$storeCheckingReceive->status}}',
  85. is_receive_diff:'{{$storeCheckingReceive->is_receive_diff}}',asn:'{{$storeCheckingReceive->asn}}',
  86. is_asn_diff:'{{$storeCheckingReceive->is_asn_diff}}',
  87. },
  88. @endforeach
  89. ],
  90. owners:[
  91. @foreach($owners as $owner)
  92. {name:'{{$owner->id}}',value:'{{$owner->name}}'},
  93. @endforeach
  94. ],
  95. checkData:[],
  96. sum:Number('{{$storeCheckingReceives->total()}}'),
  97. excel : {
  98. file : null,
  99. },
  100. popoverContent:'',
  101. thisIndex : '',
  102. asn : '',
  103. },
  104. mounted(){
  105. $('#container').removeClass('d-none');
  106. $(".tooltipTarget").tooltip({'trigger':'hover'});
  107. let _this = this;
  108. let data = [[
  109. {name:'created_at_start',type:'dateTime',tip:'选择显示指定日期的起始时间'},
  110. {name:'created_at_end',type:'dateTime',tip:'选择显示指定日期的结束时间'},
  111. {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
  112. placeholder:['货主','定位或多选货主'],data:_this.owners},
  113. {name:'asn',type:'input',tip:'ASN单号:可在两侧增加百分号(%)进行模糊搜索',placeholder:'ASN单号'},
  114. ]];
  115. _this.form = new query({
  116. el:'#form_div',
  117. condition:data,
  118. });
  119. _this.form.init();
  120. let column = [
  121. {name:'index',value: '序号', neglect: true},
  122. {name:'id',value: 'ID', neglect: true},
  123. {name:'owner_name',value: '货主'},
  124. {name:'status',value: '状态'},
  125. {name:'is_receive_diff',value: '收货差异'},
  126. {name:'asn',value: 'ASN单号'},
  127. {name:'is_asn_diff',value: 'ASN差异'},
  128. {name:'created_at',value: '创建时间'},
  129. {name:'operating',value: '操作', neglect: true},
  130. ];
  131. let header = new Header({
  132. el: "#header",
  133. column: column,
  134. data: _this.storeCheckingReceives,
  135. restorationColumn: 'id',
  136. });
  137. header.init();
  138. },
  139. methods:{
  140. checkAll(event){
  141. if (event.target.checked){
  142. this.packages.forEach((el)=>{
  143. if (this.checkData.indexOf(el.id) === '-1'){
  144. this.checkData.push(el.id);
  145. }
  146. });
  147. }else this.checkData = [];
  148. },
  149. getFile(e){
  150. this.excel.file = e.target.files[0];
  151. },
  152. openImport(){
  153. $("#popover").attr('hidden','hidden');
  154. $('#import').modal('show');
  155. },
  156. importMission(){
  157. if (!this.excel.file){
  158. tempTip.setDuration(3000);
  159. tempTip.setIndex(1099);
  160. tempTip.showSuccess('未选择任何文件!');
  161. return;
  162. }
  163. let formData = new FormData();
  164. formData.append("file",this.excel.file);
  165. axios.post('{{url('store/checkingReceive/mission/import')}}',formData,{
  166. 'Content-Type':'multipart/form-data'
  167. })
  168. .then(res=>{
  169. if (res.data.success){
  170. let receive = res.data.data;
  171. let storeCheckingReceive = {
  172. id:receive.id,owner_name:receive.owner_name,created_at:receive.created_at,
  173. status:receive.status,is_receive_diff:receive.is_receive_diff,asn:receive.asn,
  174. is_asn_diff:receive.is_asn_diff
  175. };
  176. this.storeCheckingReceives.unshift(storeCheckingReceive);
  177. if (res.data.errors.length < 1) $("#import").modal('hide');
  178. else this.writeErrorText(res.data.errors);
  179. tempTip.setDuration(2000);
  180. tempTip.setIndex(1099);
  181. tempTip.showSuccess("任务导入成功");
  182. return true;
  183. }
  184. if (res.data.errors && res.data.errors.length > 0){
  185. this.writeErrorText(res.data.errors)
  186. return true;
  187. }
  188. tempTip.setDuration(3000);
  189. tempTip.setIndex(1099);
  190. tempTip.show(res.data.data);
  191. }).catch(err=> {
  192. tempTip.setDuration(3000);
  193. tempTip.setIndex(1099);
  194. tempTip.show("网络错误:"+err);
  195. })
  196. },
  197. writeErrorText(errors){
  198. let content = '';
  199. for (let i in errors){
  200. content += errors[i]+"</br>";
  201. }
  202. this.popoverContent = content;
  203. setTimeout(function () {
  204. $("#popover").removeAttr('hidden').popover('show');
  205. },0);
  206. },
  207. selectFile(){
  208. $('#excelFile').trigger('click');
  209. },
  210. matchASN(){
  211. if (!this.asn){
  212. window.tempTip.setIndex(1099);
  213. window.tempTip.setDuration(3000);
  214. window.tempTip.show('请输入ASN号!');
  215. return;
  216. }
  217. let storeCheckingReceive = this.storeCheckingReceives[this.thisIndex];
  218. axios.post('{{url('store/checkingReceive/mission/matchASN')}}',{asn:this.asn,mission_id:storeCheckingReceive.id})
  219. .then(res=>{
  220. if (res.data.success){
  221. window.tempTip.setIndex(1099);
  222. window.tempTip.setDuration(2000);
  223. if (storeCheckingReceive.asn) window.tempTip.showSuccess("重新匹配ASN成功");
  224. else window.tempTip.showSuccess("匹配ASN成功");
  225. console.log(res.data.data);
  226. storeCheckingReceive.status = res.data.data.status;
  227. storeCheckingReceive.asn = res.data.data.asn;
  228. storeCheckingReceive.is_asn_diff = res.data.data.is_asn_diff;
  229. console.log(storeCheckingReceive);
  230. $("#asnWindow").modal('hide');
  231. return;
  232. }
  233. window.tempTip.setIndex(1099);
  234. window.tempTip.setDuration(3000);
  235. window.tempTip.show(res.data.data);
  236. }).catch(err=>{
  237. window.tempTip.setIndex(1099);
  238. window.tempTip.setDuration(3000);
  239. window.tempTip.show("网络错误:"+err);
  240. });
  241. },
  242. receipt(index){
  243. window.tempTip.confirm('是否要进行快速收货?',()=>{
  244. let storeCheckingReceive = this.storeCheckingReceives[index];
  245. axios.post('{{url('store/checkingReceive/mission/receipt')}}',{id:storeCheckingReceive.id})
  246. .then(res=>{
  247. if (res.data.success) {
  248. window.tempTip.setDuration(2000);
  249. window.tempTip.showSuccess("快速收货完成!");
  250. storeCheckingReceive.status = res.data.data.status;
  251. return;
  252. }
  253. window.tempTip.setDuration(3000);
  254. window.tempTip.show(res.data.data);
  255. }).catch(err=>{
  256. window.tempTip.setDuration(3000);
  257. window.tempTip.show("网络错误:"+err);
  258. })
  259. });
  260. },
  261. },
  262. });
  263. </script>
  264. @stop