king 4 лет назад
Родитель
Сommit
2aaeb06fc3

+ 17 - 3
app/Http/Controllers/WaybillController.php

@@ -1130,8 +1130,8 @@ class WaybillController extends Controller
         $ids = $request->input("ids");
         try {
             /** @var Collection $waybills */
-            $waybills = Waybill::query()->whereIn("id",$ids)->get();
-            if ($waybills->count()==0)$this->error("运单不存在");
+            $waybills = Waybill::query()->where('type','德邦物流')->whereIn("id",$ids)->get();
+            if ($waybills->count()==0)$this->error("运单不存在或运单类型不正确");
             foreach ($waybills as $waybill){
                 $waybill->loadMissing([
                     "order.shop","destinationCity","owner","order.warehouse.province","order.warehouse.city","order.warehouse.county","deliveryType"
@@ -1140,6 +1140,20 @@ class WaybillController extends Controller
         }catch (\Exception $e){
             $this->error($e->getMessage());
         }
-        $this->success(count($ids)==$waybills->count() ? $waybills : []);
+        if (count($ids)==$waybills->count())$this->success($waybills );
+        $this->error('非德邦快递不可打印');
+    }
+
+    public function changeExpressTag(Request $request)
+    {
+        $this->gate("运输管理-编辑");
+        $id = $request->input("id");
+        try {
+            $row = Waybill::where('waybill_number',$id)->update(['express_face_list'=>1, 'updated_at'=>date('Y-m-d H:i:s')]);
+            if ($row) $this->success('打印成功');
+        }catch (\Exception $e){
+            $this->error($e->getMessage());
+        }
+        $this->error('打印失败');
     }
 }

+ 0 - 2
resources/js/app.js

@@ -9,8 +9,6 @@ window.ElementUI=require('./utilities/tempTip');
 window.getGetVal=require('./utilities/getGetVal');
 window.scanner=require('./utilities/scanner');
 window.datetimeRelating=require('./utilities/datetimeRelating');
-window.lodop=require('./lodop');
 window.Vue.use(window.ElementUI);
 require('bootstrap-select');
 window.Vue.use(require('http-vue-loader'));
-

+ 14 - 14
resources/js/lodop/LodopFuncs.js

@@ -14,18 +14,18 @@ function needCLodop(){
 	var verOPR=ua.match(/OPR\D?\d+/i);
 	var verFF=ua.match(/Firefox\D?\d+/i);
 	var x64=ua.match(/x64/i);
-	if ((verTrident==null)&&(verIE==null)&&(x64!==null)) 
+	if ((verTrident==null)&&(verIE==null)&&(x64!==null))
 		return true; else
 	if ( verFF !== null) {
 		verFF = verFF[0].match(/\d+/);
 		if ( verFF[0] >= 42 ) return true;
-	} else 
+	} else
 	if ( verOPR !== null) {
 		verOPR = verOPR[0].match(/\d+/);
 		if ( verOPR[0] >= 32 ) return true;
-	} else 
+	} else
 	if ((verTrident==null)&&(verIE==null)) {
-		var verChrome=ua.match(/Chrome\D?\d+/i);		
+		var verChrome=ua.match(/Chrome\D?\d+/i);
 		if ( verChrome !== null ) {
 			verChrome = verChrome[0].match(/\d+/);
 			if (verChrome[0]>=42) return true;
@@ -56,20 +56,20 @@ if (needCLodop()) {
 		oscript.src ="http://localhost:8001/CLodopfuncs.js?priority=2";
 		head.insertBefore( oscript,head.firstChild );
 	}
-	
-	
+
+
 };
 
 //====获取LODOP对象的主过程:====
 function getLodop(oOBJECT,oEMBED){
-    var strHtmInstall="<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='../lodop/install_lodop32.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
-    var strHtmUpdate="<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='../lodop/install_lodop32.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
-    var strHtm64_Install="<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='../lodop/install_lodop64.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
-    var strHtm64_Update="<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='../lodop/install_lodop64.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
+    var strHtmInstall="<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='../../js/lodop/install_lodop32.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
+    var strHtmUpdate="<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='../../js/lodop/install_lodop32.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
+    var strHtm64_Install="<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='../../js/lodop/install_lodop64.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
+    var strHtm64_Update="<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='../../js/lodop/install_lodop64.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
     var strHtmFireFox="<br><br><font color='#FF00FF'>(注意:如曾安装过Lodop旧版附件npActiveXPLugin,请在【工具】->【附加组件】->【扩展】中先卸它)</font>";
     var strHtmChrome="<br><br><font color='#FF00FF'>(如果此前正常,仅因浏览器升级或重安装而出问题,需重新执行以上安装)</font>";
-    var strCLodopInstall="<br><font color='#FF00FF'>CLodop云打印服务(localhostw本地)未安装启动!点击这里<a href='../lodop/CLodop_Setup_for_Win32NT.exe' target='_self'>执行安装</a>,安装后请刷新页面。</font>";
-    var strCLodopUpdate="<br><font color='#FF00FF'>CLodop云打印服务需升级!点击这里<a href='../lodop/CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>,升级后请刷新页面。</font>";
+    var strCLodopInstall="<br><font color='#FF00FF'>CLodop云打印服务(本地)未安装启动!点击这里<a href='../../js/lodop/CLodop_Setup_for_Win32NT.exe' target='_self'>执行安装</a>,安装后请刷新页面。</font>";
+    var strCLodopUpdate="<br><font color='#FF00FF'>CLodop云打印服务需升级!点击这里<a href='../../js/lodop/CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>,升级后请刷新页面。</font>";
     var LODOP;
     try{
         var isIE = (navigator.userAgent.indexOf('MSIE')>=0) || (navigator.userAgent.indexOf('Trident')>=0);
@@ -82,12 +82,12 @@ function getLodop(oOBJECT,oEMBED){
                  return;
             } else {
 
-	         if (CLODOP.CVERSION<"2.0.6.8") { 
+	         if (CLODOP.CVERSION<"2.0.6.8") {
 			if (isIE) document.write(strCLodopUpdate); else
 			 $("#lodopTips").append(strCLodopUpdate);
 		 };
 		 if (oEMBED && oEMBED.parentNode) oEMBED.parentNode.removeChild(oEMBED);
-		 if (oOBJECT && oOBJECT.parentNode) oOBJECT.parentNode.removeChild(oOBJECT);	
+		 if (oOBJECT && oOBJECT.parentNode) oOBJECT.parentNode.removeChild(oOBJECT);
 	    };
         } else {
             var is64IE  = isIE && (navigator.userAgent.indexOf('x64')>=0);

+ 15 - 8
resources/views/transport/waybill/index.blade.php

@@ -56,6 +56,10 @@
                     <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
                 @endif
             </div>
+            {{--    德邦面单--}}
+            <div id="lodopTips"></div>
+            {{--    德邦面单--}}
+
             <table class="table table-striped table-bordered table-hover text-nowrap waybill-table td-min-width-80" style="background: #fff;" id="table">
                 <tr v-for="(waybill,i) in waybills" :class="[waybill.status=='待重审'?'td-red':''||waybill.status=='已完结'?'td-green':'',selectTr==waybill.id ? 'tr-select' : '']"
                     :id="'waybill'+waybill.id" @click="selectedColor(waybill.id)" @mouseover="hidetop($event)" @mouseleave="showtop($event)">
@@ -95,6 +99,12 @@
                         </td>
                     @endcan
                     <td :class="[waybill.status=='已审核'?'text-success':'']"><span>@{{waybill.status}}</span></td>
+                    <td class="td-warm">
+                        <span v-if="waybill.express_face_list == 1" style="color: red">
+                           是
+                        </span>
+                        <span v-else>否</span>
+                    </td>
                     <td class="td-warm text-muted toptd position-static">
                         <div v-if="waybill.remark" class="bg-light-yellow  text-danger top position-absolute"  data-toggle="tooltip" style="opacity: 0.1;z-index: 1">置顶备注:@{{  waybill.remark }}</div>
                         @{{ i+1 }}</td>
@@ -245,8 +255,6 @@
         </div>
     </div>
 
-{{--    德邦面单--}}
-    <div id="lodopTips"></div>
     <div id="printContext" class="ordercontent"
          style="margin-top: 15px; width: 630px; height: 665px; float: left; overflow-y: auto; text-align: center; display:none">
         <div id="expressPrintArea">
@@ -595,6 +603,7 @@
                         district:'{{$waybill->order_district ?? ($waybill->district->name ?? '')}}',
                         order_status:'{{$waybill->order->wms_status ?? ''}}',
                         is_to_pay:'{{ $waybill->is_to_pay }}',
+                        express_face_list:'{{ $waybill->express_face_list }}',
                     },
                     @endforeach
                 ],
@@ -736,16 +745,13 @@
                         return;
                     }
                     window.tempTip.confirm("确定要打印快递面单吗?",()=>{
-                        window.tempTip.setDuration(99999);
+                        window.tempTip.setDuration(2000);
                         window.tempTip.waitingTip("打印中,请稍等...");
                         window.tempTip.postBasicRequest("{{url('transport/waybill/expressFaceList')}}",{ids:checkData},res=>{
                             window.tempTip.cancelWaitingTip();
-                            window.tempTip.setDuration(2000);
-                            console.log(res);
+                            window.tempTip.setDuration(4000);
                             res.forEach((item, index)=>{
-                                console.log(item);
-                                //window.myPrintKit.printTest(item);
-                                printTest(item)
+                               printTest(item)
                             })
                         });
                     })
@@ -834,6 +840,7 @@
                         {name:'operation',value: '操作', neglect: true, class:"td-operation"},@endcan
                         {name:'onTop',value: '置顶', neglect: true, class:"td-operation"},
                         {name:'status',value: '状态', class:"td-operation"},
+                        {name:'express_face_list',value: '快递面单是否打印', class:"td-operation"},
                         {name:'index',value: '序号', neglect: true, class:"td-warm"},
                         {name:'created_at', neglect: true,value: '创建时间', class:"td-warm"},
                         {name:'operating',value: '操作记录', class:"td-warm"},

+ 1 - 0
routes/web.php

@@ -381,6 +381,7 @@ Route::group(['middleware'=>'auth'],function ($route){
             Route::resource('waybillFinancialSnapshot','WaybillFinancialSnapshotsController');
             Route::resource('waybillFinancialExcepted','WaybillFinancialExceptedController');
             Route::post('expressFaceList','WaybillController@expressFaceList');
+            Route::post('changeExpressTag','WaybillController@changeExpressTag');
         });
         Route::resource('waybill','WaybillController');
     });

+ 1 - 2
webpack.mix.js

@@ -36,11 +36,10 @@ mix.copy("resources/sass/animation.css",'public/css/animation.css');
 mix.js("resources/js/marked.js", "public/js/marked.js");
 
 //德邦快递
-mix.js('resources/js/lodop/jquery.js','public/js/lodop/jquery.js')
 mix.js('resources/js/lodop/jquery.PrintArea.js','public/js/lodop/jquery.PrintArea.js')
 mix.js('resources/js/lodop/LodopFuncs.js','public/js/lodop/LodopFuncs.js')
 mix.js('resources/js/lodop/myAlert.js','public/js/lodop/myAlert.js')
-mix.js('resources/js/lodop/myPrintKit.js','public/js/lodop/myPrintKit.js')
+mix.copy('resources/js/lodop/myPrintKit.js','public/js/lodop/myPrintKit.js')
 mix.copy('resources/js/lodop/install_lodop32.exe','public/js/lodop/install_lodop32.exe')
 mix.copy('resources/js/lodop/install_lodop64.exe','public/js/lodop/install_lodop64.exe')
 mix.copy('resources/js/lodop/CLodop_Setup_for_Win32NT.exe','public/js/lodop/CLodop_Setup_for_Win32NT.exe')