소스 검색

账单手动重置入口
账单生成逻辑变更
页面修缮以及表结构decimal位数不足引起的错误

Zhouzhendong 5 년 전
부모
커밋
5ff922ddd4

+ 1 - 1
app/Console/Commands/CreateOwnerBillReport.php

@@ -46,7 +46,7 @@ class CreateOwnerBillReport extends Command
             $year--;
             $lastMonth = '12';
         }else $lastMonth = ($month-1) < 10 ? "0".($month-1) : ($month-1);
-        $sql = "SELECT owner_id,SUM(work_fee)+SUM(logistic_fee) AS total FROM owner_fee_details WHERE worked_at LIKE ? AND ((type = '发货' AND logistic_fee IS NOT NULL AND work_fee IS NOT NULL) OR (type <> '发货' AND work_fee IS NOT NULL))  GROUP BY owner_id";
+        $sql = "SELECT owner_id,SUM(IFNULL(work_fee,0))+SUM(IFNULL(logistic_fee,0)) AS total FROM owner_fee_details WHERE worked_at LIKE ? AND ((type = '发货' AND logistic_fee IS NOT NULL AND work_fee IS NOT NULL) OR (type <> '发货' AND work_fee IS NOT NULL))  GROUP BY owner_id";
         $billDetails = DB::select(DB::raw($sql),[$year."-".$lastMonth."%"]);
 
         $areas = OwnerAreaReport::query()->with("ownerStoragePriceModel")->where("counting_month","like",$year."-".$lastMonth."%")->get();

+ 63 - 0
app/Http/Controllers/CustomerController.php

@@ -3,8 +3,11 @@
 namespace App\Http\Controllers;
 
 use App\Components\AsyncResponse;
+use App\Jobs\ResetInstantBill;
 use App\Owner;
 use App\OwnerAreaReport;
+use App\OwnerBillReport;
+use App\OwnerFeeDetail;
 use App\OwnerReport;
 use App\Services\LogService;
 use App\Services\OwnerAreaReportService;
@@ -513,4 +516,64 @@ class CustomerController extends Controller
         }
         $this->success($result);
     }
+
+    public function resetInstantBill()
+    {
+        $startData = request("startDate");
+        $endDate = request("endDate");
+        $owner = request("owner");
+        if (!$startData)$this->error("非法参数");
+        $details = OwnerFeeDetail::query()->where("worked_at",">=",$startData." 00:00:00");
+        if ($endDate)$details->where("worked_at","<=",$endDate." 23:59:59");
+        if (count($owner)>0)$details->whereIn("owner_id",$owner);
+        $details->get()->each(function ($detail){
+            $this->dispatch(new ResetInstantBill($detail));
+        });
+        $this->success();
+    }
+
+    public function resetBillConfirmation()
+    {
+        $month = request("month");
+        $owner = request("owner");
+        $sql = <<<sql
+SELECT owner_id,SUM(IFNULL(work_fee,0))+SUM(IFNULL(logistic_fee,0)) AS total 
+FROM owner_fee_details WHERE worked_at LIKE ? 
+sql;
+        if ($owner && count($owner)>0){
+            $sql.=" AND owner_id IN (''";
+            foreach ($owner as $o)$sql .=",'{$o}'";
+            $sql.=")";
+        }
+        $sql .= " AND ((type = '发货' AND logistic_fee IS NOT NULL AND work_fee IS NOT NULL) OR (type <> '发货' AND work_fee IS NOT NULL))  GROUP BY owner_id";
+
+        $billDetails = DB::select(DB::raw($sql),[$month."%"]);
+
+        $areas = OwnerAreaReport::query()->with("ownerStoragePriceModel")->where("counting_month","like",$month."%")->get();
+        $map = [];
+        foreach($areas as $area){
+            if (isset($map[$area->owner_id."_".$area->counting_month])){
+                if (!$area->ownerStoragePriceModel)continue;
+                $map[$area->owner_id."_".$area->counting_month] += app('OwnerStoragePriceModelService')
+                    ->calculationAmount($area->ownerStoragePriceModel,$area->accounting_area,$area->owner_id,$area->counting_month);
+            }else{
+                if (!$area->ownerStoragePriceModel)continue;
+                $map[$area->owner_id."_".$area->counting_month] = app('OwnerStoragePriceModelService')
+                    ->calculationAmount($area->ownerStoragePriceModel,$area->accounting_area,$area->owner_id,$area->counting_month);
+            }
+        }
+
+        $chunks = array_chunk($billDetails,50);
+        foreach ($chunks as $bills){
+            foreach ($bills as $bill){
+                $key = $bill->owner_id."_".$month;
+                $total = $bill->total;
+                if (isset($map[$key]))$total += $map[$key];
+                OwnerBillReport::query()->where("owner_id",$bill->owner_id)
+                    ->where("counting_month",$month."-01")
+                    ->update(["initial_fee"=>$total]);
+            }
+        }
+        $this->success();
+    }
 }

+ 2 - 1
app/Http/Controllers/DeliveryAppointmentController.php

@@ -6,6 +6,7 @@ class DeliveryAppointmentController extends Controller
 {
     public function appointment()
     {
-        return view("store.checkingReceive.appointment");
+        $owners = app("OwnerService")->getIntersectPermitting();
+        return view("store.checkingReceive.appointment",compact("owners"));
     }
 }

+ 1 - 1
app/Http/Controllers/TestController.php

@@ -165,7 +165,7 @@ class TestController extends Controller
             });
     }
     public function exe(OwnerFeeDetail $feeBill){
-        $order = Order::query()->where("id",$feeBill->outer_id);
+        $order = Order::query()->where("id",$feeBill->outer_id)->first();
         $order->loadMissing("packages","owner");//加载包裹
         if (!$order->packages || !$order->owner)return false;
         $order->owner->loadCount("ownerPriceExpresses");

+ 186 - 0
app/Jobs/ResetInstantBill.php

@@ -0,0 +1,186 @@
+<?php
+
+namespace App\Jobs;
+
+use App\Order;
+use App\OwnerFeeDetail;
+use App\OwnerFeeDetailLogistic;
+use App\Process;
+use App\Province;
+use App\Services\CacheService;
+use App\Services\OwnerPriceDirectLogisticService;
+use App\Services\OwnerPriceExpressService;
+use App\Services\OwnerPriceLogisticService;
+use App\Services\OwnerPriceOperationService;
+use App\Store;
+use App\Waybill;
+use Illuminate\Bus\Queueable;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+use Illuminate\Support\Facades\Cache;
+
+class ResetInstantBill implements ShouldQueue
+{
+    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
+
+    /** @var \stdClass $detail  */
+    private $detail;
+    /**
+     * Create a new job instance.
+     *
+     * @param OwnerFeeDetail $detail
+     *
+     * @return void
+     */
+    public function __construct(OwnerFeeDetail $detail)
+    {
+        $this->detail = $detail;
+    }
+
+    /**
+     * Execute the job.
+     *
+     * @return void
+     */
+    public function handle()
+    {
+        switch ($this->detail->outer_table_name){
+            case "orders":
+                /** @var \stdClass $order */
+                $order = Order::query()->find($this->detail->outer_id);
+                $key = date("Y-m")."_".$order->owner_id;
+                if (Cache::has($key))Cache::increment($key);
+                else Cache::put($key,1,2678400);
+
+                $order->loadMissing(["logistic","shop","packages.commodities.commodity","batch"]);
+
+                /** @var OwnerPriceExpressService $service */
+                $service = app("OwnerPriceExpressService");
+                $logistic_fee = 0;
+                $commodities = [];
+                $amount = 0;
+                $volume = 0;
+                $weight = 0;
+                $logistic_bill = "";
+
+                if (!$order->logistic || $order->logistic->type != "快递")$logistic_fee = null;
+
+                $items = [];
+                foreach ($order->packages as &$package){
+                    $logistic_bill .= $package->logistic_number.",";
+                    $volume += $package->bulk;
+                    $weight += $package->weight;
+
+                    // 四维转二维
+                    $partAmount = 0;
+                    foreach($package->commodities as &$commodity){
+                        $commodity["commodity_name"] = $commodity->commodity ? $commodity->commodity->name : '';
+                        $commodity["sku"] = $commodity->commodity ? $commodity->commodity->sku : '';
+                        $partAmount += $commodity->amount;
+                    }
+                    $amount += $partAmount;
+                    $commodities = array_merge($commodities,$package->commodities->toArray());
+
+                    $provinceName = mb_substr($order->province,0,2);
+                    $province = app(CacheService::class)->getOrExecute("province_".$provinceName,function ()use($provinceName){
+                        return Province::query()->where("name","like",$provinceName."%")->first();
+                    },86400);
+                    if ($province){
+                        $fee = $service->matching($package->weight, $order->owner_id, $order->logistic_id, $province->id);
+                    }else{
+                        $logistic_fee = null;
+                        $fee = null;
+                    }
+
+                    $items[] = [
+                        "amount" => $partAmount,
+                        "logistic_bill" => $package->logistic_number,
+                        "volume"=>$package->bulk,
+                        "weight"=>$package->weight,
+                        "logistic_fee" => $fee>0 ? $fee : null,
+                    ];
+                    if ($logistic_fee!==null){
+                        if ($fee<0)$logistic_fee = null;
+                        else $logistic_fee += $fee;
+                    }
+                }
+                if ($logistic_fee!==null && $logistic_fee<0)$logistic_fee = null;
+
+                $object = ["commodities"=>$commodities,
+                    "logistic_name"=>($order->logistic ? $order->logistic->name : ''),
+                    "shop_name"=>($order->shop ? $order->shop->name : ''),
+                    "order_type"=>$order->order_type,
+                    "batch_type" => $order->batch ? $order->batch->wms_type : '',
+                    "owner_id"=>$order->owner_id];
+                $mapping = ["packages"=>"commodities","商品名称"=>"commodity_name",
+                    "承运商"=>"logistic_name","店铺类型"=>"shop_name","订单类型"=>"order_type",
+                    "波次类型"=>"batch_type"];
+
+                /** @var OwnerPriceOperationService $service */
+                $service = app("OwnerPriceOperationService");
+                $result = $service->matching($object,$mapping,$order->owner_id,"出库");
+
+
+                $detail = $this->detail->update([
+                    "work_fee"          => is_array($result) ? ($result["money"]>0 ? $result["money"] : null) : null,
+                    "logistic_fee"      => $logistic_fee,
+                ]);
+                if ($detail){
+                    foreach ($items as $item){
+                        OwnerFeeDetailLogistic::query()->where("owner_fee_detail_id",$detail->id)
+                            ->where("logistic_bill",$item["logistic_bill"])
+                            ->update($item);
+                    }
+                }
+                break;
+            case "processes":
+                /** @var \stdClass $process */
+                $process = Process::query()->with("processStatistic")->find($this->detail->outer_id);
+                $this->detail->update([
+                    "work_fee"  => $process->processStatistic ? $process->processStatistic->revenue : null,
+                ]);
+                break;
+            case "waybills":
+                /** @var \stdClass $waybill */
+                $waybill = Waybill::query()->find($this->detail->outer_id);
+                $waybill->loadMissing(["destinationCity","order.owner"]);
+                if (!$waybill->destinationCity && !$waybill->order)break;
+
+                $owner_id = $waybill->order->owner_id ?? $waybill->owner_id;
+
+                if ($waybill->type == "专线"){
+                    /** @var OwnerPriceLogisticService $service */
+                    $service = app("OwnerPriceLogisticService");
+                    $fee = $service->matching($waybill->carrier_weight_other,$owner_id,$waybill->logistic_id,
+                        $waybill->carrier_weight_unit_id_other,$waybill->order ? app("RegionService")->getProvince($waybill->order->province) : $waybill->destinationCity->province_id,
+                        $waybill->destination_city_id);
+                }else{
+                    /** @var OwnerPriceDirectLogisticService $service */
+                    $service = app("OwnerPriceDirectLogisticService");
+                    $fee = $service->matching($waybill->mileage,$owner_id,$waybill->carType_id);
+                }
+                $this->detail->update([
+                    "logistic_fee" => $fee ?? null,
+                ]);
+                break;
+            case "stores":
+                /** @var \stdClass $store */
+                $store = Store::query()->find($this->detail->outer_id);
+                $store->loadMissing("storeItems");
+
+                /** @var OwnerPriceOperationService $service */
+                $service = app("OwnerPriceOperationService");
+
+                $mapping = ["packages" => "storeItems", "商品名称" => "name", "订单类型" => "stored_method", "订单数"=>"amount"];
+
+                $result = $service->matching($store, $mapping, $store->owner_id, "入库");
+
+                $this->detail->update([
+                    "work_fee" => is_array($result) ? ($result["money"]>0 ? $result["money"] : null) : null,
+                ]);
+                break;
+        }
+    }
+}

+ 1 - 0
app/Services/StoreService.php

@@ -323,6 +323,7 @@ class StoreService
 
     public function createInstantBill(Store $store): bool
     {
+        /** @var \stdClass $store */
         if (!$store || $store->status != "已入库") return false;
         if (OwnerFeeDetail::query()->where("outer_table_name","stores")->where("outer_id",$store->id)->first())return false;
         $store->loadMissing("storeItems");

+ 26 - 24
app/Services/WaybillService.php

@@ -2,6 +2,7 @@
 
 namespace App\Services;
 
+use App\OwnerFeeDetail;
 use App\Services\common\QueryService;
 use App\Waybill;
 use Illuminate\Database\Eloquent\Builder;
@@ -196,41 +197,42 @@ class WaybillService
         $waybill->loadMissing(["destinationCity","order.owner"]);
         if (!$waybill->destinationCity && !$waybill->order)return false;
 
-        $detail = app("OwnerFeeDetailService")->first([
-            "type" => "发货","owner_id" => $waybill->order->owner_id ?? $waybill->owner_id,"operation_bill"=>$waybill->wms_bill_number
-        ]);
-        if (!$detail || $detail->logistic_fee !== null)return false;
+        $owner_id = $waybill->order->owner_id ?? $waybill->owner_id;
+        $detail = OwnerFeeDetail::query()->where("type","发货")
+            ->where("owner_id",$owner_id)->whereIn("operation_bill",[$waybill->wms_bill_number,$waybill->waybill_number])->first();
+
+        if ($detail && $detail->logistic_fee !== null)return false;
 
         if ($waybill->type == "专线"){
             /** @var OwnerPriceLogisticService $service */
             $service = app("OwnerPriceLogisticService");
-            $fee = $service->matching($waybill->carrier_weight_other,$waybill->order->owner_id ?? $waybill->owner_id,$waybill->logistic_id,
+            $fee = $service->matching($waybill->carrier_weight_other,$owner_id,$waybill->logistic_id,
                 $waybill->carrier_weight_unit_id_other,$waybill->order ? app("RegionService")->getProvince($waybill->order->province) : $waybill->destinationCity->province_id,
                 $waybill->destination_city_id);
         }else{
             /** @var OwnerPriceDirectLogisticService $service */
             $service = app("OwnerPriceDirectLogisticService");
-            $fee = $service->matching($waybill->mileage,$waybill->order->owner_id ?? $waybill->owner_id,$waybill->carType_id);
+            $fee = $service->matching($waybill->mileage,$owner_id,$waybill->carType_id);
         }
 
-        if ($fee >= 0){
-            app("OwnerFeeDetailService")->updateFind($detail,[
-                "owner_id" => $waybill->order->owner_id ?? $waybill->owner_id,
-                "worked_at"=> $waybill->updated_at,
-                "type" => "发货",
-                "operation_bill" => $waybill->waybill_number,
-                "consignee_name" => $waybill->recipient,
-                "consignee_phone" => $waybill->recipient_mobile,
-                "commodity_amount" => $waybill->amount,
-                "logistic_bill" => $waybill->carrier_bill,
-                "volume" =>$waybill->carrier_weight ?? $waybill->warehouse_weight,
-                "weight" => $waybill->carrier_weight_other ?? $waybill->warehouse_weight_other,
-                "logistic_id" => $waybill->logistic_id,
-                "logistic_fee" => $fee,
-                "outer_id" => $waybill->id,
-                "outer_table_name" => "waybills",
-            ]);
-        }
+        $obj = [
+            "owner_id" => $owner_id,
+            "worked_at"=> $waybill->updated_at,
+            "type" => "发货",
+            "operation_bill" => $waybill->waybill_number,
+            "consignee_name" => $waybill->recipient,
+            "consignee_phone" => $waybill->recipient_mobile,
+            "commodity_amount" => $waybill->amount,
+            "logistic_bill" => $waybill->carrier_bill,
+            "volume" =>$waybill->carrier_weight ?? $waybill->warehouse_weight,
+            "weight" => $waybill->carrier_weight_other ?? $waybill->warehouse_weight_other,
+            "logistic_id" => $waybill->logistic_id,
+            "logistic_fee" => $fee ?? null,
+            "outer_id" => $waybill->id,
+            "outer_table_name" => "waybills",
+        ];
+        if ($detail)app("OwnerFeeDetailService")->updateFind($detail,$obj);
+        else OwnerFeeDetail::query()->create($obj);
         return true;
     }
 }

+ 45 - 0
database/migrations/2021_03_02_133545_change_owner_bill_reports_table.php

@@ -0,0 +1,45 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeOwnerBillReportsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        \App\Authority::query()->firstOrCreate(["name"=>"结算管理-即时账单-重置即时账单"],[
+            "name"=>"结算管理-即时账单-重置即时账单",
+            "alias_name"=>"结算管理-即时账单-重置即时账单"
+        ]);
+        \App\Authority::query()->firstOrCreate(["name"=>"结算管理-账单确认-重置账单确认"],[
+            "name"=>"结算管理-账单确认-重置账单确认",
+            "alias_name"=>"结算管理-账单确认-重置账单确认"
+        ]);
+        Schema::table('owner_bill_reports', function (Blueprint $table) {
+            $table->decimal('initial_fee',11,3)->nullable()->comment('原始账单金额')->change();
+            $table->decimal('confirm_fee',11,3)->nullable()->comment('确认账单金额')->change();
+            $table->decimal('difference',11,3)->nullable()->comment('差额')->change();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        \App\Authority::query()->whereIn("name",["结算管理-账单确认-重置账单确认","结算管理-账单确认-重置账单确认"])->delete();
+        Schema::table('owner_bill_reports', function (Blueprint $table) {
+            $table->decimal('initial_fee',8,4)->nullable()->comment('原始账单金额')->change();
+            $table->decimal('confirm_fee',8,4)->nullable()->comment('确认账单金额')->change();
+            $table->decimal('difference',8,4)->nullable()->comment('差额')->change();
+        });
+    }
+}

+ 28 - 0
resources/views/finance/_resetBillConfirmation.blade.php

@@ -0,0 +1,28 @@
+<div class="modal fade" tabindex="-1" role="dialog" id="resetBillConfirmation">
+    <div class="modal-dialog modal-lg modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal">&times;</button>
+            </div>
+            <div class="modal-body">
+                <div class="row mt-2">
+                    <span class="col-2">结算月</span>
+                    <label class="col-8">
+                        <input type="month" class="form-control" v-model="reset.month">
+                    </label>
+                </div>
+                <div class="row mt-2">
+                    <span class="col-2">项目</span>
+                    <label class="col-8">
+                        <select class="form-control selectpicker" multiple data-live-search="true" title="项目" v-model="reset.owner">
+                            <option v-for="owner in owners" :value="owner.name">@{{ owner.value }}</option>
+                        </select>
+                    </label>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button"  class="btn btn-success pull-right" @click="resetBillConfirmation()">重置</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 28 - 0
resources/views/finance/_resetInstantBill.blade.php

@@ -0,0 +1,28 @@
+<div class="modal fade" tabindex="-1" role="dialog" id="resetInstantBill">
+    <div class="modal-dialog modal-lg modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal">&times;</button>
+            </div>
+            <div class="modal-body">
+                <label class="row">
+                    <span class="col-2">日期</span>
+                    <input type="date" class="form-control col-4" v-model="reset.startDate">
+                    <span class="mt-1">&nbsp;━━━&nbsp;</span>
+                    <input type="date" class="form-control col-4" v-model="reset.endDate" :min="reset.startDate">
+                </label>
+                <div class="row mt-2">
+                    <span class="col-2">项目</span>
+                    <label class="col-8">
+                        <select class="form-control selectpicker" multiple data-live-search="true" title="项目" v-model="reset.owner">
+                            <option v-for="owner in owners" :value="owner.name">@{{ owner.value }}</option>
+                        </select>
+                    </label>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button"  class="btn btn-success pull-right" @click="resetInstantBill()">重置</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 26 - 6
resources/views/finance/billConfirmation.blade.php

@@ -14,6 +14,8 @@
                 <a class="dropdown-item" @click="billExport(false)" href="javascript:">导出勾选内容</a>
                 <a class="dropdown-item" @click="billExport(true)" href="javascript:">导出所有页</a>
             </div>
+            @include("finance._resetBillConfirmation")
+            @can("结算管理-账单确认-重置账单确认")<button data-toggle="modal" data-target="#resetBillConfirmation" class="btn btn-sm btn-outline-primary">重置账单确认</button>@endcan
         </div>
         <div>
             <label for="all" id="cloneCheckAll" class="d-none">
@@ -92,6 +94,9 @@
                 ],
                 thisIndex:"-1",
                 sum : Number("{{ $bills->total() }}"),
+                reset:{
+                    owner:[],
+                }
             },
             watch:{
                 checkData:{
@@ -129,11 +134,11 @@
                     {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
                         dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
                     {name:'index',value: '序号', neglect: true},
-                    {name:'workgroup',value: '项目小组'},
-                    {name:'customer',value: '客户'},
-                    {name:'owner',value: '子项目'},
-                    {name:'counting_month',value: '结算月'},
-                    {name:'created_at',value: '录入日期'},
+                    {name:'ownerGroupName',value: '项目小组'},
+                    {name:'customerName',value: '客户'},
+                    {name:'ownerName',value: '子项目'},
+                    {name:'countingMonth',value: '结算月'},
+                    {name:'updatedAt',value: '录入日期'},
                     {name:'initial_fee',value: '原始账单金额', neglect: true},
                     {name:'confirm_fee',value: '确认账单金额', neglect: true},
                     {name:'difference',value: '差额', neglect: true},
@@ -214,7 +219,22 @@
                             window.tempTip.show("网络错误:"+err);
                         })
                     });
-                }
+                },
+                resetBillConfirmation(){
+                    window.tempTip.setDuration(3000);
+                    window.tempTip.setIndex(1099);
+                    if (!this.reset.month){
+                        window.tempTip.show("未选择结算月");
+                        return;
+                    }
+                    window.tempTip.setDuration(999999);
+                    window.tempTip.waitingTip("加载中......");
+                    window.tempTip.postBasicRequest("{{url('customer/project/resetBillConfirmation')}}",this.reset,res=>{
+                        window.tempTip.setDuration(2000);
+                        window.tempTip.cancelWaitingTip();
+                        return "重置成功";
+                    },true)
+                },
             },
         });
     </script>

+ 20 - 0
resources/views/finance/instantBill.blade.php

@@ -32,6 +32,8 @@
                 <a class="dropdown-item" @click="billExport(false)" href="javascript:">导出勾选内容</a>
                 <a class="dropdown-item" @click="billExport(true)" href="javascript:">导出所有页</a>
             </div>
+            @include("finance._resetInstantBill")
+            @can("结算管理-即时账单-重置即时账单")<button data-toggle="modal" data-target="#resetInstantBill" class="btn btn-sm btn-outline-primary">重置即时账单</button>@endcan
         </div>
         <div>
             <label for="all" id="cloneCheckAll" class="d-none">
@@ -144,6 +146,9 @@
                 ],
                 sum : Number("{{ $details->total() }}"),
                 thisType : "",
+                reset:{
+                    owner:[],
+                },
             },
             mounted(){
                 $('#container').removeClass('d-none');
@@ -234,6 +239,21 @@
                         this.checkData = [];
                     }
                 },
+                resetInstantBill(){
+                    window.tempTip.setDuration(3000);
+                    window.tempTip.setIndex(1099);
+                    if (!this.reset.startDate){
+                        window.tempTip.show("未选择起始日期");
+                        return;
+                    }
+                    window.tempTip.setDuration(999999);
+                    window.tempTip.waitingTip("加载中......");
+                    window.tempTip.postBasicRequest("{{url('customer/project/resetInstantBill')}}",this.reset,res=>{
+                        window.tempTip.setDuration(2000);
+                        window.tempTip.cancelWaitingTip();
+                        return "重置成功";
+                    },true)
+                },
             },
         });
     </script>

+ 4 - 0
resources/views/store/checkingReceive/appointment.blade.php

@@ -87,7 +87,11 @@
                 model:{
                     cars:[{number:"",id:"",name:"",phone:""}],
                 },
+                owners:JSON.parse("{{$owners->toJson() ?? '{}'}}"),
                 fileName:""
+            },
+            mounted(){
+
             },
             methods:{
                 openFile(){

+ 4 - 0
routes/web.php

@@ -684,6 +684,10 @@ Route::group(['prefix'=>'customer'],function(){
         //手动生成账单
         Route::post("createReport","CustomerController@createReport");
         Route::post("createAreaReport","CustomerController@createAreaReport");
+        //手动重置账单数据
+        Route::post("resetInstantBill","CustomerController@resetInstantBill");
+        Route::post("resetBillConfirmation","CustomerController@resetBillConfirmation");
+
     });
     Route::get('relating',function (){return view('customer.relating');});
     Route::group(['prefix' => 'customer'], function () {