general.blade.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. @extends('layouts.app')
  2. @section('title')退货管理@endsection
  3. @section('content')
  4. <div id="nav2">
  5. @component('rejected.menu')@endcomponent
  6. @component('rejected.search.menu')@endcomponent
  7. </div>
  8. <div class="container-fluid">
  9. <div style="min-width: 2070px;">
  10. <div class="d-none" id="list">
  11. @if(Session::has('successTip'))
  12. <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
  13. @endif
  14. <div id="form_div"></div>
  15. <span class="dropdown">
  16. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget":class="[rejectedBills_checkBoxes.length>0?'btn-dark text-light':'']"
  17. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
  18. 导出Excel
  19. </button>
  20. <div class="dropdown-menu">
  21. <a class="dropdown-item" @click="exportExcel(false)" href="javascript:">导出勾选内容</a>
  22. <a class="dropdown-item" @click="exportExcel(true)" href="javascript:">导出所有页</a>
  23. </div>
  24. </span>
  25. @can('退货管理-编辑')
  26. {{-- <select name="" class="tooltipTarget form-control-sm" style="vertical-align: middle"--}}
  27. {{-- title="将勾选记录的入库状态设定为是或否,仅对未完结状态的记录有效" @change="setIsLoaded_batch"--}}
  28. {{-- :class="[rejectedBills_checkBoxes.length>0?'btn-dark':'btn-outline-dark']">--}}
  29. {{-- <option value="">修改入库</option>--}}
  30. {{-- <option value="1">设定为是</option>--}}
  31. {{-- <option value="0">设定为否</option>--}}
  32. {{-- <option value="null">无需入库</option>--}}
  33. {{-- <option value="2">待推单</option>--}}
  34. {{-- </select>--}}
  35. @endcan
  36. @can('退货管理-审核')
  37. <span class="btn btn-sm" @click="checkAll" style="cursor: pointer"
  38. :class="[rejectedBills_checkBoxes.length>0?'btn-dark':'btn-outline-dark']">审核</span>
  39. @endcan
  40. @can('退货管理-编辑')
  41. <span class="btn btn-sm" @click="finishAll" style="cursor: pointer"
  42. :class="[rejectedBills_checkBoxes.length>0?'btn-dark':'btn-outline-dark']">完结</span>
  43. @endcan
  44. <span class="dropdown">
  45. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget":class="[rejectedBills_checkBoxes.length>0?'btn-dark text-light':'']"
  46. data-toggle="dropdown" title="将勾选记录的入库状态设定为是或否,仅对未完结状态的记录有效">
  47. 修改入库
  48. </button>
  49. <div class="dropdown-menu">
  50. <a class="dropdown-item" @click="setIsLoaded_batch(1)" href="javascript:">设定为是</a>
  51. <a class="dropdown-item" @click="setIsLoaded_batch(0)" href="javascript:">设定为否</a>
  52. <a class="dropdown-item" @click="setIsLoaded_batch('null')" href="javascript:">无需入库</a>
  53. <a class="dropdown-item" @click="setIsLoaded_batch(2)" href="javascript:">待推单</a>
  54. <a class="dropdown-item" @click="setIsLoaded_batch(4)" href="javascript:">待确认</a>
  55. </div>
  56. </span>
  57. <table class="table table-striped table-sm table-bordered table-hover" style="background: #fff;">
  58. <tr>
  59. <th>
  60. <input type="checkbox" class="form-control-sm tooltipTarget" title="全选"
  61. id="checkSelectingAll" @click="checkBoxAllToggle" v-model="checkBoxAll" value="1">
  62. </th>
  63. <th>序号</th>
  64. <th>是否审核</th>
  65. <th>是否完结</th>
  66. <th>是否入库</th>
  67. <th>创建时间</th>
  68. <th>客户名称</th>
  69. <th>退回单号</th>
  70. <th>退回公司</th>
  71. <th>订单号</th>
  72. <th>姓名</th>
  73. <th>电话</th>
  74. <th>原单单号</th>
  75. @cannot('退货管理-到付费用')<th>到付费用</th>@endcannot
  76. @can('退货管理-查询-客户定义-爱奇艺')
  77. <th>寄件方省</th>
  78. <th>重量</th>
  79. @endcan
  80. <th>商品总数</th>
  81. <th>商品条码</th>
  82. <th>商品名称</th>
  83. <th>数量</th>
  84. <th>是否正品</th>
  85. <th>批次号</th>
  86. <th>生产日期</th>
  87. <th>效期</th>
  88. <th>备注</th>
  89. <th>退单备注</th>
  90. <th>录入人</th>
  91. @can('退货管理-编辑','退货管理-删除')
  92. <th>操作</th>
  93. @endcan
  94. </tr>
  95. <tr v-for="(rejectedBill,i) in rejectedBills" :data-id="rejectedBill.id">
  96. <td>
  97. <input type="checkbox" v-model="rejectedBills_checkBoxes" :value="rejectedBill.id"/>
  98. </td>
  99. <td class="text-muted" style="opacity:0.7">
  100. @{{ i+1 }}
  101. </td>
  102. <td class="text-muted">
  103. <span v-if="rejectedBill.is_checked==1" class="text-success">
  104. <span class="fa fa-check-square"></span> @{{ rejectedBill.checked_numbers }}
  105. </span>
  106. <span v-else>
  107. 未审核
  108. </span>
  109. </td>
  110. <td class="" :class="[rejectedBill.is_finished==1?'text-success':'text-muted']">@{{rejectedBill.is_finished | yesNo}}</td>
  111. <td class="" :class="[rejectedBill.is_loaded==1?'text-success':'text-muted']">
  112. <span v-if="rejectedBill.is_loaded==4">
  113. <button class="btn btn-sm btn-info" @click="confirmBeStored($event,rejectedBill.id)">确定入库</button>
  114. </span>
  115. <span v-else>@{{rejectedBill.is_loaded | yesNoIsLoaded}}</span>
  116. </td>
  117. <td class="text-muted">@{{rejectedBill.created_at}}</td>
  118. <td><span v-if="rejectedBill.owner">@{{rejectedBill.owner.name}}</span></td>
  119. <td>@{{rejectedBill.logistic_number_return}}</td>
  120. <td class="text-muted"><span v-if="rejectedBill.logistic">@{{rejectedBill.logistic.name}}</span></td>
  121. <td>@{{rejectedBill.order_number}}</td>
  122. <td class="text-muted">@{{rejectedBill.sender}}</td>
  123. <td class="text-muted">@{{rejectedBill.mobile_sender}}</td>
  124. <td>@{{rejectedBill.logistic_number}}</td>
  125. @cannot('退货管理-到付费用')<td class="text-muted">@{{rejectedBill.fee_collected}}</td>@endcannot
  126. @can('退货管理-查询-客户定义-爱奇艺')<td class="text-muted">@{{rejectedBill.common_01}}</td>@endcan
  127. <td class="text-muted">@{{rejectedBill.common_02}}</td>
  128. <td class="text-muted">@{{rejectedBill.goods_amount}}</td>
  129. <td colspan="8">
  130. <div class="text-center" v-if="rejectedBill.detailFolding && rejectedBill.items.length>1">
  131. <a href="javascript:;" @click="rejectedBill.detailFolding=false">@{{rejectedBill.goods_amount}}件商品,点击展开明细</a></div>
  132. <table class="table table-sm" v-else>
  133. <tr v-for="item in rejectedBill.items">
  134. <td style="width: 140px">@{{item.barcode_goods}}</td>
  135. <td style="width: 140px">@{{item.name_goods}}</td>
  136. <td style="width: 30px">@{{item.amount}}</td>
  137. <td class="text-muted">@{{item.quality_label}}</td>
  138. <td class="text-muted">@{{item.batch_number}}</td>
  139. <td class="text-muted">@{{item.made_at}}</td>
  140. <td class="text-muted">@{{item.validity_at}}</td>
  141. <td class="text-muted">@{{item.remark}}</td>
  142. </tr>
  143. <tr v-if="!rejectedBill.detailFolding && rejectedBill.items.length>1">
  144. <td colspan="8" class="text-center">
  145. <a href="javascript:;" @click="rejectedBill.detailFolding=true">点击收起明细</a>
  146. </td>
  147. </tr>
  148. </table>
  149. </td>
  150. <td class="text-muted" style="max-width: 190px">@{{rejectedBill.remark}}</td>
  151. <td class="text-muted">@{{rejectedBill.operator_name}}</td>
  152. @can('退货管理-编辑')
  153. <td>
  154. <span v-if="rejectedBill.is_finished!=1">
  155. @can('退货管理-编辑')
  156. <button class="btn btn-outline-info btn-sm tooltipTarget" @click="edit(rejectedBill.id)">改</button>
  157. @endcan
  158. @can('退货管理-删除')
  159. <button
  160. class="btn btn-outline-danger btn-sm tooltipTarget" @click="destroy(rejectedBill)">删</button>
  161. @endcan
  162. </span>
  163. <span v-else class="text-muted">已完结</span>
  164. </td>
  165. @endcan
  166. </tr>
  167. </table>
  168. <div class="text-info h5 btn btn">{{$rejectedBills->count()}}/{{$rejectedBills->total()}}</div>
  169. {{$rejectedBills->appends($paginateParams)->links()}}
  170. </div>
  171. </div>
  172. </div>
  173. @endsection
  174. @section('lastScript')
  175. <script>
  176. let rejectedBills={!! $rejectedBills->toJson()!!}.data;
  177. rejectedBills.forEach(function(rejectedBill){
  178. rejectedBill.detailFolding=true;
  179. })
  180. let owners=[
  181. @foreach($owners as $owner)
  182. {id:'{{$owner->id}}',name:'{{$owner->name}}'},
  183. @endforeach
  184. ];
  185. let logistics=[
  186. @foreach($logistics as $logistic)
  187. {!! $logistic !!},
  188. @endforeach
  189. ];
  190. let qualityLabels=[
  191. @foreach($qualityLabels as $qualityLabel)
  192. {id:'{{$qualityLabel->id}}',name:'{{$qualityLabel->name}}'},
  193. @endforeach
  194. ];
  195. @if(isset($paginateParams))
  196. let paginateParams={!! json_encode($paginateParams) !!};
  197. @endif
  198. let total='{{$rejectedBills->total()}}';
  199. let editUrl = "{{url('rejectedBill')}}/";
  200. let destroyUrl = "{{url('rejectedBill')}}/";
  201. let ajaxConfirmBeStoredUrl = '{{url("apiLocal/rejectedBill/apiConfirmBeStored")}}';
  202. let ajaxCheckUrl = '{{url("apiLocal/rejectedBill/apiSetIsLoadedAll")}}';
  203. let ajaxCheckAllURL = '{{url("rejected/ajaxCheckAll")}}';
  204. let ajaxFinishAllUrl='{{url("rejected/ajaxFinishAll")}}';
  205. let csrfInput='@csrf';
  206. </script>
  207. <script src="{{asset('js/queryForm/export200804.js')}}"></script>
  208. <script src="{{asset('js/queryForm/queryForm200806.js')}}"></script>
  209. <script>
  210. new Vue({
  211. el:"#list",
  212. data:{
  213. checkBoxAll:[],
  214. rejectedBills:rejectedBills,
  215. rejectedBills_checkBoxes:[],
  216. owners:[
  217. @foreach($owners as $owner)
  218. {name:'{{$owner->id}}',value:'{{$owner->name}}'},
  219. @endforeach
  220. ],
  221. logistics:[
  222. @foreach($logistics as $logistic)
  223. {name:'{{$logistic->id}}',value:'{{$logistic->name}}'},
  224. @endforeach
  225. ],
  226. qualityLabels:[
  227. @foreach($qualityLabels as $qualityLabel)
  228. {name:'{{$qualityLabel->id}}',value:'{{$qualityLabel->name}}'},
  229. @endforeach
  230. ],
  231. },
  232. mounted:function(){
  233. $(".tooltipTarget").tooltip({'trigger':'hover'});
  234. $('#list').removeClass('d-none');
  235. let data=[
  236. [
  237. {name:'created_at_start',type:'dateTime',tip:'选择显示指定日期的起始时间'},
  238. {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
  239. placeholder:['货主','定位或多选货主'],data:this.owners},
  240. {name:'order_number',type:'input',tip:'订单号:可在两侧增加百分号(%)进行模糊搜索',placeholder:'订单号'},
  241. {name:'logistic_number_return',type:'input',tip:'退回单号:可在两侧增加百分号(%)进行模糊搜索',placeholder:'退回单号'},
  242. {name:'logistic_number',type:'input',tip:'原单单号:可在两侧增加百分号(%)进行模糊搜索',placeholder:'原单单号'},
  243. {name:'is_checked',type:'select',placeholder: '是否审核',data:[{name:1,value:'已审核'},{name:0,value:'未审核'}]},
  244. {name:'id_logistic_return',type:'select',placeholder: '快递名称',data:this.logistics},
  245. ],[
  246. {name:'created_at_end',type:'dateTime',tip:'选择显示指定日期的结束时间'},
  247. {name:'barcode_goods',type:'input',tip:'商品条码:可模糊匹配右边未填完的部分,按回车提交',placeholder:'商品条码'},
  248. {name:'id_quality_label',type:'select',tip:'是否正品:正品仅显示全部是正品的退单,但残次显示的是包含有残次的退单',placeholder: '是否正品',data:this.qualityLabels},
  249. {name:'mobile_sender',type:'input',tip:'寄件人手机:输入完成敲回车提交',placeholder:'寄件人手机'},
  250. {name:'checked_numbers',type:'input',tip:'审核批次号:支持右位留空的模糊搜索',placeholder:'审核批次号'},
  251. {name:'is_loaded',type:'select',placeholder: '是否入库',data:[{name:1,value:'是'},{name:0,value:'否'},
  252. {name:'null',value:'无需入库'},{name:2,value:'待推单'},{name:4,value:'待确认'}]},
  253. ]
  254. ];
  255. this.form=new query({
  256. el:"#form_div",
  257. condition:data
  258. });
  259. this.form.init();
  260. },
  261. methods:{
  262. edit(id){
  263. window.location.href=editUrl+id+"/edit";
  264. },
  265. destroy:function(rejectedBill){
  266. if(!confirm('确定要删除退货信息“' + rejectedBill.owner.name+':'+rejectedBill.logistic_number_return+ '”吗?')){return;}
  267. let data=this;
  268. let url = destroyUrl+rejectedBill.id;
  269. axios.delete(url,{id:rejectedBill.id})
  270. .then(function (response) {
  271. if(response.data.success){
  272. for (let i = 0; i < data.rejectedBills.length; i++) {
  273. if (data.rejectedBills[i].id===rejectedBill.id){
  274. data.rejectedBills.splice(i,1);
  275. break;
  276. }
  277. }
  278. tempTip.setDuration(1000);
  279. tempTip.showSuccess('删除退货信息"'+rejectedBill.owner.name+':'+rejectedBill.logistic_number_return+'"成功!')
  280. }else{
  281. tempTip.setDuration(1000);
  282. tempTip.show('删除退货信息"'+rejectedBill.owner.name+':'+rejectedBill.logistic_number_return+'"失败!')
  283. }
  284. })
  285. .catch(function (err) {
  286. tempTip.setDuration(3000);
  287. tempTip.show('删除退货信息失败!'+'网络错误:' + err);
  288. });
  289. },
  290. cancelCheckConfirmAll:function(){
  291. $('#checkConfirmingAll').tooltip('hide');
  292. setTimeout(function () {
  293. $(".tooltipTarget").tooltip({'trigger':'hover'})
  294. }, 10);
  295. this.checkBoxAll=false;
  296. this.rejectedBills.forEach(function(rejectedBill){
  297. if(rejectedBill.is_checked===-1)
  298. rejectedBill.is_checked='0';
  299. })
  300. },
  301. setIsLoaded_batch:function(val){
  302. let _this=this;
  303. if(_this.rejectedBills_checkBoxes.length===0){
  304. tempTip.show('没有勾选记录');
  305. $(e.target).val("");
  306. return;
  307. }
  308. let is_loaded=0;
  309. let is_loadedLabel='否';
  310. if(parseInt(val)===1){
  311. is_loaded=1;
  312. is_loadedLabel='是';
  313. }else if(parseInt(val)===2){
  314. is_loaded=2;
  315. is_loadedLabel='待推单';
  316. }else if(parseInt(val)===4){
  317. is_loaded=4;
  318. is_loadedLabel='待确认';
  319. }else if(val==="null"){
  320. is_loaded='null';
  321. is_loadedLabel='无需入库';
  322. }
  323. if(!confirm("确定要标记所有勾选入库情况为'"+is_loadedLabel+"'吗")){return;}
  324. axios.post(ajaxCheckUrl,{ids:_this.rejectedBills_checkBoxes,is_loaded:is_loaded}).then(function(response){
  325. if(response.data.success){
  326. _this.rejectedBills_checkBoxes.forEach(function(id){
  327. _this.rejectedBills.forEach(function(bill){
  328. if(bill.id===id){
  329. bill.is_loaded=is_loaded;
  330. }
  331. });
  332. });
  333. tempTip.setDuration(1000);
  334. tempTip.showSuccess('修改勾选记录的入库状态成功');
  335. }else{
  336. tempTip.setDuration(2500);
  337. tempTip.show('修改勾选记录的入库状态失败,错误:'+response.data.fail_info);
  338. }
  339. }).catch(function (e) {
  340. alert('网络连接错误:'+e);
  341. tempTip.setDuration(2500);
  342. tempTip.show('审核勾选内容失败,网络连接错误:'+e);
  343. console.log(e);
  344. });
  345. $(e.target).val("")
  346. },
  347. checkBoxAllToggle:function(e){
  348. let _this=this;
  349. if(_this.rejectedBills_checkBoxes.length>=this.rejectedBills.length){
  350. _this.rejectedBills_checkBoxes=[];
  351. _this.checkBoxAll=[];
  352. }
  353. else{
  354. _this.rejectedBills_checkBoxes=[];
  355. this.rejectedBills.forEach(function(bill){
  356. _this.rejectedBills_checkBoxes.push(bill.id);
  357. _this.checkBoxAll=[1];
  358. });
  359. }
  360. },
  361. checkAll:function(){
  362. let _this=this;
  363. if(_this.rejectedBills_checkBoxes.length===0){
  364. tempTip.show('没有勾选记录');
  365. return
  366. }
  367. if(!confirm("确定要标记所有勾选内容为'已审核'吗")){return;}
  368. axios.post(ajaxCheckAllURL,{ids:_this.rejectedBills_checkBoxes}).then(function(response){
  369. if(response.data.success){
  370. response.data.rejecteds.forEach(function (rejected) {
  371. _this.rejectedBills.forEach(function(rejectedBill){
  372. if(parseInt(rejectedBill.id)===parseInt(rejected.id)){
  373. rejectedBill.is_checked=1;
  374. rejectedBill.checked_numbers=rejected.checked_numbers;
  375. }
  376. });
  377. });
  378. tempTip.setDuration(1000);
  379. tempTip.showSuccess('审核勾选内容成功');
  380. }else{
  381. tempTip.setDuration(2500);
  382. tempTip.show('审核勾选内容失败,错误:'+response.data.fail_info);
  383. }
  384. }).catch(function (e) {
  385. alert('网络连接错误:'+e);
  386. tempTip.setDuration(2500);
  387. tempTip.show('审核勾选内容失败,网络连接错误:'+e);
  388. console.log(e);
  389. })
  390. },
  391. confirmBeStored:function($e,id){
  392. let _this=this;
  393. axios.post(ajaxConfirmBeStoredUrl,{id:id}).then(function(response){
  394. if(response.data.success){
  395. _this.rejectedBills.forEach(function(rejectedBill){
  396. if(rejectedBill.id===id){
  397. rejectedBill.is_loaded=1;
  398. }
  399. });
  400. tempTip.setDuration(1000);
  401. tempTip.showSuccess('确认入库成功');
  402. }else{
  403. tempTip.setDuration(2500);
  404. tempTip.okWindow('数据异常无法确认!请在WMS确定入库状态后,勾选该条目手动修改相应入库状态!','知道了')
  405. }
  406. }).catch(function (e) {
  407. alert('确认失败,网络连接错误:'+e);
  408. tempTip.setDuration(2500);
  409. tempTip.show('确认失败,网络连接错误:'+e);
  410. console.log(e);
  411. })
  412. },
  413. finishAll:function(){
  414. let _this=this;
  415. if(_this.rejectedBills_checkBoxes.length===0){
  416. tempTip.show('没有勾选记录');
  417. return
  418. }
  419. if(!confirm("确定要标记所有勾选内容为'已完结'吗")){return;}
  420. axios.post(ajaxFinishAllUrl,{ids:_this.rejectedBills_checkBoxes}).then(function(response){
  421. if(response.data.success){
  422. _this.rejectedBills.forEach(function(rejectedBill){
  423. _this.rejectedBills_checkBoxes.forEach(function (checkedId) {
  424. if(rejectedBill.id===checkedId){
  425. rejectedBill.is_finished=1;
  426. }
  427. });
  428. });
  429. tempTip.setDuration(1000);
  430. tempTip.showSuccess('标记勾选内容为完结成功');
  431. }else{
  432. tempTip.setDuration(2500);
  433. tempTip.show('标记勾选内容为完结失败,错误:'+response.data.fail_info);
  434. }
  435. }).catch(function (e) {
  436. alert('网络连接错误:'+e);
  437. tempTip.setDuration(2500);
  438. tempTip.show('标记勾选内容完结失败,网络连接错误:'+e);
  439. })
  440. },
  441. exportExcel:function(checkAllSign){
  442. let url = '{{url('rejected/export')}}';
  443. let token='{{ csrf_token() }}';
  444. excelExport(checkAllSign,this.rejectedBills_checkBoxes,url,total,token);
  445. },
  446. },
  447. filters:{
  448. yesNo:function (val) {
  449. if(!val||val===0||val==='0'){return '否'}
  450. return '是'
  451. },
  452. yesNoIsLoaded:function (val) {
  453. switch(val){
  454. case 0:case '0':return '否';
  455. case 1:case '1':return '是';
  456. case 2:case '2':return '待推单';
  457. case 3:case '3':return '交互异常';
  458. case 4:case '4':return '待确认';
  459. case null:case 'null':return '无需入库';
  460. }
  461. return '';
  462. }
  463. }
  464. });
  465. </script>
  466. @endsection