mission.blade.php 14 KB

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