Преглед изворни кода

如果省市存在自动补充省市

Zhouzhendong пре 5 година
родитељ
комит
3ca3be2ca4
2 измењених фајлова са 19 додато и 18 уклоњено
  1. 4 6
      app/Services/WaybillService.php
  2. 15 12
      resources/views/waybill/index.blade.php

+ 4 - 6
app/Services/WaybillService.php

@@ -20,12 +20,10 @@ Class WaybillService
      * @return Builder
      */
     private function conditionQuery(array $param){
-        $waybills = Waybill::filterAuthorities()->with(['owner','logistic','originationCity','destinationCity'=>function($query){
-            $query->with('province');
-        },'uploadFile','amountUnit','priceModel','warehouseWeightUnit','carrierWeightUnit',
-            'warehouseWeightUnitOther','carrierWeightUnitOther','carType','uploadFile','waybillAuditLogs' => function ($query) {
-            $query->with('user');
-        }])->selectRaw('waybills.* ,waybill_on_tops.id top_id ,waybill_on_tops.remark,waybill_on_tops.updated_at top_update')
+        $waybills = Waybill::filterAuthorities()->with(['owner','logistic','destinationCity.province',
+            'uploadFile','amountUnit','priceModel','warehouseWeightUnit','carrierWeightUnit',
+            'warehouseWeightUnitOther','carrierWeightUnitOther','carType','uploadFile','waybillAuditLogs.user'])
+            ->selectRaw('waybills.* ,waybill_on_tops.id top_id ,waybill_on_tops.remark,waybill_on_tops.updated_at top_update')
             ->leftJoin('waybill_on_tops','waybill_on_tops.waybill_id','=','waybills.id')
             ->whereNull('waybill_on_tops.deleted_at')
             ->orderBy('waybill_on_tops.updated_at','desc')

+ 15 - 12
resources/views/waybill/index.blade.php

@@ -277,17 +277,20 @@
                         source_bill:'{{$waybill->source_bill}}',
                         wms_bill_number:'{{$waybill->wms_bill_number}}',
                         origination:'{{$waybill->origination}}',
-                        destination:'{{$waybill->destination}}',
+                        destination:'{{$waybill->destination_city_id}}'?
+                            (('{{$waybill->destination}}'.indexOf('{{$waybill->destinationCity->name}}')===-1 &&
+                                '{{$waybill->destination}}'.indexOf('{{$waybill->destinationCity->province->name}}')===-1)?
+                                '{{($waybill->destinationCity->province->name).($waybill->destinationCity->name).($waybill->destination)}}'
+                                :'{{$waybill->destination}}')
+                            :'{{$waybill->destination}}',
                         recipient:'{{$waybill->recipient}}',
                         recipient_mobile:'{{$waybill->recipient_mobile}}',
                         charge:'{{$waybill->charge}}',
                         ordering_remark:'{{preg_replace("/[\n\s]/",' ',($waybill->ordering_remark??""))}}',
                         carrier:'{{$waybill->logistic ? $waybill->logistic->name : ''}}',
                         carrier_bill:'{{$waybill->carrier_bill}}',
-                        origination_city:'{{$waybill->origination_city ? $waybill->origination_city->name : ''}}',
-                        destination_city:'{{$waybill->destination_city ? $waybill->destination_city->name : ''}}',
+                        destination_city:'{{$waybill->destinationCity ? $waybill->destinationCity->name : ''}}',
                         warehouse_weight:'{{$waybill->warehouse_weight}}',
-                        destination_province_name:'{{$waybill->destination_city ? ($waybill->destination_city->province ? $waybill->destination_city->province->name : '') : ''}}',
                         warehouse_weight_unit:'{{$waybill->warehouse_weight_unit ? $waybill->warehouse_weight_unit->name : ''}}',
                         carrier_weight:'{{$waybill->carrier_weight}}',
                         carrier_weight_unit:'{{$waybill->carrier_weight_unit ? $waybill->carrier_weight_unit->name : ''}}',
@@ -938,7 +941,7 @@
                 refreshWaveHouseWeight(wms_bill_number) {
                     let _this=this;
                     let url='{{url('waybill/refreshWaveHouseWeight')}}';
-                    axios.post(url,{'wms_bill_number':wms_bill_number}).then(function (response) {
+                    window.axios.post(url,{'wms_bill_number':wms_bill_number}).then(function (response) {
                         if(response.data.success){
                             _this.waybills.every(function (waybill) {
                                 if (waybill.wms_bill_number==wms_bill_number){
@@ -947,15 +950,15 @@
                                 }
                                 return true;
                             });
-                            tempTip.setDuration(3000);
-                            tempTip.showSuccess('刷新计重成功');
+                            window.tempTip.setDuration(3000);
+                            window.tempTip.showSuccess('刷新计重成功');
                         }else{
-                            tempTip.setDuration(3000);
-                            tempTip.show('刷新计重失败!'+response.data.fail_info);
+                            window.tempTip.setDuration(3000);
+                            window.tempTip.show('刷新计重失败!'+response.data.fail_info);
                         }
                     }).catch(function (err) {
-                        tempTip.setDuration(3000);
-                        tempTip.show('刷新计重失败,网络连接错误!'+err);
+                        window.tempTip.setDuration(3000);
+                        window.tempTip.show('刷新计重失败,网络连接错误!'+err);
                     });
                 },
                 //选择文件
@@ -1047,7 +1050,7 @@
                         return  parseInt(val/1024)+"MB";
                     }
                     return val+"KB";
-                }
+                },
             }
         });
         // modal 隐藏时修改 input 为空