mission.blade.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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 class="text-muted">@{{ 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="{{mix('js/queryForm/header.js')}}"></script>
  76. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.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. fixedTop:($('#form_div').height())+2,
  136. restorationColumn: 'id',
  137. });
  138. header.init();
  139. },
  140. methods:{
  141. checkAll(event){
  142. if (event.target.checked){
  143. this.packages.forEach((el)=>{
  144. if (this.checkData.indexOf(el.id) === '-1'){
  145. this.checkData.push(el.id);
  146. }
  147. });
  148. }else this.checkData = [];
  149. },
  150. getFile(e){
  151. this.excel.file = e.target.files[0];
  152. },
  153. openImport(){
  154. $("#popover").attr('hidden','hidden');
  155. $('#import').modal('show');
  156. },
  157. importMission(){
  158. if (!this.excel.file){
  159. tempTip.setDuration(3000);
  160. tempTip.setIndex(1099);
  161. tempTip.showSuccess('未选择任何文件!');
  162. return;
  163. }
  164. let formData = new FormData();
  165. formData.append("file",this.excel.file);
  166. axios.post('{{url('store/checkingReceive/mission/import')}}',formData,{
  167. 'Content-Type':'multipart/form-data'
  168. })
  169. .then(res=>{
  170. if (res.data.success){
  171. let receive = res.data.data;
  172. let storeCheckingReceive = {
  173. id:receive.id,owner_name:receive.owner_name,created_at:receive.created_at,
  174. status:receive.status,is_receive_diff:receive.is_receive_diff,asn:receive.asn,
  175. is_asn_diff:receive.is_asn_diff
  176. };
  177. this.storeCheckingReceives.unshift(storeCheckingReceive);
  178. if (res.data.errors.length < 1) $("#import").modal('hide');
  179. else this.writeErrorText(res.data.errors);
  180. tempTip.setDuration(2000);
  181. tempTip.setIndex(1099);
  182. tempTip.showSuccess("任务导入成功");
  183. return true;
  184. }
  185. if (res.data.errors && res.data.errors.length > 0){
  186. this.writeErrorText(res.data.errors)
  187. return true;
  188. }
  189. tempTip.setDuration(3000);
  190. tempTip.setIndex(1099);
  191. tempTip.show(res.data.data);
  192. }).catch(err=> {
  193. tempTip.setDuration(3000);
  194. tempTip.setIndex(1099);
  195. tempTip.show("网络错误:"+err);
  196. })
  197. },
  198. writeErrorText(errors){
  199. let content = '';
  200. for (let i in errors){
  201. content += errors[i]+"</br>";
  202. }
  203. this.popoverContent = content;
  204. setTimeout(function () {
  205. $("#popover").removeAttr('hidden').popover('show');
  206. },0);
  207. },
  208. selectFile(){
  209. $('#excelFile').trigger('click');
  210. },
  211. matchASN(){
  212. if (!this.asn){
  213. window.tempTip.setIndex(1099);
  214. window.tempTip.setDuration(3000);
  215. window.tempTip.show('请输入ASN号!');
  216. return;
  217. }
  218. let storeCheckingReceive = this.storeCheckingReceives[this.thisIndex];
  219. axios.post('{{url('store/checkingReceive/mission/matchASN')}}',{asn:this.asn,mission_id:storeCheckingReceive.id})
  220. .then(res=>{
  221. if (res.data.success){
  222. window.tempTip.setIndex(1099);
  223. window.tempTip.setDuration(2000);
  224. if (storeCheckingReceive.asn) window.tempTip.showSuccess("重新匹配ASN成功");
  225. else window.tempTip.showSuccess("匹配ASN成功");
  226. console.log(res.data.data);
  227. storeCheckingReceive.status = res.data.data.status;
  228. storeCheckingReceive.asn = res.data.data.asn;
  229. storeCheckingReceive.is_asn_diff = res.data.data.is_asn_diff;
  230. console.log(storeCheckingReceive);
  231. $("#asnWindow").modal('hide');
  232. return;
  233. }
  234. window.tempTip.setIndex(1099);
  235. window.tempTip.setDuration(3000);
  236. window.tempTip.show(res.data.data);
  237. }).catch(err=>{
  238. window.tempTip.setIndex(1099);
  239. window.tempTip.setDuration(3000);
  240. window.tempTip.show("网络错误:"+err);
  241. });
  242. },
  243. receipt(index){
  244. window.tempTip.confirm('是否要进行快速收货?',()=>{
  245. window.tempTip.setDuration(9999);
  246. window.tempTip.waitingTip("执行中......");
  247. let storeCheckingReceive = this.storeCheckingReceives[index];
  248. axios.post('{{url('store/checkingReceive/mission/receipt')}}',{id:storeCheckingReceive.id})
  249. .then(res=>{
  250. if (res.data.success) {
  251. window.tempTip.cancelWaitingTip();
  252. window.tempTip.setDuration(2000);
  253. window.tempTip.showSuccess("快速收货完成!");
  254. storeCheckingReceive.status = res.data.data.status;
  255. return;
  256. }
  257. window.tempTip.cancelWaitingTip();
  258. window.tempTip.setDuration(3000);
  259. window.tempTip.show(res.data.data);
  260. }).catch(err=>{
  261. window.tempTip.cancelWaitingTip();
  262. window.tempTip.setDuration(3000);
  263. window.tempTip.show("网络错误:"+err);
  264. })
  265. });
  266. },
  267. },
  268. });
  269. </script>
  270. @stop