mission.blade.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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-striped table-sm text-nowrap table-hover mt-1 td-min-width-80" id="table">
  42. <tr v-for="(storeCheckingReceive,i) in storeCheckingReceives" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
  43. <td><span>@{{ i+1 }}</span></td>
  44. <td><span>@{{ storeCheckingReceive.id }}</span></td>
  45. <td><span>@{{ storeCheckingReceive.owner_name }}</span></td>
  46. <td class="font-weight-bold"><span>@{{ storeCheckingReceive.status }}</span></td>
  47. <td class="text-muted"><span>@{{ storeCheckingReceive.is_receive_diff }}</span></td>
  48. <td><span>@{{ storeCheckingReceive.asn }}</span></td>
  49. <td><span>@{{ storeCheckingReceive.is_asn_diff }}</span></td>
  50. <td><span>@{{ storeCheckingReceive.created_at }}</span></td>
  51. <td>
  52. @can('入库管理-盘收一体-盘收')<a v-if="storeCheckingReceive.status != '已收货'" target="_blank" :href="'{{url('store/checkingReceive/mission')}}/'+storeCheckingReceive.id">
  53. <button class="btn btn-sm btn-outline-dark">盘收</button>
  54. </a>@endcan
  55. <a target="_blank" :href="'{{url('store/checkingReceive/mission')}}/'+storeCheckingReceive.id+'?is_show=false'">
  56. <button class="btn btn-sm btn-outline-primary">查看</button>
  57. </a>
  58. @can('入库管理-盘收一体-盘收-编辑')
  59. <button v-if="storeCheckingReceive.status != '已收货'" class="btn btn-sm btn-outline-success" data-toggle="modal" data-target="#asnWindow" @click="thisIndex=i">
  60. <span v-if="storeCheckingReceive.asn">重新</span>匹配ASN号
  61. </button>@endcan
  62. @can('入库管理-快速入库')
  63. <button v-if="storeCheckingReceive.status=='已ASN入库' && storeCheckingReceive.is_receive_diff != '是' && storeCheckingReceive.is_asn_diff != '是' && storeCheckingReceive.status != '已收货'"
  64. class="btn btn-sm btn-outline-info" @click="receipt(i)">快速入库</button>
  65. @endcan
  66. </td>
  67. </tr>
  68. </table>
  69. {{$storeCheckingReceives->appends($params)->links()}}
  70. </div>
  71. @stop
  72. @section('lastScript')
  73. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  74. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  75. <script>
  76. let vue = new Vue({
  77. el:"#container",
  78. data:{
  79. storeCheckingReceives:[
  80. @foreach($storeCheckingReceives as $storeCheckingReceive)
  81. {id:'{{$storeCheckingReceive->id}}',owner_name:'{{$storeCheckingReceive->owner ? $storeCheckingReceive->owner->name : ''}}',
  82. created_at:'{{$storeCheckingReceive->created_at}}',status:'{{$storeCheckingReceive->status}}',
  83. is_receive_diff:'{{$storeCheckingReceive->is_receive_diff}}',asn:'{{$storeCheckingReceive->asn}}',
  84. is_asn_diff:'{{$storeCheckingReceive->is_asn_diff}}',
  85. },
  86. @endforeach
  87. ],
  88. owners:[
  89. @foreach($owners as $owner)
  90. {name:'{{$owner->id}}',value:'{{$owner->name}}'},
  91. @endforeach
  92. ],
  93. checkData:[],
  94. sum:Number('{{$storeCheckingReceives->total()}}'),
  95. excel : {
  96. file : null,
  97. },
  98. popoverContent:'',
  99. thisIndex : '',
  100. asn : '',
  101. selectTr:""
  102. },
  103. mounted(){
  104. $('#container').removeClass('d-none');
  105. $(".tooltipTarget").tooltip({'trigger':'hover'});
  106. let _this = this;
  107. let data = [[
  108. {name:'created_at_start',type:'dateTime',tip:'选择显示指定日期的起始时间'},
  109. {name:'created_at_end',type:'dateTime',tip:'选择显示指定日期的结束时间'},
  110. {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
  111. placeholder:['货主','定位或多选货主'],data:_this.owners},
  112. {name:'asn',type:'input',tip:'可支持多ASN单号:模糊搜索可在两侧增加百分号(%)进行',placeholder:'ASN单号'},
  113. ]];
  114. _this.form = new query({
  115. el:'#form_div',
  116. condition:data,
  117. });
  118. _this.form.init();
  119. let column = [
  120. {name:'index',value: '序号', neglect: true},
  121. {name:'id',value: 'ID', neglect: true},
  122. {name:'owner_name',value: '货主'},
  123. {name:'status',value: '状态'},
  124. {name:'is_receive_diff',value: '导入差异'},
  125. {name:'asn',value: 'ASN单号'},
  126. {name:'is_asn_diff',value: 'ASN差异'},
  127. {name:'created_at',value: '创建时间'},
  128. {name:'operating',value: '操作', neglect: true},
  129. ];
  130. new Header({
  131. el: "table",
  132. name: "checkingReceiveMission",
  133. column: column,
  134. data: this.storeCheckingReceives,
  135. fixedTop:($('#form_div').height())+2,
  136. }).init();
  137. },
  138. methods:{
  139. getFile(e){
  140. this.excel.file = e.target.files[0];
  141. },
  142. openImport(){
  143. $("#popover").attr('hidden','hidden');
  144. $('#import').modal('show');
  145. },
  146. importMission(){
  147. if (!this.excel.file){
  148. tempTip.setDuration(3000);
  149. tempTip.setIndex(1099);
  150. tempTip.showSuccess('未选择任何文件!');
  151. return;
  152. }
  153. let formData = new FormData();
  154. formData.append("file",this.excel.file);
  155. axios.post('{{url('store/checkingReceive/mission/import')}}',formData,{
  156. 'Content-Type':'multipart/form-data'
  157. })
  158. .then(res=>{
  159. if (res.data.success){
  160. let receive = res.data.data;
  161. let storeCheckingReceive = {
  162. id:receive.id,owner_name:receive.owner_name,created_at:receive.created_at,
  163. status:receive.status,is_receive_diff:receive.is_receive_diff,asn:receive.asn,
  164. is_asn_diff:receive.is_asn_diff
  165. };
  166. this.storeCheckingReceives.unshift(storeCheckingReceive);
  167. if (res.data.errors.length < 1) $("#import").modal('hide');
  168. else this.writeErrorText(res.data.errors);
  169. tempTip.setDuration(2000);
  170. tempTip.setIndex(1099);
  171. tempTip.showSuccess("任务导入成功");
  172. return true;
  173. }
  174. if (res.data.errors && res.data.errors.length > 0){
  175. this.writeErrorText(res.data.errors)
  176. return true;
  177. }
  178. tempTip.setDuration(3000);
  179. tempTip.setIndex(1099);
  180. tempTip.show(res.data.data);
  181. }).catch(err=> {
  182. tempTip.setDuration(3000);
  183. tempTip.setIndex(1099);
  184. tempTip.show("网络错误:"+err);
  185. })
  186. },
  187. writeErrorText(errors){
  188. let content = '';
  189. for (let i in errors){
  190. content += errors[i]+"</br>";
  191. }
  192. this.popoverContent = content;
  193. setTimeout(function () {
  194. $("#popover").removeAttr('hidden').popover('show');
  195. },0);
  196. },
  197. selectFile(){
  198. $('#excelFile').trigger('click');
  199. },
  200. matchASN(){
  201. if (!this.asn){
  202. window.tempTip.setIndex(1099);
  203. window.tempTip.setDuration(3000);
  204. window.tempTip.show('请输入ASN号!');
  205. return;
  206. }
  207. let storeCheckingReceive = this.storeCheckingReceives[this.thisIndex];
  208. axios.post('{{url('store/checkingReceive/mission/matchASN')}}',{asn:this.asn,mission_id:storeCheckingReceive.id})
  209. .then(res=>{
  210. if (res.data.success){
  211. window.tempTip.setIndex(1099);
  212. window.tempTip.setDuration(2000);
  213. if (storeCheckingReceive.asn) window.tempTip.showSuccess("重新匹配ASN成功");
  214. else window.tempTip.showSuccess("匹配ASN成功");
  215. console.log(res.data.data);
  216. storeCheckingReceive.status = res.data.data.status;
  217. storeCheckingReceive.asn = res.data.data.asn;
  218. storeCheckingReceive.is_asn_diff = res.data.data.is_asn_diff;
  219. console.log(storeCheckingReceive);
  220. $("#asnWindow").modal('hide');
  221. return;
  222. }
  223. window.tempTip.setIndex(1099);
  224. window.tempTip.setDuration(3000);
  225. window.tempTip.show(res.data.data);
  226. }).catch(err=>{
  227. window.tempTip.setIndex(1099);
  228. window.tempTip.setDuration(3000);
  229. window.tempTip.show("网络错误:"+err);
  230. });
  231. },
  232. receipt(index){
  233. window.tempTip.confirm('是否要进行快速收货?',()=>{
  234. window.tempTip.setDuration(9999);
  235. window.tempTip.waitingTip("执行中......");
  236. let storeCheckingReceive = this.storeCheckingReceives[index];
  237. axios.post('{{url('store/checkingReceive/mission/receipt')}}',{id:storeCheckingReceive.id})
  238. .then(res=>{
  239. if (res.data.success) {
  240. window.tempTip.cancelWaitingTip();
  241. window.tempTip.setDuration(2000);
  242. window.tempTip.showSuccess("快速收货完成!");
  243. storeCheckingReceive.status = res.data.data.status;
  244. return;
  245. }
  246. window.tempTip.cancelWaitingTip();
  247. window.tempTip.setDuration(3000);
  248. window.tempTip.show(res.data.data);
  249. }).catch(err=>{
  250. window.tempTip.cancelWaitingTip();
  251. window.tempTip.setDuration(3000);
  252. window.tempTip.show("网络错误:"+err);
  253. })
  254. });
  255. },
  256. },
  257. });
  258. </script>
  259. @stop