소스 검색

城市表切换引起的部分BUG

Zhouzhendong 5 년 전
부모
커밋
852d4d1e11

+ 7 - 20
app/Http/Controllers/WaybillController.php

@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
 
 
 use App\Components\AsyncResponse;
+use App\Region;
 use App\Services\CarTypeService;
 use App\Services\LogisticService;
 use App\Services\OwnerService;
@@ -778,26 +779,12 @@ class WaybillController extends Controller
         ]);
         return $validator;
     }
-    public function addCounty(Request $request){
-        if ($request->destination_city =='undefined')$request->offsetUnset('destination_city');
-        $rule =[
-            'destination_city' => ['required', 'string','unique:cities,name'],
-        ];
-        $messages=[
-            'destination_city.required'=>'市/县不能为空',
-            'destination_city.string'=>'市/县必须是字符串',
-            'destination_city.unique'=>'市/县已存在',
-        ];
-        $validator = Validator::make($request->all(),$rule,$messages);
-        if ($validator->fails()) {
-            return $validator->errors();
-        }
-        $city=new City([
-            'name'=>$request->input('destination_city'),
-            'type'=>3,
-        ]);
-        $city->save();
-        return $city;
+    public function addCounty(){
+        $name = app("RegionService")->formatName(request("name"),2);
+        if (!$name)$this->error("非法参数");
+
+        $region = Region::query()->firstOrCreate(["name"=>$name,"type"=>2]);
+        $this->success($region);
     }
 
     // 运单删除 软删除

+ 2 - 0
app/OwnerFeeDetailLogistic.php

@@ -14,6 +14,8 @@ class OwnerFeeDetailLogistic extends Model
       "owner_fee_detail_id","amount","logistic_bill","volume","weight","logistic_fee"
     ];
 
+    public $timestamps = false;
+
     public function logistic()
     {   //快递
         return $this->belongsTo(Logistic::class);

+ 21 - 1
resources/views/customer/finance/instantBill.blade.php

@@ -4,6 +4,24 @@
 @section('content')
     @component('customer.finance.menu')@endcomponent
     <div class="container-fluid d-none" id="container">
+        <div class="container-fluid nav3">
+            <div class="card menu-third">
+                <ul class="nav nav-pills">
+                    <li class="nav-item">
+                        <a target="customer/finance/instantBill" class="nav-link" href="{{url('customer/finance/instantBill')}}" :class="!thisType ? 'active' : ''">全部</a>
+                    </li>
+                    <li class="nav-item">
+                        <a target="customer/finance/instantBill" class="nav-link" href="{{url('customer/finance/instantBill?type=发货')}}" :class="thisType=='发货' ? 'active' : ''">发货</a>
+                    </li>
+                    <li class="nav-item">
+                        <a target="customer/finance/instantBill" class="nav-link" href="{{url('customer/finance/instantBill?type=收货')}}" :class="thisType=='收货' ? 'active' : ''">收货</a>
+                    </li>
+                    <li class="nav-item">
+                        <a target="customer/finance/instantBill" class="nav-link" href="{{url('customer/finance/instantBill?type=增值服务')}}" :class="thisType=='增值服务' ? 'active' : ''">增值服务</a>
+                    </li>
+                </ul>
+            </div>
+        </div>
         <div id="form_div"></div>
         <div class="mt-1">
             <button type="button" class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
@@ -125,6 +143,7 @@
                     {name:"发货",value:"发货"},{name:"收货",value:"收货"},{name:"增值服务",value:"增值服务"},
                 ],
                 sum : Number("{{ $details->total() }}"),
+                thisType : "",
             },
             mounted(){
                 $('#container').removeClass('d-none');
@@ -176,11 +195,12 @@
                         data: _this.bills,
                         restorationColumn: 'id',
                         fixedTop:($('#form_div').height())+2,
-                        offset:0.5,
+                        offset:7.5,
                         vue:vue
                     });
                     header.init();
                 },0);
+                this.thisType = document.getElementsByName("type")[0].value;
             },
             watch:{
                 checkData:{

+ 16 - 26
resources/views/waybill/edit.blade.php

@@ -597,39 +597,29 @@
                         });
                 },
                 destination_city_id:function (e) {
-                    let _this=this;
-                    let $val=e.target.value;
-                    if($val==='')_this.waybill.destination_city_id='';
-                    else
-                        _this.cities.forEach(function (city) {
-                            if (city.name.includes($val)){
-                                _this.waybill.destination_city_id=city.id;
+                    let val=e.target.value;
+                    if (!val)this. waybill.destination_city_id='';
+                    else this.cities.some((city)=> {
+                            if (city.name.includes(val)){
+                                this.waybill.destination_city_id=city.id;
+                                return true;
                             }
                         });
                 },
                 addCounty:function () {
-                    let _this=this;
-                    if (!_this.waybill.destination_city) {
-                        tempTip.setDuration(2000);
-                        tempTip.show('您未输入市/县!');
+                    if (!this.waybill.destination_city) {
+                        window.tempTip.setDuration(2000);
+                        window.tempTip.show('您未输入市/县!');
                         return;
                     }
-                    tempTip.confirm("您确认添加该市/县?", function () {
-                        let url = '{{url('waybill/addCounty?destination_city=')}}' + _this.waybill.destination_city;
-                        axios.post(url)
-                            .then(function (response) {
-                                if (response.data && response.data.destination_city) {
-                                    tempTip.setDuration(3000);
-                                    tempTip.show(response.data.destination_city[0]);
-                                    return;
-                                }
-                                _this.cities.push(response.data);
-                                _this.waybill.destination_city_id = response.data.id;
-                            }).catch(function (err) {
-                            tempTip.setDuration(3000);
-                            tempTip.show("网络错误!" + err);
+                    window.tempTip.postBasicRequest("{{url('waybill/addCounty')}}",{name:this.waybill.destination_city},res=>{
+                        this.cities.push({
+                            id:res.id,
+                            name:res.name,
+                            type:res.type
                         });
-                    })
+                        this.waybill.destination_city_id = res.id;
+                    });
                 }
             },
         });

+ 5 - 1
resources/views/waybill/index.blade.php

@@ -108,7 +108,10 @@
                     <td class="td-warm">@{{waybill.type}} <span class="badge badge-sm bg-warning" v-if="waybill.collect_fee">到付</span></td>
                     <td class="td-warm">@{{waybill.owner}}</td>
                     <td class="td-warm toptd" :title="waybill.remark? '置顶备注:'+waybill.remark :''">@{{waybill.source_bill}}</td>
-                    <td class="td-warm" >@{{waybill.wms_bill_number}}</td>
+                    <td class="td-warm">
+                        <span class="badge badge-pill badge-danger" v-if="waybill.is_cancel">取消</span>
+                        @{{waybill.wms_bill_number}}
+                    </td>
                     <td class="td-warm">@{{waybill.waybill_number}}</td>
                     @can('运输管理-运单编辑')
                     <td class="td-warm" >
@@ -293,6 +296,7 @@
                         owner:'{{$waybill->owner_name ?? ($waybill->owner->name ?? '')}}',
                         source_bill:'{{$waybill->source_bill}}',
                         wms_bill_number:'{{$waybill->wms_bill_number}}',
+                        is_cancel:'{{$waybill->order->wms_status ?? ''}}' === '订单取消' ? true : false,
                         origination:'{{$waybill->origination}}',
                         destination:'{{$waybill->order_address ?? $waybill->destination}}',
                         recipient:'{{$waybill->order_consignee_name ?? $waybill->recipient}}',