Parcourir la source

客户暂时提交

Zhouzhendong il y a 5 ans
Parent
commit
1a05cfef24
68 fichiers modifiés avec 1916 ajouts et 472 suppressions
  1. 61 0
      app/Console/Commands/CreateOwnerAreaReport.php
  2. 64 0
      app/Console/Commands/CreateOwnerBillReport.php
  3. 2 0
      app/Console/Kernel.php
  4. 50 22
      app/Http/Controllers/CustomerBaseController.php
  5. 164 7
      app/Http/Controllers/CustomerController.php
  6. 0 84
      app/Http/Controllers/JobTypeController.php
  7. 73 6
      app/Http/Controllers/PriceModelController.php
  8. 57 23
      app/Http/Controllers/ProcessMethodController.php
  9. 5 1
      app/Http/Controllers/TestController.php
  10. 44 22
      app/Http/Controllers/UserOwnerGroupController.php
  11. 12 7
      app/OwnerAreaReport.php
  12. 2 1
      app/OwnerBillReport.php
  13. 0 1
      app/OwnerFeeDetail.php
  14. 1 0
      app/OwnerInStorageRule.php
  15. 1 1
      app/OwnerOutStorageRule.php
  16. 3 2
      app/OwnerPriceOperation.php
  17. 10 0
      app/Providers/AppServiceProvider.php
  18. 28 0
      app/Services/CustomerService.php
  19. 52 0
      app/Services/OwnerAreaReportService.php
  20. 58 0
      app/Services/OwnerBillReportService.php
  21. 58 0
      app/Services/OwnerFeeDetailService.php
  22. 43 0
      app/Services/OwnerPriceOperationService.php
  23. 0 5
      app/Services/OwnerReportService.php
  24. 27 0
      app/Services/OwnerStoragePriceModelService.php
  25. 30 0
      app/Services/ProcessMethodService.php
  26. 4 0
      app/Services/ShopService.php
  27. 29 0
      app/Services/UserOwnerGroupService.php
  28. 13 0
      database/factories/LogisticFactory.php
  29. 39 0
      database/factories/OwnerFeeDetailFactory.php
  30. 17 0
      database/factories/OwnerInStorageRuleFactory.php
  31. 20 0
      database/factories/OwnerOutStorageRuleFactory.php
  32. 17 0
      database/factories/OwnerPriceOperationFactory.php
  33. 3 3
      database/factories/OwnerStoragePriceModelFactory.php
  34. 16 0
      database/factories/ProcessMethodFactory.php
  35. 15 0
      database/factories/ShopFactory.php
  36. 0 31
      database/migrations/2020_06_18_111452_create_job_types_table.php
  37. 1 0
      database/migrations/2020_10_26_142753_create_owner_area_reports_table.php
  38. 0 1
      database/migrations/2020_10_26_165012_create_owner_fee_details_table.php
  39. 0 1
      database/migrations/2020_10_28_105613_create_owner_out_storage_rules_table.php
  40. 11 0
      database/migrations/2020_10_28_170858_save_customer_authority_data.php
  41. 3 2
      database/seeds/DatabaseSeeder.php
  42. 16 0
      database/seeds/OwnerFeeDetailSeeder.php
  43. 17 0
      database/seeds/OwnerPriceOperationSeeder.php
  44. 4 2
      resources/js/queryForm/queryForm.js
  45. 127 11
      resources/views/customer/finance/billConfirmation.blade.php
  46. 114 29
      resources/views/customer/finance/instantBill.blade.php
  47. 1 1
      resources/views/customer/menu.blade.php
  48. 152 19
      resources/views/customer/project/area.blade.php
  49. 2 7
      resources/views/customer/project/report.blade.php
  50. 2 19
      resources/views/customer/relating.blade.php
  51. 25 5
      resources/views/maintenance/customer/create.blade.php
  52. 57 2
      resources/views/maintenance/customer/index.blade.php
  53. 1 0
      resources/views/maintenance/customer/menu.blade.php
  54. 0 31
      resources/views/maintenance/jobType/create.blade.php
  55. 0 29
      resources/views/maintenance/jobType/index.blade.php
  56. 0 13
      resources/views/maintenance/jobType/menu.blade.php
  57. 0 4
      resources/views/maintenance/menu.blade.php
  58. 37 7
      resources/views/maintenance/priceModel/operation/index.blade.php
  59. 66 21
      resources/views/maintenance/priceModel/storage/create.blade.php
  60. 52 3
      resources/views/maintenance/priceModel/storage/index.blade.php
  61. 56 24
      resources/views/maintenance/processMethod/create.blade.php
  62. 54 3
      resources/views/maintenance/processMethod/index.blade.php
  63. 1 0
      resources/views/maintenance/processMethod/menu.blade.php
  64. 24 14
      resources/views/maintenance/userOwnerGroup/create.blade.php
  65. 50 4
      resources/views/maintenance/userOwnerGroup/index.blade.php
  66. 1 0
      resources/views/maintenance/userOwnerGroup/menu.blade.php
  67. 19 4
      routes/web.php
  68. 5 0
      serves/excelExportGo/logs/2020-11-04.log

+ 61 - 0
app/Console/Commands/CreateOwnerAreaReport.php

@@ -0,0 +1,61 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\OwnerAreaReport;
+use App\Services\OwnerService;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\DB;
+
+class CreateOwnerAreaReport extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'createOwnerAreaReport';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'create owner area report';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * TODO 25号生成盘点面积记录,记录留空由人工填写
+     *
+     * @return void
+     */
+    public function handle()
+    {
+        /** @var OwnerService $ownerService */
+        $ownerService = app('OwnerService');
+        $chunks = ($ownerService->get([],null,false,true))->chunk(50);
+        $month = date('Y-m-d');
+        foreach ($chunks as $owners){
+            $date = date('Y-m-d H:i:s');
+            $createOwnerAreaReport = [];
+            foreach ($owners as $owner){
+                $createOwnerAreaReport[] = [
+                    "owner_id"              => $owner->id,
+                    "counting_month"        => $month,
+                    "user_owner_group_id"   => $owner->user_owner_group_id,
+                    "created_at"            => $date,
+                ];
+            }
+            DB::table("owner_area_reports")->insert($createOwnerAreaReport);
+        }
+    }
+}

+ 64 - 0
app/Console/Commands/CreateOwnerBillReport.php

@@ -0,0 +1,64 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Services\OwnerService;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\DB;
+
+class CreateOwnerBillReport extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'createOwnerBillReport';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'create owner bill report';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * 1号生成账单确认,确认金额由人工填写
+     *
+     * @return void
+     */
+    public function handle()
+    {
+        $year = (int)date('Y');
+        $month = (int)date('m');
+        if ($month == 1){
+            $year--;
+            $lastMonth = '12';
+        }else $lastMonth = ($month-1) < 10 ? "0".($month-1) : ($month-1);
+        $bills = DB::select(DB::raw("select owner_id,SUM(work_fee)+SUM(logistic_fee) as total from owner_fee_details where worked_at like ? GROUP BY owner_id"),[$year."-".$lastMonth."%"]);
+        $chunks = array_chunk($bills,50);
+        foreach ($chunks as $bills){
+            $date = date('Y-m-d H:i:s');
+            $createOwnerBillReport = [];
+            foreach ($bills as $bill){
+                $createOwnerBillReport[] = [
+                    "owner_id"          => $bill->owner_id,       //项目ID
+                    "counting_month"    => $year."-".$lastMonth."-01", //结算月
+                    "initial_fee"       => $bill->total,    //原始账单金额
+                    "created_at"        => $date,
+                ];
+            }
+            DB::table("owner_bill_reports")->insert($createOwnerBillReport);
+        }
+    }
+}

+ 2 - 0
app/Console/Kernel.php

@@ -35,6 +35,8 @@ class Kernel extends ConsoleKernel
 //        $schedule->command('FluxOrderFix')->cron('* * * * *');
         $schedule->command('WASSyncWMSOrderInformation')->everyMinute();
         $schedule->command('syncLogCacheTask')->everyMinute();
+        $schedule->command('createOwnerReport')->monthlyOn(1);
+        $schedule->command('createOwnerAreaReport')->monthlyOn(25);
     }
 
     /**

+ 50 - 22
app/Http/Controllers/CustomerBaseController.php

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Validator;
 
 class CustomerBaseController extends Controller
 {
@@ -16,7 +17,8 @@ class CustomerBaseController extends Controller
     public function index()
     {
         if(!Gate::allows('客户-查询')){ return redirect('denied');  }
-        return response()->view('maintenance.customer.index');
+        $customers = app('CustomerService')->paginate();
+        return response()->view('maintenance.customer.index',compact("customers"));
     }
 
     /**
@@ -33,56 +35,82 @@ class CustomerBaseController extends Controller
     /**
      * Store a newly created resource in storage.
      *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
+     * @param  Request  $request
+     * @return Response
      */
     public function store(Request $request)
     {
-        //
-    }
-
-    /**
-     * Display the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function show($id)
-    {
-        //
+        if(!Gate::allows('客户-录入')){ return redirect('denied');  }
+        $this->validator($request->input())->validate();
+        app('CustomerService')->create([
+            "code"=>$request->input("code"),
+            "name"=>$request->input("name"),
+            "company_name"=>$request->input("company_name"),
+        ]);
+        return response()->redirectTo("maintenance/customer")->with("successTip","成功创建客户“".$request->input("name")."”");
     }
 
     /**
      * Show the form for editing the specified resource.
      *
      * @param  int  $id
-     * @return \Illuminate\Http\Response
+     * @return Response
      */
     public function edit($id)
     {
-        //
+        if(!Gate::allows('客户-编辑')){ return redirect('denied');  }
+        $customer = app('CustomerService')->find($id);
+        return response()->view('maintenance.customer.create',compact("customer"));
     }
 
     /**
      * Update the specified resource in storage.
      *
-     * @param  \Illuminate\Http\Request  $request
+     * @param  Request  $request
      * @param  int  $id
-     * @return \Illuminate\Http\Response
+     * @return Response
      */
     public function update(Request $request, $id)
     {
-        //
+        if(!Gate::allows('客户-编辑')){ return redirect('denied');  }
+        $this->validator($request->input(),$id)->validate();
+        $result = app('CustomerService')->update(["id"=>$id],[
+            "code"=>$request->input("code"),
+            "name"=>$request->input("name"),
+            "company_name"=>$request->input("company_name"),
+        ]);
+        if ($result == 1){
+            return response()->redirectTo("maintenance/customer")->with("successTip","成功修改客户“".$request->input("name")."”的信息");
+        }
+        return response()->view("exception.default",["code"=>"509"]);
     }
 
     /**
      * Remove the specified resource from storage.
      *
      * @param  int  $id
-     * @return \Illuminate\Http\Response
+     * @return array
      */
     public function destroy($id)
     {
-        //
+        if(!Gate::allows('客户-删除')){ return ["success"=>false,"data"=>"无权操作!"];  }
+        $result = app('CustomerService')->destroy($id);
+        if ($result == 1)return ["success"=>true];
+        return ["success"=>false,"data"=>"删除了“".$result."”行"];
+    }
+
+    private function validator(array $params, $id = null)
+    {
+        return Validator::make($params,[
+            'code'=>['required',$id?"unique:customers,code,$id":'unique:customers,code','max:20'],
+            'name'=>['required','max:20'],
+        ],[
+            'required'=>':attribute 为必填项',
+            'max'=>':attribute 字符过多或输入值过大',
+            'unique'=>':attribute 已存在',
+        ],[
+            'code'=>'客户代码',
+            'name'=>'客户名称',
+        ]);
     }
 }

+ 164 - 7
app/Http/Controllers/CustomerController.php

@@ -3,12 +3,15 @@
 namespace App\Http\Controllers;
 
 use App\Owner;
+use App\Services\OwnerAreaReportService;
+use App\Services\OwnerBillReportService;
 use App\Services\OwnerReportService;
 use App\Services\OwnerService;
 use Exception;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Support\Facades\Http;
 use Illuminate\Support\Facades\Validator;
@@ -32,7 +35,8 @@ class CustomerController extends Controller
         $customers = app('CustomerService')->getSelection();
         $owners = app('OwnerService')->getSelection();
         $reports = app("OwnerReportService")->paginate($request->input(),$withs);
-        return response()->view('customer.project.report',compact("reports","ownerGroups","customers","owners"));
+        $params = $request->input();
+        return response()->view('customer.project.report',compact("reports","ownerGroups","customers","owners","params"));
     }
 
     public function projectReportExport(Request $request)
@@ -225,22 +229,175 @@ class CustomerController extends Controller
         return response()->view('customer.project.create',compact("customers","ownerGroups","storagePriceModels",'owner'));
     }
 
-    public function projectArea()
+    public function projectArea(Request $request)
     {
         if(!Gate::allows('客户管理-项目-面积')){ return redirect('denied');  }
-        return response()->view('customer.project.area');
+        $areas = app('OwnerAreaReportService')->paginate($request->input(),["owner"=>function($query){$query->with(["customer","ownerStoragePriceModels"]);}]);
+        $ownerGroups = app('UserOwnerGroupService')->getSelection();
+        $customers = app('CustomerService')->getSelection();
+        $owners = app('OwnerService')->getSelection();
+        $params = $request->input();
+        return response()->view('customer.project.area',compact("areas","ownerGroups","customers","owners","params"));
+    }
+
+    public function updateArea(Request $request)
+    {
+        if(!Gate::allows('客户管理-项目-面积-编辑')){ return ["success"=>false,'data'=>"无权操作!"];  }
+        if (!($request->id ?? false) || !($request->area ?? false)) return ["success"=>false,'data'=>"传递错误!"];
+        $values = $request->area ?? null;
+        if (!$values)return ["success"=>true,"data"=>$values];
+        foreach ($values as $column=>$value){
+            if ($value && (!is_numeric($value) || $value<0))return ["success"=>false,'data'=>$column."非数字或小于0!"];
+        }
+        $accounting_area = ((int)$values["area_on_tray"]*205) + ((int)$values["area_on_half_tray"]*1.8) + ((int)$values["area_on_flat"]*1.3);
+        $values["accounting_area"] = $accounting_area;
+        if (app('OwnerAreaReportService')->update(["id"=>$request->id],$values))
+            return ["success"=>true,"data"=>$values];
+        return ["success"=>false,"data"=>"未知错误!"];
+    }
+
+    public function projectAreaExport(Request $request)
+    {
+        if(!Gate::allows('客户管理-项目-面积')){ return redirect('denied');  }
+        $params = $request->input();
+        if ($request->checkAllSign)unset($params['checkAllSign']);
+        else $params = ["id"=>$request->data];
+        /** @var OwnerAreaReportService $serves */
+        $serves = app('OwnerAreaReportService');
+        $areas = $serves->get($params,["owner"=>function($query){$query->with(["customer","ownerStoragePriceModels","userOwnerGroup"]);}]);
+
+        $column = ["状态","项目组","客户","子项目","结算月","录入时间","用仓类型","货物整托","货物半托","平面区面积","结算面积"];
+        $list = [];
+        foreach ($areas as $area){
+            $list[] = [
+                $area->status,
+                $area->owner ? ($area->owner->userOwnerGroup ? $area->owner->userOwnerGroup->name : '') : '',
+                $area->owner ? ($area->owner->customer ? $area->owner->customer->name : '') : '',
+                $area->owner ? $area->owner->name : '',
+                $area->counting_month,
+                $area->updated_at,
+                $area->owner ? implode(",",array_unique(array_column(($area->owner->ownerStoragePriceModels)->toArray(),"using_type"))) : '',
+                $area->area_on_tray,
+                $area->area_on_half_tray,
+                $area->area_on_flat,
+                $area->accounting_area,
+            ];
+        }
+
+        $post = Http::post(config('go.export.url'),['type'=>'base','data'=>json_encode(["row"=>$column,"list"=>$list],JSON_UNESCAPED_UNICODE)]);
+        if ($post->status() == 500){
+            throw new Exception($post->header("Msg"));
+        }
+        return response($post,200, [
+            "Content-type"=>"application/octet-stream",
+            "Content-Disposition"=>"attachment; filename=项目面积报表-".date('ymdHis').'.xlsx',
+        ]);
     }
 
-    public function financeInstantBill()
+    public function financeInstantBill(Request $request)
     {
         if(!Gate::allows('客户管理-财务-即时账单')){ return redirect('denied');  }
-        return response()->view('customer.finance.instantBill');
+        $params = $request->input();
+        $shops = app('ShopService')->getSelection();
+        $customers = app('CustomerService')->getSelection();
+        $owners = app('OwnerService')->getSelection();
+        $details = app('OwnerFeeDetailService')->paginate($params,["owner"=>function($query){$query->with("customer");},"shop","processMethod","logistic"]);
+        return response()->view('customer.finance.instantBill',compact("details","params","shops","customers","owners"));
     }
 
-    public function financeBillConfirmation()
+    public function financeInstantBillExport(Request $request)
+    {
+        if(!Gate::allows('客户管理-财务-即时账单')){ return redirect('denied');  }
+        $params = $request->input();
+        if ($request->checkAllSign)unset($params['checkAllSign']);
+        else $params = ["id"=>$request->data];
+        $sql = app('OwnerFeeDetailService')->getSql($params);
+
+        $row = ["客户", "项目", "作业时间", "类型","店铺", "单号(发/收/退/提)", "收件人", "收件人电话", "商品数量",
+            "物流/快递单号", "体积", "重量", "承运商", "操作费", "物流费", "合计"];
+        $column = ["customer_name", "owner_name", "worked_at", "type","shop_name", "operation_bill", "consignee_name", "consignee_phone", "commodity_amount",
+            "logistic_bill", "volume", "weight", "logistic_name", "work_fee", "logistic_fee", "total"];
+        $rule = ["work_fee"=>"mysqlDate"];
+
+        $post = Http::post(config('go.export.url'),['type'=>'unify','sql'=>$sql, 'connection'=>'mysql',
+            'row'=>json_encode($row,JSON_UNESCAPED_UNICODE), 'column'=>json_encode($column), 'rule'=>json_encode($rule)]);
+        if ($post->status() == 500){
+            throw new Exception($post->header("Msg"));
+        }
+        return response($post,200, [
+            "Content-type"=>"application/octet-stream",
+            "Content-Disposition"=>"attachment; filename=即时账单记录-".date('ymdHis').'.xlsx',
+        ]);
+    }
+
+    public function financeBillConfirmation(Request $request)
     {
         if(!Gate::allows('客户管理-财务-账单确认')){ return redirect('denied');  }
-        return response()->view('customer.finance.billConfirmation');
+        $params = $request->input();
+        $ownerGroups = app('UserOwnerGroupService')->getSelection();
+        $customers = app('CustomerService')->getSelection();
+        $owners = app('OwnerService')->getSelection();
+        $bills = app('OwnerBillReportService')->paginate($params,["owner"=>function($query){
+            /** @var Builder $query */
+            $query->with(["customer","userOwnerGroup"]);
+        }]);
+        return response()->view('customer.finance.billConfirmation',compact("params","owners","ownerGroups","customers","bills"));
+    }
+
+    public function financeBillConfirmationExport(Request $request)
+    {
+        if(!Gate::allows('客户管理-财务-账单确认')){ return redirect('denied');  }
+        $params = $request->input();
+        if ($request->checkAllSign)unset($params['checkAllSign']);
+        else $params = ["id"=>$request->data];
+        /** @var OwnerBillReportService $serves */
+        $serves = app('OwnerBillReportService');
+        $bills = $serves->get($params,["owner"=>function($query){
+            /** @var Builder $query */
+            $query->with(["customer","userOwnerGroup"]);
+        }]);
+
+        $column = ["项目小组","客户","子项目","结算月","录入日期","原始账单金额","确认账单金额","差额","状态"];
+        $list = [];
+        foreach ($bills as $bill){
+            $list[] = [
+                $bill->owner ? ($bill->owner->userOwnerGroup ? $bill->owner->userOwnerGroup->name : '') : '',
+                $bill->owner ? ($bill->owner->customer ? $bill->owner->customer->name : '') : '',
+                $bill->owner ? $bill->owner->name : '',
+                $bill->counting_month,
+                $bill->updated_at,
+                $bill->initial_fee,
+                $bill->confirm_fee,
+                $bill->difference,
+                $bill->confirmed == '是' ? '已确认' : '未确认',
+            ];
+        }
+
+        $post = Http::post(config('go.export.url'),['type'=>'base','data'=>json_encode(["row"=>$column,"list"=>$list],JSON_UNESCAPED_UNICODE)]);
+        if ($post->status() == 500){
+            throw new Exception($post->header("Msg"));
+        }
+        return response($post,200, [
+            "Content-type"=>"application/octet-stream",
+            "Content-Disposition"=>"attachment; filename=客户账单报表-".date('ymdHis').'.xlsx',
+        ]);
+    }
+
+    public function updateBillReport(Request $request)
+    {
+        if(!Gate::allows('客户管理-财务-账单确认-编辑')){ return ["success"=>false,'data'=>"无权操作!"];  }
+        if (!$request->confirm_fee || !is_numeric($request->confirm_fee) || $request->confirm_fee<0)return ["success"=>false,"data"=>"非法金额参数"];
+        $date = date('Y-m-d H:i:s');
+        app('OwnerBillReportService')->update(["id"=>$request->id],["confirm_fee"=>$request->confirm_fee,"difference"=>DB::raw($request->confirm_fee.'- initial_fee'),"updated_at"=>$date]);
+        return ["success"=>true,"data"=>$date];
+    }
+
+    public function billConfirm(Request $request)
+    {
+        if(!Gate::allows('客户管理-财务-账单确认-完结')){ return ["success"=>false,'data'=>"无权操作!"];  }
+        if (!($request->id ?? false))return["success"=>false,"data"=>"非法参数"];
+        app('OwnerBillReportService')->update(["id"=>$request->id],["confirmed"=>"是"]);
+        return ["success"=>true];
     }
 
     private function validator(array $params){

+ 0 - 84
app/Http/Controllers/JobTypeController.php

@@ -1,84 +0,0 @@
-<?php
-
-namespace App\Http\Controllers;
-
-use Illuminate\Http\Request;
-
-class JobTypeController extends Controller
-{
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index()
-    {
-        return view('maintenance.jobType.index');
-    }
-
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        return view('maintenance.jobType.create');
-    }
-
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Request $request)
-    {
-        //
-    }
-
-    /**
-     * Display the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function show($id)
-    {
-        //
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function edit($id)
-    {
-        //
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, $id)
-    {
-        //
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy($id)
-    {
-        //
-    }
-}

+ 73 - 6
app/Http/Controllers/PriceModelController.php

@@ -4,24 +4,91 @@ namespace App\Http\Controllers;
 
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Validator;
 
 class PriceModelController extends Controller
 {
-    public function storeIndex()
+    public function storageIndex()
     {
         if(!Gate::allows('计费模型-仓储')){ return redirect('denied');  }
-        return response()->view('maintenance.priceModel.storage.index');
+        $models = app('OwnerStoragePriceModelService')->paginate(["unit"]);
+        return response()->view('maintenance.priceModel.storage.index',compact("models"));
     }
 
-    public function storeCreate()
+    public function storageCreate()
     {
         if(!Gate::allows('计费模型-仓储-录入')){ return redirect('denied');  }
-        return response()->view('maintenance.priceModel.storage.create');
+        $units = app('UnitService')->getSelection();
+        return response()->view('maintenance.priceModel.storage.create',compact("units"));
     }
 
-    public function operationIndex(){
+    public function storageStore(Request $request)
+    {
+        if(!Gate::allows('计费模型-仓储-录入')){ return redirect('denied');  }
+        $this->storageValidator($request->input())->validate();
+        app('OwnerStoragePriceModelService')->create($request->input());
+        return response()->redirectTo('maintenance/priceModel/storage')->with('successTip',"创建成功!");
+    }
+
+    public function storageEdit($id)
+    {
+        if(!Gate::allows('计费模型-仓储-编辑')){ return redirect('denied');  }
+        $model = app('OwnerStoragePriceModelService')->find($id);
+        $units = app('UnitService')->getSelection();
+        return response()->view('maintenance.priceModel.storage.create',compact("units","model"));
+    }
+
+    public function storageUpdate(Request $request)
+    {
+        if(!Gate::allows('计费模型-仓储-编辑')){ return redirect('denied');  }
+        app('OwnerStoragePriceModelService')->update(["id"=>$request->input("id")],[
+            "counting_type" => $request->input("counting_type"),
+            "using_type"    => $request->input("using_type"),
+            "minimum_area"  => $request->input("minimum_area"),
+            "price"         => $request->input("price"),
+            "discount_type" => $request->input("discount_type"),
+            "discount_value"=> $request->input("discount_value"),
+            "unit_id"       => $request->input("unit_id"),
+        ]);
+        return response()->redirectTo('maintenance/priceModel/storage')->with('successTip',"更新成功!");
+    }
+
+    public function storageDestroy($id)
+    {
+        app("OwnerStoragePriceModelService")->destroy($id);
+        return ["success"=>true];
+    }
+
+    private function storageValidator(array $params)
+    {
+        return Validator::make($params,[
+            'counting_type'=>['required'],
+            'using_type'=>['required'],
+            'minimum_area'=>['nullable','numeric','min:0'],
+            'discount_value'=>['nullable','numeric','min:0'],
+            'price'=>['required','numeric','min:0'],
+            'discount_type'=>['required'],
+            'unit_id'=>['required','integer'],
+        ],[
+            'required'=>':attribute 为必填项',
+            'min'=>':attribute 不得小于0',
+            'integer'=>':attribute 未选择',
+        ],[
+            'counting_type' =>"计费类型",
+            'using_type'    =>"用仓类型",
+            'minimum_area'  =>"最低起租面积",
+            'price'         =>"单价",
+            'discount_type' =>"减免类型",
+            'discount_value'=>"减免值",
+            'unit_id'       =>"单位",
+        ]);
+    }
+
+    public function operationIndex(Request $request){
         if(!Gate::allows('计费模型-作业-查询')){ return redirect('denied');  }
-        return response()->view('maintenance.priceModel.operation.index');
+        $models = app('OwnerPriceOperationService')->paginate($request->input(),["ownerInStorageRules","ownerOutStorageRules"]);
+        $owners = app("OwnerService")->getSelection();
+        return response()->view('maintenance.priceModel.operation.index',compact("models","owners"));
     }
 
     public function operationCreate(){

+ 57 - 23
app/Http/Controllers/ProcessMethodController.php

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Validator;
 
 class ProcessMethodController extends Controller
 {
@@ -16,7 +17,8 @@ class ProcessMethodController extends Controller
     public function index()
     {
         if(!Gate::allows('作业类型-查询')){ return redirect('denied');  }
-        return response()->view("maintenance.processMethod.index");
+        $methods = app('ProcessMethodService')->paginate();
+        return response()->view("maintenance.processMethod.index",compact("methods"));
     }
 
     /**
@@ -27,62 +29,94 @@ class ProcessMethodController extends Controller
     public function create()
     {
         if(!Gate::allows('作业类型-录入')){ return redirect('denied');  }
-        return response()->view("maintenance.processMethod.create");
+        $units = app('UnitService')->getSelection();
+        return response()->view("maintenance.processMethod.create",compact("units"));
     }
 
     /**
      * Store a newly created resource in storage.
      *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
+     * @param  Request  $request
+     * @return Response
      */
     public function store(Request $request)
     {
-        //
-    }
-
-    /**
-     * Display the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function show($id)
-    {
-        //
+        if(!Gate::allows('作业类型-录入')){ return redirect('denied');  }
+        $this->validator($request->input())->validate();
+        app('ProcessMethodService')->create([
+            "name"=>$request->input("name"),
+            "unit_id"=>$request->input("unit_id"),
+            "unit_price"=>$request->input("unit_price"),
+        ]);
+        return response()->redirectTo("maintenance/processMethod")->with("successTip","成功创建项目组“".$request->input("name")."”");
     }
 
     /**
      * Show the form for editing the specified resource.
      *
      * @param  int  $id
-     * @return \Illuminate\Http\Response
+     * @return Response
      */
     public function edit($id)
     {
-        //
+        if(!Gate::allows('作业类型-编辑')){ return redirect('denied');  }
+        $method = app('ProcessMethodService')->find($id);
+        $units = app('UnitService')->getSelection();
+        return response()->view('maintenance.processMethod.create',compact("method","units"));
     }
 
     /**
      * Update the specified resource in storage.
      *
-     * @param  \Illuminate\Http\Request  $request
+     * @param  Request  $request
      * @param  int  $id
-     * @return \Illuminate\Http\Response
+     * @return Response
      */
     public function update(Request $request, $id)
     {
-        //
+        if(!Gate::allows('作业类型-编辑')){ return redirect('denied');  }
+        $this->validator($request->input(),$id)->validate();
+        $result = app('ProcessMethodService')->update(["id"=>$id],[
+            "name"=>$request->input("name"),
+            "unit_id"=>$request->input("unit_id"),
+            "unit_price"=>$request->input("unit_price"),
+        ]);
+        if ($result == 1){
+            return response()->redirectTo("maintenance/processMethod")->with("successTip","成功修改项目组“".$request->input("name")."”的信息");
+        }
+        return response()->view("exception.default",["code"=>"509"]);
     }
 
     /**
      * Remove the specified resource from storage.
      *
      * @param  int  $id
-     * @return \Illuminate\Http\Response
+     * @return array
      */
     public function destroy($id)
     {
-        //
+        if(!Gate::allows('作业类型-删除')){ return ["success"=>false,"data"=>"无权操作!"];  }
+        $result = app('ProcessMethodService')->destroy($id);
+        if ($result == 1)return ["success"=>true];
+        return ["success"=>false,"data"=>"删除了“".$result."”行"];
+    }
+
+    private function validator(array $params, $id = null)
+    {
+        return Validator::make($params,[
+            'name'=>['required',$id?"unique:process_methods,name,$id":'unique:process_methods,name','max:20'],
+            "unit_id" => ["nullable",'numeric'],
+            "unit_price" => ["nullable",'numeric','min:0'],
+        ],[
+            'required'=>':attribute 为必填项',
+            'max'=>':attribute 字符过多或输入值过大',
+            'unique'=>':attribute 已存在',
+            'numeric'=>':attribute 必须为数字',
+            'min'=>':attribute 数值过小',
+        ],[
+            'name'=>'作业类型名称',
+            'unit_id'=>'作业类型单位',
+            'unit_price'=>'作业类型单价',
+        ]);
     }
 }

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

@@ -29,6 +29,8 @@ use App\OrderPackageCommodities;
 use App\OrderTracking;
 use App\OrderTrackingOwner;
 use App\Owner;
+use App\OwnerFeeDetail;
+use App\OwnerPriceOperation;
 use App\Package;
 use App\Process;
 use App\ProcessDaily;
@@ -55,6 +57,7 @@ use App\Services\OrderService;
 use App\Services\OrderTrackingOwnerService;
 use App\Services\OrderTrackingService;
 use App\Services\WarehouseService;
+use App\Shop;
 use App\StoreCheckingReceive;
 use App\StoreCheckingReceiveItem;
 use App\Unit;
@@ -88,7 +91,8 @@ class TestController extends Controller
     }
 
     public function test4(){
-        dd(date('Y-m'));
+        $o = new OwnerPriceOperation;
+        dd($o->getIds('2,1'));
 
     }
 

+ 44 - 22
app/Http/Controllers/UserOwnerGroupController.php

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Validator;
 
 class UserOwnerGroupController extends Controller
 {
@@ -16,7 +17,8 @@ class UserOwnerGroupController extends Controller
     public function index()
     {
         if(!Gate::allows('项目组-查询')){ return redirect('denied');  }
-        return response()->view("maintenance.userOwnerGroup.index");
+        $groups = app('UserOwnerGroupService')->paginate();
+        return response()->view("maintenance.userOwnerGroup.index",compact("groups"));
     }
 
     /**
@@ -33,56 +35,76 @@ class UserOwnerGroupController extends Controller
     /**
      * Store a newly created resource in storage.
      *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
+     * @param  Request  $request
+     * @return Response
      */
     public function store(Request $request)
     {
-        //
-    }
-
-    /**
-     * Display the specified resource.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response
-     */
-    public function show($id)
-    {
-        //
+        if(!Gate::allows('项目组-录入')){ return redirect('denied');  }
+        $this->validator($request->input())->validate();
+        app('UserOwnerGroupService')->create([
+            "name"=>$request->input("name"),
+        ]);
+        return response()->redirectTo("maintenance/userOwnerGroup")->with("successTip","成功创建项目组“".$request->input("name")."”");
     }
 
     /**
      * Show the form for editing the specified resource.
      *
      * @param  int  $id
-     * @return \Illuminate\Http\Response
+     * @return Response
      */
     public function edit($id)
     {
-        //
+        if(!Gate::allows('项目组-编辑')){ return redirect('denied');  }
+        $group = app('UserOwnerGroupService')->find($id);
+        return response()->view('maintenance.userOwnerGroup.create',compact("group"));
     }
 
     /**
      * Update the specified resource in storage.
      *
-     * @param  \Illuminate\Http\Request  $request
+     * @param  Request  $request
      * @param  int  $id
-     * @return \Illuminate\Http\Response
+     * @return Response
      */
     public function update(Request $request, $id)
     {
-        //
+        if(!Gate::allows('项目组-编辑')){ return redirect('denied');  }
+        $this->validator($request->input(),$id)->validate();
+        $result = app('UserOwnerGroupService')->update(["id"=>$id],[
+            "name"=>$request->input("name"),
+        ]);
+        if ($result == 1){
+            return response()->redirectTo("maintenance/userOwnerGroup")->with("successTip","成功修改项目组“".$request->input("name")."”的信息");
+        }
+        return response()->view("exception.default",["code"=>"509"]);
     }
 
     /**
      * Remove the specified resource from storage.
      *
      * @param  int  $id
-     * @return \Illuminate\Http\Response
+     * @return array
      */
     public function destroy($id)
     {
-        //
+        if(!Gate::allows('项目组-删除')){ return ["success"=>false,"data"=>"无权操作!"];  }
+        $result = app('UserOwnerGroupService')->destroy($id);
+        if ($result == 1)return ["success"=>true];
+        return ["success"=>false,"data"=>"删除了“".$result."”行"];
+    }
+
+    private function validator(array $params, $id = null)
+    {
+        return Validator::make($params,[
+            'name'=>['required',$id?"unique:user_owner_groups,name,$id":'unique:user_owner_groups,name','max:20'],
+        ],[
+            'required'=>':attribute 为必填项',
+            'max'=>':attribute 字符过多或输入值过大',
+            'unique'=>':attribute 已存在',
+        ],[
+            'name'=>'项目组名称',
+        ]);
     }
 }

+ 12 - 7
app/OwnerAreaReport.php

@@ -7,19 +7,24 @@ use Illuminate\Database\Eloquent\Model;
 class OwnerAreaReport extends Model
 {
     protected $fillable = [
-        "owner_id",         //货主ID
-        "counting_month",   //结算月
-        "area_on_tray",     //货物整托
-        "area_on_half_tray",//货物半托
-        "area_on_flat",     //平面区面积
-        "accounting_area",  //结算面积
-        "status"            //状态
+        "owner_id",             //货主ID
+        "counting_month",       //结算月
+        "user_owner_group_id",  //项目组ID
+        "area_on_tray",         //货物整托
+        "area_on_half_tray",    //货物半托
+        "area_on_flat",         //平面区面积
+        "accounting_area",      //结算面积
+        "status"                //状态
     ];
 
     public function owner()
     {   //货主
         return $this->hasOne(Owner::class,"id","owner_id");
     }
+    public function userOwnerGroup()
+    {   //项目组
+        return $this->hasOne(UserOwnerGroup::class,"id","user_owner_group_id");
+    }
 
     /* 结算月格式转换,仅截取至月
      * 引用:CreateOwnerReport

+ 2 - 1
app/OwnerBillReport.php

@@ -14,10 +14,11 @@ class OwnerBillReport extends Model
        "difference",     //差额
        "confirmed",      //确认状态
    ];
+   public $timestamps=false;
 
    public function owner()
    {   //货主
-       $this->hasOne(Owner::class,"id","owner_id");
+       return $this->hasOne(Owner::class,"id","owner_id");
    }
 
     /* 结算月格式转换,仅截取至月

+ 0 - 1
app/OwnerFeeDetail.php

@@ -9,7 +9,6 @@ class OwnerFeeDetail extends Model
 {
     protected $fillable = [
         "owner_id",         //货主ID
-        "counting_month",   //结算月
         "worked_at",        //作业时间
         "type",             //类型
         "shop_id",          //店铺ID

+ 1 - 0
app/OwnerInStorageRule.php

@@ -12,6 +12,7 @@ class OwnerInStorageRule extends Model
         "unit_id",                  //单位ID
         "unit_price",               //单价
     ];
+    public $timestamps=false;
 
     public function unit()
     {   //单位

+ 1 - 1
app/OwnerOutStorageRule.php

@@ -8,13 +8,13 @@ class OwnerOutStorageRule extends Model
 {
     protected $fillable = [
         "owner_price_operation_id",         //作业计费ID
-        "owner_price_operation_strategy",   //作业计费策略
         "strategy",                         //出库策略
         "amount",                           //起步数
         "unit_id",                          //单位ID
         "unit_price",                       //单价
         "feature",                          //特征
     ];
+    public $timestamps=false;
 
     public function unit()
     {   //单位

+ 3 - 2
app/OwnerPriceOperation.php

@@ -3,6 +3,7 @@
 namespace App;
 
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\DB;
 
 class OwnerPriceOperation extends Model
 {
@@ -14,9 +15,9 @@ class OwnerPriceOperation extends Model
         "remark",           //备注
     ];
 
-    public function ownerInStorageRule()
+    public function ownerInStorageRules()
     {   //入库规则
-        return $this->hasOne(OwnerInStorageRule::class,"owner_price_operation_id","id");
+        return $this->hasMany(OwnerInStorageRule::class,"owner_price_operation_id","id");
     }
     public function ownerOutStorageRules()
     {   //出库规则

+ 10 - 0
app/Providers/AppServiceProvider.php

@@ -29,6 +29,10 @@ use App\Services\OrderService;
 use App\Services\OrderIssueWorkLoadService;
 use App\Services\OrderPackageCommoditiesService;
 use App\Services\OrderTrackingService;
+use App\Services\OwnerAreaReportService;
+use App\Services\OwnerBillReportService;
+use App\Services\OwnerFeeDetailService;
+use App\Services\OwnerPriceOperationService;
 use App\Services\OwnerReportService;
 use App\Services\OwnerService;
 use App\Services\OwnerStoragePriceModelService;
@@ -45,6 +49,7 @@ use App\Services\StoreCheckingReceiveItemService;
 use App\Services\StoreCheckingReceiveService;
 use App\Services\StoreItemService;
 use App\Services\StoreService;
+use App\Services\UnitService;
 use App\Services\UserOwnerGroupService;
 use App\Services\UserService;
 use App\Services\WarehouseService;
@@ -135,6 +140,9 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('WarehouseService',WarehouseService::class);
         app()->singleton('StoreItemService',StoreItemService::class);
         app()->singleton('OwnerReportService',OwnerReportService::class);
+        app()->singleton('OwnerAreaReportService',OwnerAreaReportService::class);
+        app()->singleton('OwnerFeeDetailService',OwnerFeeDetailService::class);
+        app()->singleton('OwnerBillReportService',OwnerBillReportService::class);
 
         $this->loadingOrderModuleService();
         $this->loadingBasedModuleService();
@@ -163,6 +171,8 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('UserOwnerGroupService',UserOwnerGroupService::class);
         app()->singleton('CustomerService',CustomerService::class);
         app()->singleton('OwnerStoragePriceModelService',OwnerStoragePriceModelService::class);
+        app()->singleton('UnitService',UnitService::class);
+        app()->singleton('OwnerPriceOperationService',OwnerPriceOperationService::class);
     }
 
     private function loadingRejectedModuleService(){

+ 28 - 0
app/Services/CustomerService.php

@@ -11,4 +11,32 @@ Class CustomerService
         return Customer::query()->select($column)->get();
     }
 
+    public function paginate()
+    {
+        return Customer::query()->orderByDesc('id')->paginate(50);
+    }
+
+    public function create(array $params)
+    {
+        return Customer::query()->create($params);
+    }
+
+    public function find($id)
+    {
+        return Customer::query()->find($id);
+    }
+
+    public function update(array $params, array $values)
+    {
+        $query = Customer::query();
+        foreach ($params as $column => $value){
+            $query->where($column,$value);
+        }
+        return $query->update($values);
+    }
+
+    public function destroy($id)
+    {
+        return Customer::destroy($id);
+    }
 }

+ 52 - 0
app/Services/OwnerAreaReportService.php

@@ -0,0 +1,52 @@
+<?php 
+
+namespace App\Services; 
+
+use App\OwnerAreaReport;
+use App\Services\common\QueryService;
+use Illuminate\Database\Eloquent\Builder;
+
+Class OwnerAreaReportService
+{
+    /**
+     * @param Builder $builder
+     * @param array $params
+     * @return Builder
+     */
+    private function query(Builder $builder, array $params)
+    {
+        $columnQueryRules = [
+            'counting_month_start' => ['alias' => 'counting_month', 'startDate' => '-01'],
+            'counting_month_end' => ['alias' => 'counting_month', 'endDate' => '-31'],
+            'owner_id' => ['multi' => ','],
+        ];
+        if ($params["customer_id"] ?? false){
+            $builder->whereHas('owner',function ($query)use(&$params){
+                /** @var Builder $query*/
+                $query->where("customer_id",$params["customer_id"]);
+                unset($params["customer_id"]);
+            });
+        }
+        return app(QueryService::class)->query($params, $builder, $columnQueryRules);
+    }
+
+    public function paginate(array $params, array $withs = null)
+    {
+        $areas = OwnerAreaReport::query()->orderByDesc('id');
+        if ($withs)$areas->with($withs);
+        return $this->query($areas,$params)->paginate($params["paginate"] ?? 50);
+    }
+
+    public function update(array $params, array $values)
+    {
+        return $this->query(OwnerAreaReport::query(),$params)->update($values);
+    }
+
+    public function get(array $params, array $withs = null)
+    {
+        $query = OwnerAreaReport::query()->orderByDesc('id');
+        if ($withs)$query->with($withs);
+        return $this->query($query,$params)->get();
+    }
+
+}

+ 58 - 0
app/Services/OwnerBillReportService.php

@@ -0,0 +1,58 @@
+<?php 
+
+namespace App\Services; 
+
+use App\OwnerBillReport;
+use App\Services\common\QueryService;
+use Illuminate\Database\Eloquent\Builder;
+
+Class OwnerBillReportService
+{
+
+    /**
+     * @param Builder $builder
+     * @param array $params
+     * @return Builder
+     */
+    private function query(Builder $builder, array $params)
+    {
+        $columnQueryRules = [
+            'counting_month_start' => ['alias' => 'counting_month', 'startDate' => '-01'],
+            'counting_month_end' => ['alias' => 'counting_month', 'endDate' => '-31'],
+            'owner_id' => ['multi' => ','],
+        ];
+        if (($params["customer_id"] ?? false) || ($params["owner_group_id"] ?? false)){
+            $builder->whereHas('owner',function ($query)use(&$params){
+                /** @var Builder $query*/
+                if ($params["customer_id"] ?? false){
+                    $query->where("customer_id",$params["customer_id"]);
+                    unset($params["customer_id"]);
+                }
+                if ($params["owner_group_id"] ?? false){
+                    $query->where("user_owner_group_id",$params["owner_group_id"]);
+                    unset($params["owner_group_id"]);
+                }
+            });
+        }
+        return app(QueryService::class)->query($params, $builder, $columnQueryRules);
+    }
+
+    public function paginate(array $params, array $withs = null)
+    {
+        $bills = OwnerBillReport::query()->orderByDesc('id');
+        if ($withs)$bills->with($withs);
+        return $this->query($bills,$params)->paginate($params["paginate"] ?? 50);
+    }
+
+    public function update(array $params, array $values)
+    {
+        return $this->query(OwnerBillReport::query(),$params)->update($values);
+    }
+
+    public function get(array $params, array $withs = null)
+    {
+        $bills = OwnerBillReport::query()->orderByDesc('id');
+        if ($withs)$bills->with($withs);
+        return $this->query($bills,$params)->get();
+    }
+}

+ 58 - 0
app/Services/OwnerFeeDetailService.php

@@ -0,0 +1,58 @@
+<?php 
+
+namespace App\Services; 
+
+use App\OwnerFeeDetail;
+use App\Services\common\QueryService;
+use Illuminate\Database\Eloquent\Builder;
+
+Class OwnerFeeDetailService
+{
+    /**
+     * @param Builder $builder
+     * @param array $params
+     * @return Builder
+     */
+    private function query(Builder $builder, array $params)
+    {
+        $columnQueryRules = [
+            'worked_at_start' => ['alias' => 'worked_at', 'startDate' => ''],
+            'worked_at_end' => ['alias' => 'worked_at', 'endDate' => ''],
+            'owner_id' => ['multi' => ','],
+            'id' => ['multi' => ','],
+            'operation_bill' => ['like' => ''],
+            'logistic_bill' => ['like' => ''],
+        ];
+        if ($params["customer_id"] ?? false){
+            $builder->whereHas('owner',function ($query)use(&$params){
+                /** @var Builder $query*/
+                $query->where("customer_id",$params["customer_id"]);
+                unset($params["customer_id"]);
+            });
+        }
+        return app(QueryService::class)->query($params, $builder, $columnQueryRules, 'owner_fee_details');
+    }
+
+    public function paginate(array $params, array $withs = null)
+    {
+        $areas = OwnerFeeDetail::query()->orderByDesc('id');
+        if ($withs)$areas->with($withs);
+        return $this->query($areas,$params)->paginate($params["paginate"] ?? 50);
+    }
+
+    public function getSql($params)
+    {
+        $query = $this->query(OwnerFeeDetail::query()->orderByDesc('id'),$params);
+        $query->selectRaw("owner_fee_details.*,(work_fee+logistic_fee) total");
+        $query->leftJoin("owners","owner_fee_details.owner_id","owners.id")
+            ->selectRaw("owners.name owner_name")
+        ->leftJoin("customers","owners.customer_id","customers.id")
+            ->selectRaw("customers.name customer_name")
+        ->leftJoin("shops","owner_fee_details.shop_id","shops.id")
+            ->selectRaw("shops.name shop_name")
+        ->leftJoin("logistics","owner_fee_details.logistic_id","logistics.id")
+            ->selectRaw("logistics.name logistic_name");
+        return $query->sql();
+    }
+
+}

+ 43 - 0
app/Services/OwnerPriceOperationService.php

@@ -0,0 +1,43 @@
+<?php 
+
+namespace App\Services; 
+
+use App\OwnerPriceOperation;
+use App\Services\common\QueryService;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Support\Facades\DB;
+
+Class OwnerPriceOperationService
+{
+    /**
+     * @param Builder $builder
+     * @param array $params
+     * @return Builder
+     */
+    private function query(Builder $builder, array $params)
+    {
+        if ($params["owner_id"] ?? false){
+            $ids = $this->ownerGetIds($params["owner_id"]);
+            if ($ids)$builder->whereIn("id",$ids);
+            unset($params["owner_id"]);
+        }
+        $columnQueryRules = [
+            "name" => ["like"=>""]
+        ];
+        return app(QueryService::class)->query($params, $builder, $columnQueryRules);
+    }
+
+    public function paginate(array $params, array $withs = [])
+    {
+        return $this->query(OwnerPriceOperation::query()->orderByDesc('id')->with($withs),$params)
+            ->paginate($params["paginate"] ?? 50);
+    }
+
+
+    private function ownerGetIds(string $owner_id)
+    {
+        if (!$owner_id)return [];
+        $arr = DB::select(DB::raw("SELECT owner_price_operation_id AS id FROM owner_price_operation_owner WHERE owner_id in (".$owner_id.")"));
+        return array_column($arr,"id");
+    }
+}

+ 0 - 5
app/Services/OwnerReportService.php

@@ -59,9 +59,4 @@ Class OwnerReportService
         return $this->query($query,$params)->paginate($params["paginate"] ?? 50);
     }
 
-    public function getSql(array $params)
-    {
-
-    }
-
 }

+ 27 - 0
app/Services/OwnerStoragePriceModelService.php

@@ -11,4 +11,31 @@ Class OwnerStoragePriceModelService
         return OwnerStoragePriceModel::query()->select($columns)->with($withs)->get();
     }
 
+    public function paginate(array $withs = [])
+    {
+        return OwnerStoragePriceModel::query()->orderByDesc('id')->with($withs)->paginate($params["paginate"] ?? 50);
+    }
+
+    public function create(array $params)
+    {
+        return OwnerStoragePriceModel::query()->create($params);
+    }
+
+    public function update(array $params, array $values)
+    {
+        $query = OwnerStoragePriceModel::query();
+        foreach ($params as $column => $value){
+            $query->where($column,$value);
+        }
+        return $query->update($values);
+    }
+
+    public function find($id)
+    {
+        return OwnerStoragePriceModel::query()->find($id);
+    }
+    public function destroy($id)
+    {
+        return OwnerStoragePriceModel::destroy($id);
+    }
 }

+ 30 - 0
app/Services/ProcessMethodService.php

@@ -11,4 +11,34 @@ Class ProcessMethodService
         return ProcessMethod::query()->select($column)->get();
     }
 
+    public function paginate()
+    {
+        return ProcessMethod::query()->orderByDesc('id')->paginate(50);
+    }
+
+    public function create(array $params)
+    {
+        return ProcessMethod::query()->create($params);
+    }
+
+
+    public function find($id)
+    {
+        return ProcessMethod::query()->find($id);
+    }
+
+    public function update(array $params, array $values)
+    {
+        $query = ProcessMethod::query();
+        foreach ($params as $column => $value){
+            $query->where($column,$value);
+        }
+        return $query->update($values);
+    }
+
+    public function destroy($id)
+    {
+        return ProcessMethod::destroy($id);
+    }
+
 }

+ 4 - 0
app/Services/ShopService.php

@@ -9,6 +9,10 @@ use Carbon\Carbon;
 
 class ShopService
 {
+    public function getSelection(array $column = ['id', 'name'])
+    {
+        return Shop::query()->select($column)->get();
+    }
 
     function firstOrCreate(array $param, array $values = null){
         $shop = Shop::query();

+ 29 - 0
app/Services/UserOwnerGroupService.php

@@ -12,4 +12,33 @@ Class UserOwnerGroupService
         return UserOwnerGroup::query()->select($column)->get();
     }
 
+    public function paginate()
+    {
+        return UserOwnerGroup::query()->orderByDesc('id')->paginate(50);
+    }
+
+    public function create(array $params)
+    {
+        return UserOwnerGroup::query()->create($params);
+    }
+
+
+    public function find($id)
+    {
+        return UserOwnerGroup::query()->find($id);
+    }
+
+    public function update(array $params, array $values)
+    {
+        $query = UserOwnerGroup::query();
+        foreach ($params as $column => $value){
+            $query->where($column,$value);
+        }
+        return $query->update($values);
+    }
+
+    public function destroy($id)
+    {
+        return UserOwnerGroup::destroy($id);
+    }
 }

+ 13 - 0
database/factories/LogisticFactory.php

@@ -0,0 +1,13 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\Logistic;
+use Faker\Generator as Faker;
+
+$factory->define(Logistic::class, function (Faker $faker) {
+    return [
+        'name' => $faker->name,
+        'code' => \Illuminate\Support\Str::random(8),
+    ];
+});

+ 39 - 0
database/factories/OwnerFeeDetailFactory.php

@@ -0,0 +1,39 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OwnerFeeDetail;
+use Faker\Generator as Faker;
+
+$owner = \App\Owner::query()->whereNotNull('customer_id')->first();
+if ($owner)$shop = \App\Shop::query()->where("owner_id",$owner->id)->first();
+else $shop = null;
+$logistic = \App\Logistic::query()->first();
+$method = \App\ProcessMethod::query()->first();
+$factory->define(OwnerFeeDetail::class, function (Faker $faker)use(&$owner,&$shop,&$logistic,&$method) {
+    if (!$owner)$owner = \App\Owner::query()->whereNotNull('customer_id')->first();
+    if (!$shop){
+        if ($owner)$shop = \App\Shop::query()->where("owner_id",$owner->id)->first();
+        else $shop = null;
+    }
+    if (!$logistic) $logistic = \App\Logistic::query()->first();
+    if (!$method)$method = \App\ProcessMethod::query()->first();
+    $type = ["发货","收货","增值服务"];
+    return [
+        "owner_id"          => $owner ? $owner->id : factory(\App\Owner::class),         //货主ID
+        "worked_at"         => $faker->date(),//作业时间
+        "type"              =>$type[array_rand($type)],//类型
+        "shop_id"           =>$shop ? $shop->id : factory(\App\Shop::class),//店铺ID
+        "operation_bill"    => \Illuminate\Support\Str::random(10),//发/收/退/提货单号
+        "consignee_name"    => $faker->name,   //收件人
+        "consignee_phone"   =>$faker->phoneNumber,  //收件人电话
+        "commodity_amount"  =>mt_rand(0,100), //商品数量
+        "logistic_bill"     =>\Illuminate\Support\Str::random(12),    //快递单号
+        "volume"            =>mt_rand(10,2600) / 88,//体积
+        "weight"            =>mt_rand(10,2600) / 88,           //重量
+        "logistic_id"       =>$logistic ? $logistic->id : factory(\App\Logistic::class),      //物流ID
+        "process_method_id" =>$method ? $method->id : factory(\App\ProcessMethod::class),//加工类型ID
+        "work_fee"          =>mt_rand(100,10000) / 10,         //作业费
+        "logistic_fee"      =>mt_rand(100,10000) / 10,     //物流费
+    ];
+});

+ 17 - 0
database/factories/OwnerInStorageRuleFactory.php

@@ -0,0 +1,17 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OwnerInStorageRule;
+use Faker\Generator as Faker;
+
+$unit = \App\Unit::query()->first();
+$factory->define(OwnerInStorageRule::class, function (Faker $faker)use(&$unit){
+    if (!$unit)$unit = \App\Unit::query()->first();
+    return [
+        "owner_price_operation_id"  => factory(\App\OwnerPriceOperation::class), //作业计费ID
+        "amount"                    => mt_rand(0,100),                   //计量
+        "unit_id"                   => $unit ? $unit->id : factory(\App\Unit::class),//单位ID
+        "unit_price"                =>mt_rand(10,100) / 16,               //单价
+    ];
+});

+ 20 - 0
database/factories/OwnerOutStorageRuleFactory.php

@@ -0,0 +1,20 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OwnerOutStorageRule;
+use Faker\Generator as Faker;
+
+$unit = \App\Unit::query()->first();
+$factory->define(OwnerOutStorageRule::class, function (Faker $faker)use(&$unit) {
+    if (!$unit)$unit = \App\Unit::query()->first();
+    $strategy = ['默认','特征'];
+    return [
+        "owner_price_operation_id"          => factory(\App\OwnerPriceOperation::class),         //作业计费ID
+        "strategy"                          =>$strategy[array_rand($strategy)],         //策略
+        "amount"                            =>mt_rand(0,100),                           //起步数
+        "unit_id"                           => $unit ? $unit->id : factory(\App\Unit::class),//单位ID
+        "unit_price"                        =>mt_rand(10,100) / 12,                       //单价
+        "feature"                           =>\Illuminate\Support\Str::random(6),                          //特征
+    ];
+});

+ 17 - 0
database/factories/OwnerPriceOperationFactory.php

@@ -0,0 +1,17 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OwnerPriceOperation;
+use Faker\Generator as Faker;
+$factory->define(OwnerPriceOperation::class, function (Faker $faker) {
+    $operation_type = ['入库','出库'];
+    $strategy = ['默认','特征'];
+    return [
+        "operation_type"=>$operation_type[array_rand($operation_type)],   //操作类型
+        "name"          =>$faker->name,             //名称
+        "strategy"      =>$strategy[array_rand($strategy)],         //策略
+        "feature"       =>\Illuminate\Support\Str::random(10),          //特征
+        "remark"        =>$faker->text,           //备注
+    ];
+});

+ 3 - 3
database/factories/OwnerStoragePriceModelFactory.php

@@ -11,11 +11,11 @@ $factory->define(OwnerStoragePriceModel::class, function (Faker $faker) use(&$un
     $using_type = ['常温','恒温'];
     $discount_type = ['无减免','按单减免','固定减免'];
     return [
-        "counting_type" => array_rand($counting_type),    //计费类型
-        "using_type" => array_rand($using_type),       //用仓类型
+        "counting_type" => $counting_type[array_rand($counting_type)],    //计费类型
+        "using_type" => $using_type[array_rand($using_type)],       //用仓类型
         "minimum_area" => mt_rand(100,1000) / 50,     //最低起租面积
         "price" => mt_rand(1,20) / 10,            //单价
-        "discount_type" => array_rand($discount_type),    //减免类型
+        "discount_type" => $discount_type[array_rand($discount_type)],    //减免类型
         "discount_value" => mt_rand(0,10) / 12,   //减免值
         "unit_id" => $unit ? $unit->id : factory(\App\Unit::class),          //单位ID
     ];

+ 16 - 0
database/factories/ProcessMethodFactory.php

@@ -0,0 +1,16 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\ProcessMethod;
+use Faker\Generator as Faker;
+
+$unit = \App\Unit::query()->first();
+$factory->define(ProcessMethod::class, function (Faker $faker)use(&$unit) {
+    if (!$unit)$unit = \App\Unit::query()->first();
+    return [
+        'name' => $faker->name,
+        "unit_id" => $unit ? $unit->id : factory(\App\Unit::class),
+        "unit_price" => mt_rand(10,50) / 9,
+    ];
+});

+ 15 - 0
database/factories/ShopFactory.php

@@ -0,0 +1,15 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\Shop;
+use Faker\Generator as Faker;
+
+$owner = \App\Owner::query()->whereNotNull('customer_id')->first();
+$factory->define(Shop::class, function (Faker $faker)use(&$owner) {
+    if (!$owner) $owner = \App\Owner::query()->whereNotNull('customer_id')->first();
+    return [
+        'name' => $faker->name,
+        'owner_id' => $owner ? $owner->id : factory(\App\Owner::class),
+    ];
+});

+ 0 - 31
database/migrations/2020_06_18_111452_create_job_types_table.php

@@ -1,31 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class CreateJobTypesTable extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        Schema::create('job_types', function (Blueprint $table) {
-            $table->id();
-            $table->timestamps();
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        Schema::dropIfExists('job_types');
-    }
-}

+ 1 - 0
database/migrations/2020_10_26_142753_create_owner_area_reports_table.php

@@ -17,6 +17,7 @@ class CreateOwnerAreaReportsTable extends Migration
             $table->id();
             $table->bigInteger('owner_id')->index()->comment('外键货主');
             $table->date('counting_month')->index()->comment('结算月');
+            $table->bigInteger('user_owner_group_id')->index()->nullable()->comment('项目组');
             $table->decimal('area_on_tray',8,2)->nullable()->comment('货物整托');
             $table->decimal('area_on_half_tray',8,2)->nullable()->comment('货物半托');
             $table->decimal('area_on_flat',8,2)->nullable()->comment('平面区面积');

+ 0 - 1
database/migrations/2020_10_26_165012_create_owner_fee_details_table.php

@@ -16,7 +16,6 @@ class CreateOwnerFeeDetailsTable extends Migration
         Schema::create('owner_fee_details', function (Blueprint $table) {
             $table->id();
             $table->bigInteger('owner_id')->index()->comment('外键货主');
-            $table->date('counting_month')->index()->comment('结算月');
             $table->date('worked_at')->index()->comment('作业时间');
             $table->enum('type',["发货","收货","增值服务"])->index()->comment('类型');
             $table->bigInteger('shop_id')->nullable()->index()->comment('外键店铺');

+ 0 - 1
database/migrations/2020_10_28_105613_create_owner_out_storage_rules_table.php

@@ -15,7 +15,6 @@ class CreateOwnerOutStorageRulesTable extends Migration
     {
         Schema::create('owner_out_storage_rules', function (Blueprint $table) {
             $table->bigInteger("owner_price_operation_id")->comment("外键作业计费模型");
-            $table->enum("owner_price_operation_strategy",["默认","特征"])->comment("作业计费模型策略");
             $table->enum("strategy",["起步","默认","特征"])->comment("出库策略");
             $table->integer("amount")->nullable()->comment("起步数");
             $table->bigInteger("unit_id")->index()->comment("外键单位");

+ 11 - 0
database/migrations/2020_10_28_170858_save_customer_authority_data.php

@@ -12,20 +12,31 @@ class SaveCustomerAuthorityData extends Migration
         '客户管理-项目-查询',
         '客户管理-项目-录入',
         '客户管理-项目-面积',
+        '客户管理-项目-面积-编辑',
         '客户管理-项目-编辑',
         '客户管理-财务-即时账单',
         '客户管理-财务-账单确认',
+        '客户管理-财务-账单确认-编辑',
+        '客户管理-财务-账单确认-完结',
         '计费模型-仓储',
         '计费模型-仓储-录入',
+        '计费模型-仓储-编辑',
+        '计费模型-仓储-删除',
         '客户',
         '客户-查询',
         '客户-录入',
+        '客户-编辑',
+        '客户-删除',
         '项目组',
         '项目组-查询',
         '项目组-录入',
+        '项目组-编辑',
+        '项目组-删除',
         '作业类型',
         '作业类型-查询',
         '作业类型-录入',
+        '作业类型-编辑',
+        '作业类型-删除',
         '特征',
         '特征-录入',
         '特征-查询',

+ 3 - 2
database/seeds/DatabaseSeeder.php

@@ -11,10 +11,11 @@ class DatabaseSeeder extends Seeder
      */
     public function run()
     {
-        // $this->call(UsersTableSeeder::class);
         $this->call([
             OwnerReportSeeder::class,
-            OwnerStoragePriceModelSeeder::class
+            OwnerStoragePriceModelSeeder::class,
+            OwnerFeeDetailSeeder::class,
+            OwnerPriceOperationSeeder::class
         ]);
     }
 }

+ 16 - 0
database/seeds/OwnerFeeDetailSeeder.php

@@ -0,0 +1,16 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class OwnerFeeDetailSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        factory(\App\OwnerFeeDetail::class,3)->create();
+    }
+}

+ 17 - 0
database/seeds/OwnerPriceOperationSeeder.php

@@ -0,0 +1,17 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class OwnerPriceOperationSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        factory(\App\OwnerInStorageRule::class,3)->create();
+        factory(\App\OwnerOutStorageRule::class,3)->create();
+    }
+}

+ 4 - 2
resources/js/queryForm/queryForm.js

@@ -625,8 +625,10 @@ const query = function getQueryForm(data) {
         });
         ul_div.mouseenter(function () {
             setTimeout(function () {
-                ul_div.attr("title","移出多选区域即可自动提交");
-                ul_div.tooltip('show');
+                if (!ul_div.is(":hidden")){
+                    ul_div.attr("title","移出多选区域即可自动提交");
+                    ul_div.tooltip('show');
+                }
             },1000);
         });
         return div;

+ 127 - 11
resources/views/customer/finance/billConfirmation.blade.php

@@ -11,8 +11,8 @@
                 导出Excel
             </button>
             <div class="dropdown-menu">
-                <a class="dropdown-item" @click="excelExport(false)" href="javascript:">导出勾选内容</a>
-                <a class="dropdown-item" @click="excelExport(true)" href="javascript:">导出所有页</a>
+                <a class="dropdown-item" @click="billExport(false)" href="javascript:">导出勾选内容</a>
+                <a class="dropdown-item" @click="billExport(true)" href="javascript:">导出所有页</a>
             </div>
         </div>
         <div>
@@ -22,6 +22,30 @@
             <table class="d-none" id="headerRoll"></table>
             <table class="table table-sm text-nowrap table-striped table-hover" id="headerParent">
                 <tr id="header"></tr>
+                <tr v-for="(bill,i) in bills">
+                    <td>
+                        <label><input type="checkbox" :value="bill.id" v-model="checkData"></label>
+                    </td>
+                    <td>@{{ i+1 }}</td>
+                    <td>@{{ bill.ownerGroupName }}</td>
+                    <td>@{{ bill.customerName }}</td>
+                    <td>@{{ bill.ownerName }}</td>
+                    <td>@{{ bill.countingMonth }}</td>
+                    <td>@{{ bill.updatedAt }}</td>
+                    <td class="font-weight-bold">@{{ bill.initialFee }}</td>
+                    <td>
+                        <label><input :id="'confirmFee-'+bill.id" @click="thisIndex=i" :readonly="thisIndex==i ? false : true" type="number" min="0" class="form-control form-control-sm" :value="bill.confirmFee"></label>
+                        <div v-if="thisIndex==i">
+                            <button class="btn btn-sm btn-success" @click="updateConfirmFee(bill)">确定</button>
+                            <button class="btn btn-sm btn-danger" @click="thisIndex='-1'">取消</button>
+                        </div>
+                    </td>
+                    <td>@{{ bill.difference }}</td>
+                    <td>
+                        <button class="btn btn-sm btn-outline-success" v-if="bill.confirmed == '否'" @click="billConfirm(bill)">确认</button>
+                        <label v-else class="text-success">已确认</label>
+                    </td>
+                </tr>
             </table>
         </div>
     </div>
@@ -30,22 +54,68 @@
 @section("lastScript")
     <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
     <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
     <script>
         let vue = new Vue({
             el:"#container",
             data:{
                 checkData:[],
-                bills : [],
+                bills : [
+                    @foreach($bills as $bill)
+                    {   id : "{{$bill->id}}",
+                        ownerGroupName : "{{$bill->owner ? ($bill->owner->userOwnerGroup ? $bill->owner->userOwnerGroup->name : '') : ''}}",
+                        customerName : "{{$bill->owner ? ($bill->owner->customer ? $bill->owner->customer->name : '') : ''}}",
+                        ownerName : "{{$bill->owner ? $bill->owner->name : ''}}",
+                        countingMonth : "{{$bill->counting_month}}",
+                        updatedAt : "{{$bill->updated_at}}",
+                        initialFee : "{{$bill->initial_fee}}",
+                        confirmFee : "{{$bill->confirm_fee}}",
+                        difference : "{{$bill->difference}}",
+                        confirmed : "{{$bill->confirmed}}",
+                    },
+                    @endforeach
+                ],
+                owners : [
+                    @foreach($owners as $owner)
+                    {name:"{{$owner->id}}",value:"{{$owner->name}}"},
+                    @endforeach
+                ],
+                ownerGroups : [
+                    @foreach($ownerGroups as $ownerGroup)
+                    {name:"{{$ownerGroup->id}}",value:"{{$ownerGroup->name}}"},
+                    @endforeach
+                ],
+                customers : [
+                    @foreach($customers as $customer)
+                    {name:"{{$customer->id}}",value:"{{$customer->name}}"},
+                    @endforeach
+                ],
+                thisIndex:"-1",
+                sum : Number("{{ $bills->total() }}"),
+            },
+            watch:{
+                checkData:{
+                    handler(){
+                        if (this.checkData.length === this.bills.length){
+                            document.querySelector('#all').checked = true;
+                            document.querySelector('#all_temp').checked = true;
+                        }else {
+                            document.querySelector('#all').checked = false;
+                            document.querySelector('#all_temp').checked = false;
+                        }
+                    },
+                    deep:true
+                }
             },
             mounted(){
                 let data=[
                     [
-                        {name:'workgroup',type:'select',tip:'项目小组',placeholder: '项目小组',data:[]},
+                        {name:'owner_group_id',type:'select',tip:'项目小组',placeholder: '项目小组',data:this.ownerGroups},
                         {name:'counting_month_start',type:'dateMonth',tip:'起始结算月'},
                         {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的项目'],
-                            placeholder:['项目','定位或多选项目'],data:[]},
+                            placeholder:['项目','定位或多选项目'],data:this.owners},
                     ],[
-                        {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:[]},
+                        {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:this.customers},
                         {name:'counting_month_end',type:'dateMonth',tip:'结束结算月'},
                     ],
                 ];
@@ -83,21 +153,67 @@
                 },0);
             },
             methods:{
-                excelExport(isAll){
-
+                billExport(isAll){
+                    let url = '{{url('customer/finance/billConfirmation/export')}}';
+                    let token='{{ csrf_token() }}';
+                    excelExport(isAll,this.checkData,url,this.sum,token);
                 },
                 //全选事件
                 checkAll(e){
                     if (e.target.checked){
+                        this.checkData = [];
                         this.bills.forEach((el)=>{
-                            if (this.checkData.indexOf(el.id) === '-1'){
-                                this.checkData.push(el.id);
-                            }
+                            this.checkData.push(el.id);
                         });
                     }else {
                         this.checkData = [];
                     }
                 },
+                updateConfirmFee(bill){
+                    let confirm_fee = $('#confirmFee-'+bill.id).val();
+                    if (confirm_fee === bill.fee){
+                        window.tempTip.setDuration(2000);
+                        window.tempTip.show("无更新");
+                        return;
+                    }
+                    window.tempTip.confirm("确定要更新账单确认金额为“"+confirm_fee+"”吗?",()=>{
+                        window.axios.post("{{url('customer/finance/updateBillReport')}}",{id:bill.id,confirm_fee:confirm_fee})
+                            .then(res=>{
+                                if (res.data.success){
+                                    bill.confirmFee = confirm_fee;
+                                    bill.difference = Number(confirm_fee) - Number(bill.initialFee);
+                                    bill.updatedAt = res.data.data;
+                                    this.thisIndex = '-1';
+                                    window.tempTip.setDuration(2000);
+                                    window.tempTip.showSuccess("修改成功");
+                                    return;
+                                }
+                                window.tempTip.setDuration(3000);
+                                window.tempTip.show(res.data.data);
+                            }).catch(err=>{
+                                window.tempTip.setDuration(3000);
+                                window.tempTip.show("网络错误:"+err);
+                            })
+                    });
+                },
+                billConfirm(bill){
+                    window.tempTip.confirm("确定要完结该账单吗?",()=>{
+                        window.axios.post("{{url('customer/finance/billConfirm')}}",{id:bill.id})
+                            .then(res=>{
+                                if (res.data.success){
+                                    bill.confirmed = "是";
+                                    window.tempTip.setDuration(2000);
+                                    window.tempTip.showSuccess("完结成功!");
+                                    return;
+                                }
+                                window.tempTip.setDuration(3000);
+                                window.tempTip.show(res.data.data);
+                            }).catch(err=>{
+                            window.tempTip.setDuration(3000);
+                            window.tempTip.show("网络错误:"+err);
+                        })
+                    });
+                }
             },
         });
     </script>

+ 114 - 29
resources/views/customer/finance/instantBill.blade.php

@@ -11,8 +11,8 @@
                 导出Excel
             </button>
             <div class="dropdown-menu">
-                <a class="dropdown-item" @click="excelExport(false)" href="javascript:">导出勾选内容</a>
-                <a class="dropdown-item" @click="excelExport(true)" href="javascript:">导出所有页</a>
+                <a class="dropdown-item" @click="billExport(false)" href="javascript:">导出勾选内容</a>
+                <a class="dropdown-item" @click="billExport(true)" href="javascript:">导出所有页</a>
             </div>
         </div>
         <div>
@@ -23,12 +23,38 @@
             <table class="table table-sm text-nowrap table-striped table-hover" id="headerParent">
                 <tr class="text-center">
                     <td colspan="2"></td>
-                    <td colspan="8" class="bg-light-info">单据信息</td>
+                    <td colspan="9" class="bg-light-info">单据信息</td>
                     <td colspan="4" class="bg-light-khaki">物流作业信息</td>
                     <td colspan="4" class="bg-light-cyanogen">费用信息</td>
                 </tr>
                 <tr id="header"></tr>
+                <tr v-for="(bill,i) in bills">
+                    <td>
+                        <label><input type="checkbox" :value="bill.id" v-model="checkData"></label>
+                    </td>
+                    <td>@{{ i+1 }}</td>
+                    <td>@{{ bill.customerName }}</td>
+                    <td>@{{ bill.ownerName }}</td>
+                    <td>@{{ bill.workedAt }}</td>
+                    <td>
+                        <label v-if="bill.type == '增值服务'">服务<span class="badge badge-primary">@{{ bill.methodName }}</span></label>
+                        <label v-else>@{{ bill.type }}</label>
+                    </td>
+                    <td>@{{ bill.shopName }}</td>
+                    <td>@{{ bill.operationBill }}</td>
+                    <td>@{{ bill.consigneeName }}</td>
+                    <td>@{{ bill.consigneePhone }}</td>
+                    <td>@{{ bill.commodityAmount }}</td>
+                    <td>@{{ bill.logisticBill }}</td>
+                    <td>@{{ bill.volume }}</td>
+                    <td>@{{ bill.weight }}</td>
+                    <td>@{{ bill.logisticName }}</td>
+                    <td>@{{ bill.workFee }}</td>
+                    <td>@{{ bill.logisticFee }}</td>
+                    <td>@{{ bill.total }}</td>
+                </tr>
             </table>
+            {{$details->appends($params)->links()}}
         </div>
     </div>
 @stop
@@ -36,27 +62,69 @@
 @section("lastScript")
     <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
     <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
     <script>
         let vue = new Vue({
             el:"#container",
             data:{
                 checkData:[],
-                bills : [],
+                bills : [
+                    @foreach($details as $detail)
+                    {   id : "{{$detail->id}}",
+                        ownerName : "{{$detail->owner ? $detail->owner->name : ''}}",
+                        customerName : "{{$detail->owner ? ($detail->owner->customer ? $detail->owner->customer->name : '') : ''}}",
+                        workedAt : "{{$detail->worked_at}}",
+                        type : "{{$detail->type}}",
+                        shopName : "{{$detail->shop ? $detail->shop->name : ''}}",
+                        operationBill : "{{$detail->operation_bill}}",
+                        consigneeName : "{{$detail->consignee_name}}",
+                        consigneePhone : "{{$detail->consignee_phone}}",
+                        commodityAmount : "{{$detail->commodity_amount}}",
+                        logisticBill : "{{$detail->logistic_bill}}",
+                        volume : "{{$detail->volume}}",
+                        weight : "{{$detail->weight}}",
+                        logisticName : "{{$detail->logistic ? $detail->logistic->name : ''}}",
+                        methodName : "{{$detail->processMethod ? $detail->processMethod->name : ''}}",
+                        workFee : "{{$detail->work_fee}}",
+                        logisticFee : "{{$detail->logistic_fee}}",
+                        createdAt : "{{$detail->created_at}}",
+                        total : "{{$detail->work_fee + $detail->logistic_fee}}",
+                    },
+                    @endforeach
+                ],
+                owners : [
+                    @foreach($owners as $owner)
+                    {name:"{{$owner->id}}",value:"{{$owner->name}}"},
+                    @endforeach
+                ],
+                customers : [
+                    @foreach($customers as $customer)
+                    {name:"{{$customer->id}}",value:"{{$customer->name}}"},
+                    @endforeach
+                ],
+                shops : [
+                    @foreach($shops as $shop)
+                    {name:"{{$shop->id}}",value:"{{$shop->name}}"},
+                    @endforeach
+                ],
+                types : [
+                    {name:"发货",value:"发货"},{name:"收货",value:"收货"},{name:"增值服务",value:"增值服务"},
+                ],
+                sum : Number("{{ $details->total() }}"),
             },
             mounted(){
                 let data=[
                     [
-                        {name:'shop_name',type:'select',tip:'店铺',placeholder: '店铺',data:[]},
-                        {name:'counting_month_start',type:'dateMonth',tip:'起始结算月'},
+                        {name:'shop_id',type:'select',tip:'店铺',placeholder: '店铺',data:this.shops},
+                        {name:'worked_at_start',type:'dateTime',tip:'起始作业日期'},
                         {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的项目'],
-                            placeholder:['项目','定位或多选项目'],data:[]},
+                            placeholder:['项目','定位或多选项目'],data:this.owners},
                         {name: 'operation_bill', type: 'input', tip: '发/收/退/提货单号:可在两侧增加百分号(%)进行模糊搜索', placeholder: '单据号'},
-                        {name:'type',type:'select',tip:'类型',placeholder: '类型',data:[]},
                     ],[
-                        {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:[]},
-                        {name:'counting_month_end',type:'dateMonth',tip:'结束结算月'},
-                        {name:'status',type:'select',placeholder:'状态',data:[]},
+                        {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:this.customers},
+                        {name:'worked_at_end',type:'dateTime',tip:'结束作业日期'},
                         {name:'logistic_bill', type: 'input', tip: '物流/快递单号:可在两侧增加百分号(%)进行模糊搜索', placeholder: '快递单号'},
+                        {name:'type',type:'select',tip:'类型',placeholder: '类型',data:this.types},
                     ],
                 ];
                 this.form = new query({
@@ -68,21 +136,22 @@
                     {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
                         dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
                     {name:'index',value: '序号', neglect: true},
-                    {name:'owner_name',value: '项目', class: "bg-info"},
-                    {name:'worked_at',value: '作业时间', class: "bg-info"},
+                    {name:'customerName',value: '客户', class: "bg-info"},
+                    {name:'ownerName',value: '项目', class: "bg-info"},
+                    {name:'workedAt',value: '作业时间', class: "bg-info"},
                     {name:'type',value: '类型', class: "bg-info"},
-                    {name:'shop_name',value: '店铺', class: "bg-info"},
-                    {name:'operation_bill',value: '单号(发/收/退/提)', class: "bg-info"},
-                    {name:'consignee_name',value: '收件人', class: "bg-info"},
-                    {name:'consignee_phone',value: '收件人电话', class: "bg-info"},
-                    {name:'commodity_amount',value: '商品数量', class: "bg-info", neglect: true},
-                    {name:'logistic_bill',value: '物流/快递单号', class: "bg-khaki"},
+                    {name:'shopName',value: '店铺', class: "bg-info"},
+                    {name:'operationBill',value: '单号(发/收/退/提)', class: "bg-info"},
+                    {name:'consigneeName',value: '收件人', class: "bg-info"},
+                    {name:'consigneePhone',value: '收件人电话', class: "bg-info"},
+                    {name:'commodityAmount',value: '商品数量', class: "bg-info", neglect: true},
+                    {name:'logisticBill',value: '物流/快递单号', class: "bg-khaki"},
                     {name:'volume',value: '体积', class: "bg-khaki", neglect: true},
                     {name:'weight',value: '重量', class: "bg-khaki", neglect: true},
-                    {name:'logistic_name',value: '承运商', class: "bg-khaki"},
-                    {name:'work_fee',value: '操作费', class: "bg-cyanogen"},
-                    {name:'logistic_fee',value: '物流费', class: "bg-cyanogen"},
-                    {name:'total_fee',value: '合计', class: "bg-cyanogen"},
+                    {name:'logisticName',value: '承运商', class: "bg-khaki"},
+                    {name:'workFee',value: '操作费', class: "bg-cyanogen", neglect: true},
+                    {name:'logisticFee',value: '物流费', class: "bg-cyanogen", neglect: true},
+                    {name:'total',value: '合计', class: "bg-cyanogen", neglect: true},
                 ];
                 let _this=this;
                 setTimeout(function () {
@@ -98,17 +167,33 @@
                     header.init();
                 },0);
             },
+            watch:{
+                checkData:{
+                    handler(){
+                        if (this.checkData.length === this.bills.length){
+                            document.querySelector('#all').checked = true;
+                            document.querySelector('#all_temp').checked = true;
+                        }else {
+                            document.querySelector('#all').checked = false;
+                            document.querySelector('#all_temp').checked = false;
+                        }
+                    },
+                    deep:true
+                }
+            },
             methods:{
-                excelExport(isAll){
-
+                billExport(isAll){
+                    let url = '{{url('customer/finance/instantBill/export')}}';
+                    let token='{{ csrf_token() }}';
+                    //excelExport 定义在 js/queryForm/export.js
+                    excelExport(isAll,this.checkData,url,this.sum,token);
                 },
                 //全选事件
                 checkAll(e){
                     if (e.target.checked){
-                        this.owners.forEach((el)=>{
-                            if (this.checkData.indexOf(el.id) === '-1'){
-                                this.checkData.push(el.id);
-                            }
+                        this.checkData = [];
+                        this.bills.forEach((el)=>{
+                            this.checkData.push(el.id);
                         });
                     }else {
                         this.checkData = [];

+ 1 - 1
resources/views/customer/menu.blade.php

@@ -10,7 +10,7 @@
                 <a class="nav-link" href="{{url('customer/finance/instantBill')}}" :class="{active:isActive('finance',2)}">财务</a>
             </li>
             <li class="nav-item">
-                <a class="nav-link" href="{{url('customer/relating')}}" :class="{active:isActive('delivering',3)}">相关设置</a>
+                <a class="nav-link" href="{{url('customer/relating')}}" :class="{active:isActive('relating',2)}">相关设置</a>
             </li>
         </ul>
     </div>

+ 152 - 19
resources/views/customer/project/area.blade.php

@@ -12,8 +12,8 @@
                 导出Excel
             </button>
             <div class="dropdown-menu">
-                <a class="dropdown-item" @click="excelExport(false)" href="javascript:">导出勾选内容</a>
-                <a class="dropdown-item" @click="excelExport(true)" href="javascript:">导出所有页</a>
+                <a class="dropdown-item" @click="areaExport(false)" href="javascript:">导出勾选内容</a>
+                <a class="dropdown-item" @click="areaExport(true)" href="javascript:">导出所有页</a>
             </div>
         </div>
         <div>
@@ -23,7 +23,46 @@
             <table class="d-none" id="headerRoll"></table>
             <table class="table table-sm table-striped table-hover" id="headerParent">
                 <tr class="text-nowrap" id="header"></tr>
+                <tr v-for="(area,i) in areas">
+                    <td>
+                        <label><input type="checkbox" :value="area.id" v-model="checkData"></label>
+                    </td>
+                    <td>@{{ i+1 }}</td>
+                    <td>
+                        <span v-if="area.status=='已完成'" class="text-success">@{{ area.status }}</span>
+                        <span v-else><button class="btn btn-sm btn-outline-info" @click="edit(area,i)">编辑</button></span>
+                        <span v-if="editIndex==i">
+                            <button class="btn btn-sm btn-success" @click="submitArea()">确定</button>
+                            <button class="btn btn-sm btn-danger" @click="editIndex='-1'">取消</button>
+                        </span>
+                    </td>
+                    <td>
+                        <label><select @change="thisArea.user_owner_group_id = $event.target.value" :disabled="editIndex==i ? false : true"
+                                       :value="area.ownerGroupId" class="form-control form-control-sm">
+                            <option v-for="ownerGroup in ownerGroups" :value="ownerGroup.name">@{{ ownerGroup.value }}</option>
+                        </select></label>
+                    </td>
+                    <td>@{{ area.customerName }}</td>
+                    <td>@{{ area.ownerName }}</td>
+                    <td>@{{ area.countingMonth }}</td>
+                    <td>@{{ area.updatedAt }}</td>
+                    <td>@{{ area.ownerStoragePriceModelUsingType }}</td>
+                    <td>
+                        <label><input :readonly="editIndex==i ? false : true" @change="thisArea.area_on_tray = $event.target.value"
+                                      type="number" min="0" class="form-control form-control-sm" :value="area.areaOnTray"></label>
+                    </td>
+                    <td>
+                        <label><input :readonly="editIndex==i ? false : true" @change="thisArea.area_on_half_tray = $event.target.value"
+                                      type="number" min="0" class="form-control form-control-sm" :value=area.areaOnHalfTray></label>
+                    </td>
+                    <td>
+                        <label><input :readonly="editIndex==i ? false : true" @change="thisArea.area_on_flat = $event.target.value"
+                                      type="number" min="0" class="form-control form-control-sm" :value="area.areaOnFlat"></label>
+                    </td>
+                    <td>@{{ area.accountingArea }}</td>
+                </tr>
             </table>
+            {{$areas->appends($params)->links()}}
         </div>
     </div>
 @stop
@@ -31,26 +70,80 @@
 @section('lastScript')
     <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
     <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
     <script>
         let vue = new Vue({
             el:"#container",
             data:{
-                areas : [],
-                workgroup : [],
-                customers : [],
-                owners : [],
+                areas : [
+                    @foreach($areas as $area)
+                    {
+                        id : "{{$area->id}}",
+                        ownerGroupId : "{{$area->user_owner_group_id}}",
+                        ownerName : "{{$area->owner ? $area->owner->name : ''}}",
+                        customerName : "{{$area->owner ? ($area->owner->customer ? $area->owner->customer->name : '') : ''}}",
+                        countingMonth : "{{$area->counting_month}}",
+                        areaOnTray : "{{$area->area_on_tray}}",
+                        areaOnHalfTray : "{{$area->area_on_half_tray}}",
+                        areaOnFlat : "{{$area->area_on_flat}}",
+                        accountingArea : "{{$area->accounting_area}}",
+                        status : "{{$area->status}}",
+                        updatedAt : "{{$area->updated_at}}",
+                        ownerStoragePriceModelUsingType:"{{ $area->owner ? implode(",",array_unique(array_column(($area->owner->ownerStoragePriceModels)->toArray(),"using_type"))) : '' }}",
+                    },
+                    @endforeach
+                ],
+                thisArea : {
+                    user_owner_group_id : "",
+                    area_on_tray : "",
+                    area_on_half_tray : "",
+                    area_on_flat : "",
+                },
+                ownerGroups : [
+                    @foreach($ownerGroups as $ownerGroup)
+                    {name:"{{$ownerGroup->id}}",value:"{{$ownerGroup->name}}"},
+                    @endforeach
+                ],
+                customers : [
+                    @foreach($customers as $customer)
+                    {name:"{{$customer->id}}",value:"{{$customer->name}}"},
+                    @endforeach
+                ],
+                owners : [
+                    @foreach($owners as $owner)
+                    {name:"{{$owner->id}}",value:"{{$owner->name}}"},
+                    @endforeach
+                ],
+                status : [{name:"编辑中",value:"编辑中"},{name:"已完成",value:"已完成"}],
                 checkData : [],
+                editIndex : "-1",
+                sum : Number("{{ $areas->total() }}"),
+            },
+            watch:{
+                checkData:{
+                    handler(){
+                        if (this.checkData.length === this.areas.length){
+                            document.querySelector('#all').checked = true;
+                            document.querySelector('#all_temp').checked = true;
+                        }else {
+                            document.querySelector('#all').checked = false;
+                            document.querySelector('#all_temp').checked = false;
+                        }
+                    },
+                    deep:true
+                }
             },
             mounted(){
                 let data=[
                     [
-                        {name:'workgroup',type:'select',tip:'项目小组',placeholder: '项目小组',data:this.workgroup},
+                        {name:'owner_group_id',type:'select',tip:'项目小组',placeholder: '项目小组',data:this.ownerGroups},
                         {name:'counting_month_start',type:'dateMonth',tip:'起始结算月'},
                         {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的项目'],
                             placeholder:['项目','定位或多选项目'],data:this.owners},
                     ],[
                         {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:this.customers},
                         {name:'counting_month_end',type:'dateMonth',tip:'结束结算月'},
+                        {name:'status',type:'select',tip:'状态',placeholder: '状态',data:this.status},
                     ],
                 ];
                 this.form = new query({
@@ -63,16 +156,16 @@
                         dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
                     {name:'index',value: '序号', neglect: true},
                     {name:'status',value: '状态'},
-                    {name:'workgroup',value: '项目组'},
-                    {name:'customer_name',value: '客户'},
-                    {name:'owner_name',value: '子项目'},
-                    {name:'counting_month',value: '结算月'},
-                    {name:'created_at',value: '录入时间'},
-                    {name:'storage_type',value: '用仓类型'},
-                    {name:'area_on_tray',value: '货物整托', neglect: true},
-                    {name:'area_on_half_tray',value: '货物半托', neglect: true},
-                    {name:'area_on_flat',value: '平面区面积', neglect: true},
-                    {name:'accounting_area',value: '结算面积', neglect: true},
+                    {name:'ownerGroupId',value: '项目组', neglect : true},
+                    {name:'customerName',value: '客户'},
+                    {name:'ownerName',value: '子项目'},
+                    {name:'countingMonth',value: '结算月'},
+                    {name:'createdAt',value: '录入时间'},
+                    {name:'ownerStoragePriceModelUsingType',value: '用仓类型'},
+                    {name:'areaOnTray',value: '货物整托', neglect: true},
+                    {name:'areaOnHalfTray',value: '货物半托', neglect: true},
+                    {name:'areaOnFlat',value: '平面区面积', neglect: true},
+                    {name:'accountingArea',value: '结算面积', neglect: true},
                 ];
                 let _this=this;
                 setTimeout(function () {
@@ -89,8 +182,11 @@
                 },0);
             },
             methods:{
-                excelExport(isAll){
-
+                areaExport(isAll){
+                    let url = '{{url('customer/project/area/export')}}';
+                    let token='{{ csrf_token() }}';
+                    //excelExport 定义在 js/queryForm/export.js
+                    excelExport(isAll,this.checkData,url,this.sum,token);
                 },
                 //全选事件
                 checkAll(e){
@@ -104,6 +200,43 @@
                         this.checkData = [];
                     }
                 },
+                edit(area,index){
+                    this.editIndex = index;
+                    this.thisArea.user_owner_group_id = area.ownerGroupId;
+                    this.thisArea.area_on_tray = area.areaOnTray;
+                    this.thisArea.area_on_half_tray = area.areaOnHalfTray;
+                    this.thisArea.area_on_flat = area.areaOnFlat;
+                },
+                submitArea(){
+                    window.tempTip.confirm("确认要提交该面积的更新吗?",()=>{
+                        axios.post("{{url('customer/project/updateArea')}}",{
+                            id:this.areas[this.editIndex].id,area:this.thisArea
+                        }).then(res=>{
+                            if (res.data.success){
+                                this.areas[this.editIndex].ownerGroupId = res.data.data["user_owner_group_id"];
+                                this.areas[this.editIndex].areaOnTray = res.data.data["area_on_tray"];
+                                this.areas[this.editIndex].areaOnHalfTray = res.data.data["area_on_half_tray"];
+                                this.areas[this.editIndex].areaOnFlat = res.data.data["area_on_flat"];
+                                this.areas[this.editIndex].accountingArea = res.data.data["accounting_area"];
+                                this.editIndex = '-1';
+                                this.thisArea = {
+                                    user_owner_group_id : "",
+                                    area_on_tray : "",
+                                    area_on_half_tray : "",
+                                    area_on_flat : "",
+                                };
+                                window.tempTip.setDuration(2000);
+                                window.tempTip.showSuccess("修改成功");
+                                return;
+                            }
+                            window.tempTip.setDuration(3000);
+                            window.tempTip.show(res.data.data);
+                        }).catch(err=>{
+                            window.tempTip.setDuration(3000);
+                            window.tempTip.show("网络错误:"+err);
+                        })
+                    });
+                }
             },
         });
     </script>

+ 2 - 7
resources/views/customer/project/report.blade.php

@@ -23,7 +23,7 @@
             <table class="d-none" id="headerRoll"></table>
             <table class="table table-sm table-striped table-hover" id="headerParent">
                 <tr class="text-center">
-                    <td colspan="2"></td>
+                    <td></td>
                     <td colspan="7" class="bg-light-khaki">客户信息</td>
                     <td colspan="4" class="bg-light-info">盘点信息</td>
                     <td colspan="3" class="bg-light-cyanogen">账单信息</td>
@@ -49,6 +49,7 @@
                     <td>@{{ report.ownerBillReportConfirmUpdatedAt }}</td>
                 </tr>
             </table>
+            {{$reports->appends($params)->links()}}
         </div>
     </div>
 @stop
@@ -186,12 +187,6 @@
                         this.checkData = [];
                     }
                 },
-                _formatDate(str){
-                    return new Date(Date.parse(str.replace(/-/g,"/")));
-                },
-                _diffDate(startDate, endDate){
-
-                }
             }
         });
     </script>

+ 2 - 19
resources/views/customer/relating.blade.php

@@ -3,24 +3,7 @@
 
 @section('content')
     <div id="nav2">
-        @component('rejected.menu')@endcomponent
-        <div class="container-fluid nav3">
-            <div class="card" >
-                <ul class="nav">
-                    @can('货主')
-                        <li class="nav-item">
-                            <a class="nav-link text-dark" href="{{url('maintenance/owner')}}" :class="{active:isActive('',2)}">货主</a>
-                        </li> @endcan
-                    @can('物流公司')
-                        <li class="nav-item">
-                            <a class="nav-link text-dark" href="{{url('maintenance/logistic')}}" :class="{active:isActive('logistic',2)}">物流公司</a>
-                        </li> @endcan
-                    @can('品质标签')
-                        <li class="nav-item">
-                            <a class="nav-link text-dark" href="{{url('maintenance/qualityLabel')}}" :class="{active:isActive('qualityLabel',2)}">品质标签</a>
-                        </li> @endcan
-                </ul>
-            </div>
-        </div>
+        @component('customer.menu')@endcomponent
+        @component('maintenance.priceModel.menu')@endcomponent
     </div>
 @endsection

+ 25 - 5
resources/views/maintenance/customer/create.blade.php

@@ -1,21 +1,41 @@
 @extends('layouts.app')
-@section('title')客户-录入@endsection
+@section('title')客户-录入更新@endsection
 
 @section('content')
     <div id="nav2">
         @component('maintenance.menu')@endcomponent
-        @component('maintenance.customer.menu')@endcomponent
+        @component('maintenance.customer.menu')
+                @if(isset($customer))@can('客户-编辑')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',4)}">编辑</a>
+                </li> @endcan @endif
+        @endcomponent
     </div>
     <div class="container-fluid card">
         <div class="card-body offset-3 mt-2">
-            <form method="post" action="{{url('')}}">
+            <form method="post" action="{{isset($customer) ? url('maintenance/customer').'/'.$customer->id : url('maintenance/customer')}}">
+                @csrf
+                @if(isset($customer)) @method('PUT') @endif
                 <div class="row">
+                    <label class="col-2 text-info" for="code">客户代码</label>
+                    <input class="form-control col-6 @error("code") is-invalid @enderror" id="code" name="code"
+                    value="{{old("code") ?? (isset($customer) ? $customer->code : '')}}">
+                    @error("code")<span class="offset-2 mt-0 invalid-feedback">
+                        <strong>{{$message}}</strong>
+                    </span>@enderror
+                </div>
+                <div class="row mt-3">
                     <label class="col-2" for="name">客户名称</label>
-                    <input class="form-control col-6" id="name" name="name">
+                    <input class="form-control col-6 @error("name") is-invalid @enderror" id="name" name="name"
+                    value="{{old("name") ?? (isset($customer) ? $customer->name : '')}}">
+                    @error("name")<span class="offset-2 mt-0 invalid-feedback">
+                        <strong>{{$message}}</strong>
+                    </span>@enderror
                 </div>
                 <div class="row mt-3">
                     <label class="col-2" for="company_name">公司名称</label>
-                    <input class="form-control col-6" id="company_name" name="company_name">
+                    <input class="form-control col-6" id="company_name" name="company_name"
+                    value="{{old("company_name") ?? (isset($customer) ? $customer->company_name : '')}}">
                 </div>
                 <div class="row mt-3 offset-1">
                     <button class="btn btn-success col-7">提交</button>

+ 57 - 2
resources/views/maintenance/customer/index.blade.php

@@ -6,18 +6,73 @@
         @component('maintenance.menu')@endcomponent
         @component('maintenance.customer.menu')@endcomponent
     </div>
-    <div class="container-fluid card">
+    <div class="container-fluid card" id="container">
         <div class="card-body mt-2">
+            @if(Session::has('successTip'))
+                <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+            @endif
             <table class="table table-striped table-hover text-nowrap">
                 <tr>
-                    <th>ID</th>
+                    <th>序号</th>
+                    <th>代码</th>
                     <th>名称</th>
                     <th>客户全称</th>
                     <th>创建时间</th>
                     <th>操作</th>
                 </tr>
+                <tr v-for="(customer,i) in customers">
+                    <td>@{{ i+1 }}</td>
+                    <td>@{{ customer.code }}</td>
+                    <td>@{{ customer.name }}</td>
+                    <td>@{{ customer.company_name }}</td>
+                    <td>@{{ customer.created_at }}</td>
+                    <td>
+                        @can("客户-编辑")<a :href="'{{url('maintenance/customer')}}/'+customer.id+'/edit'"><button class="btn btn-sm btn-outline-info">改</button></a>@endcan
+                        @can("客户-删除")<button class="btn btn-sm btn-outline-danger" @click="destroy(customer.id,i,customer.name)">删</button>@endcan
+                    </td>
+                </tr>
             </table>
         </div>
     </div>
 @stop
 
+@section('lastScript')
+    <script>
+        new Vue({
+            el:"#container",
+            data:{
+                customers : [
+                    @foreach($customers as $customer)
+                    {
+                        id:"{{$customer->id}}",
+                        code:"{{$customer->code}}",
+                        name:"{{$customer->name}}",
+                        company_name:"{{$customer->company_name}}",
+                        created_at:"{{$customer->created_at}}",
+                    },
+                    @endforeach
+                ],
+            },
+            methods:{
+                destroy(id,index,name){
+                    window.tempTip.confirm("确定要删除"+name+"吗?",()=>{
+                        window.axios.delete("{{url('maintenance/customer')}}/"+id)
+                            .then(res=>{
+                                if (res.data.success){
+                                    this.$delete(this.customers,index);
+                                    window.tempTip.setDuration(2000);
+                                    window.tempTip.showSuccess("删除"+name+"成功");
+                                    return;
+                                }
+                                window.tempTip.setDuration(3000);
+                                window.tempTip.show(res.data.data);
+                            }).catch(err=>{
+                            window.tempTip.setDuration(3000);
+                            window.tempTip.show("网络错误:"+err);
+                        })
+                    })
+                }
+            },
+        });
+    </script>
+@stop

+ 1 - 0
resources/views/maintenance/customer/menu.blade.php

@@ -9,6 +9,7 @@
             <li class="nav-item">
                 <a class="nav-link" href="{{url('maintenance/customer/create')}}" :class="{active:isActive('create',3)}">录入</a>
             </li> @endcan
+            {{$slot}}
         </ul>
     </div>
 </div>

+ 0 - 31
resources/views/maintenance/jobType/create.blade.php

@@ -1,31 +0,0 @@
-@extends('layouts.app')
-@section('title')新建作业类型@endsection
-
-@section('content')
-    <div id="nav2">
-        @component('maintenance.menu')@endcomponent
-        @component('maintenance.jobType.menu')@endcomponent
-    </div>
-    <div class="container-fluid">
-        <div class="card col-md-8 offset-md-2">
-            <div class="card-body">
-                <form method="POST" action="{{ url('maintenance/unit') }}">
-                    @csrf
-                    <div class="form-group row">
-                        <label class="col-2" >类型代码</label>
-                        <input class="form-control col-8">
-                    </div>
-                    <div class="form-group row">
-                        <label class="col-2" >类型名称</label>
-                        <input class="form-control col-8">
-                    </div>
-                    <div class="form-group row">
-                        <div class="col-8 offset-2">
-                            <input type="submit" class="btn btn-success form-control">
-                        </div>
-                    </div>
-                </form>
-            </div>
-        </div>
-    </div>
-@endsection

+ 0 - 29
resources/views/maintenance/jobType/index.blade.php

@@ -1,29 +0,0 @@
-
-@extends('layouts.app')
-@section('title')运输价格模型@endsection
-
-@section('content')
-    <span id="nav2">
-        @component('maintenance.menu')@endcomponent
-        @component('maintenance.jobType.menu')@endcomponent
-    </span>
-    <div class="container-fluid card">
-        <table class="m-2 table table-sm table-hover table-striped table-bordered text-nowrap">
-            <tr>
-                <th>ID</th>
-                <th>代码</th>
-                <th>名称</th>
-                <th>操作</th>
-            </tr>
-            <tr>
-                <td>1</td>
-                <td>TB</td>
-                <td>贴标</td>
-                <td>
-                    <button class="btn btn-sm btn-outline-info">改</button>
-                    <button class="btn btn-sm btn-outline-danger">删</button>
-                </td>
-            </tr>
-        </table>
-    </div>
-@endsection

+ 0 - 13
resources/views/maintenance/jobType/menu.blade.php

@@ -1,13 +0,0 @@
-
-<div class="container-fluid nav3">
-    <div class="card" >
-        <ul class="nav nav-pills">
-            <li class="nav-item">
-                <a class="nav-link" href="{{url('maintenance/jobType')}}" :class="{active:isActive('',3)}">查询</a>
-            </li>
-            <li class="nav-item">
-                <a class="nav-link" href="{{url('maintenance/jobType/create')}}"  :class="{active:isActive('create',3)}">录入</a>
-            </li>
-        </ul>
-    </div>
-</div>

+ 0 - 4
resources/views/maintenance/menu.blade.php

@@ -70,10 +70,6 @@
                 <li class="nav-item">
                     <a class="nav-link text-dark" href="{{url('maintenance/carType')}}" :class="{active:isActive('carType',2)}">车型</a>
                 </li> @endcan
-            @can('作业类型')
-                <li class="nav-item">
-                    <a class="nav-link text-dark" href="{{url('maintenance/jobType')}}" :class="{active:isActive('jobType',2)}">作业类型</a>
-                </li>@endcan
             @can('特征')
                 <li class="nav-item">
                     <a class="nav-link text-dark" href="{{url('maintenance/feature')}}" :class="{active:isActive('feature',2)}">特征</a>

+ 37 - 7
resources/views/maintenance/priceModel/operation/index.blade.php

@@ -1,5 +1,5 @@
 @extends('layouts.app')
-@section('title')计费模型-仓储计费@endsection
+@section('title')计费模型-作业计费@endsection
 
 @section('content')
     <div id="nav2">
@@ -14,16 +14,30 @@
                 <th>操作</th>
                 <th>名称</th>
                 <th>类型</th>
+                <th>策略</th>
                 <th>项目</th>
                 <th>特征</th>
-                <th>计量</th>
-                <th>单位</th>
-                <th>单价</th>
                 <th>备注</th>
                 <th>录入时间</th>
                 <th>操作</th>
             </tr>
-            <tr v-for="model in models">
+            <tr v-for="(model,i) in models">
+                <td>@{{ i+1 }}</td>
+                <td>
+                    <button class="btn btn-sm btn-info">维护详情</button>
+                    <table class="table table-sm table-bordered table-striped">
+                        <tr>
+
+                        </tr>
+                    </table>
+                </td>
+                <td>@{{ model.name }}</td>
+                <td>@{{ model.operationType }}</td>
+                <td>@{{ model.strategy }}</td>
+                <td>货主们</td>
+                <td>@{{ model.feature }}</td>
+                <td>@{{ model.remark }}</td>
+                <td>@{{ model.createdAt }}</td>
                 <td></td>
             </tr>
         </table>
@@ -36,8 +50,24 @@
         new Vue({
             el:"#container",
             data:{
-                models : [],
-                owners : [],
+                models : [
+                    @foreach($models as $model)
+                    {
+                        id : "{{$model->id}}",
+                        operationType : "{{$model->operation_type}}",
+                        name : "{{$model->name}}",
+                        strategy : "{{$model->strategy}}",
+                        feature : "{{$model->feature}}",
+                        remark : "{{$model->remark}}",
+                        createdAt : "{{$model->created_at}}",
+                    },
+                    @endforeach
+                ],
+                owners : [
+                    @foreach($owners as $owner)
+                    {name:"{{$owner->id}}",value:"{{$owner->name}}"},
+                    @endforeach
+                ],
             },
             mounted(){
                 let data=[

+ 66 - 21
resources/views/maintenance/priceModel/storage/create.blade.php

@@ -7,42 +7,72 @@
         @component('maintenance.priceModel.storage.menu')@endcomponent
     </div>
     <div class="container-fluid mt-2 card" id="container">
-        <form method="GET" action="{{url('')}}" class="card-body offset-3">
+        <form method="POST" :action="model.id ? '{{url('maintenance/priceModel/storage/update')}}' : '{{url('maintenance/priceModel/storage/store')}}'" class="card-body offset-3">
+            @csrf
+            <label hidden><input :value="model.id" name="id"></label>
             <div class="row">
-                <label for="priceType" class="col-2">计费类型</label>
-                <select id="priceType" name="priceType" class="col-3 form-control">
-                    <option></option>
+                <label for="counting_type" class="col-2 text-info">计费类型</label>
+                <select id="counting_type" name="counting_type" class="col-3 form-control"
+                        :class="errors.counting_type ? 'is-invalid' : ''" v-model="model.counting_type">
+                    <option v-for="type in counting_type" :value="type">@{{ type }}</option>
                 </select>
+                <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.counting_type">
+                    <strong>@{{ errors.counting_type[0] }}</strong>
+                </span>
             </div>
             <div class="row mt-3">
-                <label for="type" class="col-2">用仓类型</label>
-                <select id="type" name="type" class="col-3 form-control">
-                    <option></option>
+                <label for="using_type" class="col-2 text-info">用仓类型</label>
+                <select id="using_type" name="using_type" class="col-3 form-control"
+                        :class="errors.using_type ? 'is-invalid' : ''" v-model="model.using_type">
+                    <option v-for="type in using_type" :value="type">@{{ type }}</option>
                 </select>
+                <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.using_type">
+                    <strong>@{{ errors.using_type[0] }}</strong>
+                </span>
             </div>
             <div class="row mt-3">
                 <label for="minimum_area" class="col-2">最低起租面积</label>
-                <input id="minimum_area" type="text" name="minimum_area" class="col-6 form-control">
+                <input id="minimum_area" type="number" min="0" step="0.001" name="minimum_area" class="col-6 form-control"
+                       :class="errors.minimum_area ? 'is-invalid' : ''" v-model="model.minimum_area">
+                <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.minimum_area">
+                    <strong>@{{ errors.minimum_area[0] }}</strong>
+                </span>
             </div>
             <div class="row mt-3">
-                <label for="price" class="col-2">单价</label>
-                <input id="price" type="number" name="price" class="col-6 form-control">
+                <label for="price" class="col-2 text-info">单价</label>
+                <input id="price" type="number" min="0" step="0.001" name="price" class="col-6 form-control"
+                       :class="errors.price ? 'is-invalid' : ''" v-model="model.price">
+                <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.price">
+                    <strong>@{{ errors.price[0] }}</strong>
+                </span>
             </div>
             <div class="row mt-3">
-                <label for="discount_type" class="col-2">减免类型</label>
-                <select id="discount_type" name="discount_type" class="col-3 form-control">
-                    <option></option>
+                <label for="discount_type" class="col-2 text-info">减免类型</label>
+                <select id="discount_type" name="discount_type" class="col-3 form-control"
+                        :class="errors.discount_type ? 'is-invalid' : ''" v-model="model.discount_type">
+                    <option v-for="type in discount_type" :value="type">@{{ type }}</option>
                 </select>
+                <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.discount_type">
+                    <strong>@{{ errors.discount_type[0] }}</strong>
+                </span>
             </div>
             <div class="row mt-3">
                 <label for="discount_value" class="col-2">减免值</label>
-                <input id="discount_value" type="number" name="discount_value" class="col-6 form-control">
+                <input id="discount_value" type="number" min="0" step="0.001" name="discount_value" class="col-6 form-control"
+                       :class="errors.discount_value ? 'is-invalid' : ''" v-model="model.discount_value">
+                <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.discount_value">
+                    <strong>@{{ errors.discount_value[0] }}</strong>
+                </span>
             </div>
             <div class="row mt-3">
-                <label for="unit_id" class="col-2">单位</label>
-                <select id="unit_id" name="unit_id" class="col-3 form-control">
-                    <option></option>
+                <label for="unit_id" class="col-2 text-info">单位</label>
+                <select id="unit_id" name="unit_id" class="col-3 form-control"
+                        :class="errors.unit_id ? 'is-invalid' : ''" v-model="model.unit_id">
+                    <option v-for="unit in units" :value="unit.id">@{{ unit.name }}</option>
                 </select>
+                <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.unit_id">
+                    <strong>@{{ errors.unit_id[0] }}</strong>
+                </span>
             </div>
             <div class="row mt-3 offset-1">
                 <button type="submit" class="btn btn-success col-7">提交</button>
@@ -56,10 +86,25 @@
         new Vue({
             el:"#container",
             data:{
-                priceTypes : [],
-                types : [],
-                discountTypes : [],
-                units : [],
+                model : {
+                    'id' : "{{isset($model) ? $model->id : ''}}",
+                    'counting_type' : "{{old('counting_type') ?? (isset($model) ? $model->counting_type : '')}}",
+                    'using_type' : "{{old('using_type') ?? (isset($model) ? $model->using_type : '')}}",
+                    'minimum_area' : "{{old('minimum_area') ?? (isset($model) ? $model->minimum_area : '')}}",
+                    'discount_value' : "{{old('discount_value') ?? (isset($model) ? $model->discount_value : '')}}",
+                    'price' : "{{old('price') ?? (isset($model) ? $model->price : '')}}",
+                    'discount_type' : "{{old('discount_type') ?? (isset($model) ? $model->discount_type : '')}}",
+                    'unit_id' : "{{old('unit_id') ?? (isset($model) ? $model->unit_id : '')}}",
+                },
+                counting_type : ['包仓','灵活用仓','统单价'],
+                using_type : ['常温','恒温'],
+                discount_type : ['无减免','按单减免','固定减免'],
+                units : [
+                    @foreach($units as $unit)
+                    {id:"{{$unit->id}}", name:"{{$unit->name}}"},
+                    @endforeach
+                ],
+                errors:{!! $errors !!}
             },
         });
     </script>

+ 52 - 3
resources/views/maintenance/priceModel/storage/index.blade.php

@@ -7,6 +7,9 @@
         @component('maintenance.priceModel.storage.menu')@endcomponent
     </div>
     <div class="container-fluid mt-2" id="container">
+        @if(Session::has('successTip'))
+            <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+        @endif
         <table class="table table-hover table-striped text-nowrap">
             <tr>
                 <th>序号</th>
@@ -19,10 +22,22 @@
                 <th>录入时间</th>
                 <th>操作</th>
             </tr>
-            <tr v-for="model in models">
-                <td></td>
+            <tr v-for="(model,i) in models">
+                <td>@{{ i+1 }}</td>
+                <td>@{{ model.counting_type }}</td>
+                <td>@{{ model.using_type }}</td>
+                <td>@{{ model.minimum_area }}</td>
+                <td>@{{ model.price }}/@{{ model.unit_name }}</td>
+                <td>@{{ model.discount_type }}</td>
+                <td>@{{ model.discount_value }}</td>
+                <td>@{{ model.created_at }}</td>
+                <td>
+                    @can("计费模型-仓储-编辑")<a :href="'{{url('maintenance/priceModel/storage')}}/'+model.id+'/edit'"><button class="btn btn-sm btn-outline-info">改</button></a>@endcan
+                    @can("计费模型-仓储-删除")<button class="btn btn-sm btn-outline-danger" @click="destroy(model.id,i)">删</button>@endcan
+                </td>
             </tr>
         </table>
+        {{$models->links()}}
     </div>
 @stop
 
@@ -31,7 +46,41 @@
         new Vue({
             el:"#container",
             data:{
-                models : [],
+                models : [
+                    @foreach($models as $model)
+                    {
+                        id : "{{$model->id}}",
+                        counting_type : "{{$model->counting_type}}",
+                        using_type : "{{$model->using_type}}",
+                        minimum_area : "{{$model->minimum_area}}",
+                        price : "{{$model->price}}",
+                        discount_type : "{{$model->discount_type}}",
+                        discount_value : "{{$model->discount_value}}",
+                        unit_name : "{{$model->unit ? $model->unit->name : ''}}",
+                        created_at : "{{$model->created_at}}",
+                    },
+                    @endforeach
+                ],
+            },
+            methods:{
+                destroy(id,index){
+                    window.tempTip.confirm("确定要删除该仓储计费吗?",()=>{
+                        window.axios.delete("{{url('maintenance/priceModel/storage')}}/"+id)
+                            .then(res=>{
+                                if (res.data.success){
+                                    this.$delete(this.models,index);
+                                    window.tempTip.setDuration(2000);
+                                    window.tempTip.showSuccess("删除成功");
+                                    return;
+                                }
+                                window.tempTip.setDuration(3000);
+                                window.tempTip.show(res.data.data);
+                            }).catch(err=>{
+                            window.tempTip.setDuration(3000);
+                            window.tempTip.show("网络错误:"+err);
+                        })
+                    })
+                }
             },
         });
     </script>

+ 56 - 24
resources/views/maintenance/processMethod/create.blade.php

@@ -1,40 +1,72 @@
 @extends('layouts.app')
-@section('title')作业类型-录入@endsection
+@section('title')作业类型-录入更新@endsection
 
 @section('content')
     <div id="nav2">
         @component('maintenance.menu')@endcomponent
-        @component('maintenance.processMethod.menu')@endcomponent
+        @component('maintenance.processMethod.menu')
+            @if(isset($method))@can('作业类型-编辑')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',4)}">编辑</a>
+                </li> @endcan @endif
+        @endcomponent
     </div>
     <div class="container-fluid card" id="container">
-       <form class="card-body offset-3" method="GET" action="{{url('')}}">
-            <div class="row">
-                <label for="name" class="col-2">类型名称</label>
-                <input type="text" id="name" name="name" class="form-control col-5">
-            </div>
-           <div class="row">
-               <label for="unit_price" class="col-2">单价</label>
-               <input type="number" id="unit_price" name="unit_price" class="form-control col-3">
-           </div>
-           <div class="row mt-2">
-               <label for="unit_id" class="col-2">单位</label>
-               <select id="unit_id" name="unit_id" class="form-control col-2">
-                   <option> </option>
-               </select>
-           </div>
-            <div class="row mt-4 offset-1">
-                <button type="submit" class="btn btn-success col-6">提交</button>
-            </div>
-       </form>
+        <div class="card-body offset-3 mt-2">
+            <form method="post" :action="method.id ? '{{url('maintenance/processMethod')}}/'+method.id : '{{url('maintenance/processMethod')}}'">
+                @csrf
+                @if(isset($method)) @method('PUT') @endif
+                <div class="row">
+                    <label class="col-2 text-info" for="name">作业类型名称</label>
+                    <input type="text" class="form-control col-6" :class="errors.name ? 'is-invalid' : ''" id="name" name="name"
+                           v-model="method.name" required>
+                    <span class="offset-2 mt-0 invalid-feedback" v-if="errors.name">
+                        <strong>@{{errors.name[0]}}</strong>
+                    </span>
+                </div>
+                <div class="row mt-3">
+                    <label class="col-2" for="unit_id">作业类型单位</label>
+                    <select class="form-control col-3" :class="errors.unit_id ? 'is-invalid' : ''" id="unit_id" name="unit_id"
+                            v-model="method.unit_id">
+                            <option v-for="unit in units" :value="unit.id">@{{ unit.name }}</option>
+                    </select>
+                    <span class="offset-2 mt-0 invalid-feedback" v-if="errors.unit_id">
+                        <strong>@{{errors.unit_id[0]}}</strong>
+                    </span>
+                </div>
+                <div class="row mt-3">
+                    <label class="col-2" for="unit_price">作业类型单价</label>
+                    <input type="number" min="0" step="0.001" class="form-control col-6" id="unit_price" name="unit_price"
+                           :class="errors.unit_price ? 'is-invalid' : ''" v-model="method.unit_price">
+                    <span class="offset-2 mt-0 invalid-feedback" v-if="errors.unit_price">
+                        <strong>@{{errors.unit_price[0]}}</strong>
+                    </span>
+                </div>
+                <div class="row mt-3 offset-1">
+                    <button class="btn btn-success col-7">提交</button>
+                </div>
+            </form>
+        </div>
     </div>
 @stop
 
-@section("lastScript")
+@section('lastScript')
     <script>
         new Vue({
             el:"#container",
-            data : {
-                units : [],
+            data:{
+                method:{
+                    id : "{{isset($method) ? $method->id : ''}}",
+                    name : "{{old("name") ?? (isset($method) ? $method->name : '')}}",
+                    unit_id : "{{old("unit_id") ?? (isset($method) ? $method->unit_id : '')}}",
+                    unit_price : "{{old("unit_price") ?? (isset($method) ? $method->unit_price : '')}}",
+                },
+                errors : {!! $errors !!},
+                units : [
+                    @foreach($units as $unit)
+                    {id:"{{$unit->id}}",name:"{{$unit->name}}"},
+                    @endforeach
+                ],
             },
         });
     </script>

+ 54 - 3
resources/views/maintenance/processMethod/index.blade.php

@@ -6,20 +6,71 @@
         @component('maintenance.menu')@endcomponent
         @component('maintenance.processMethod.menu')@endcomponent
     </div>
-    <div class="container-fluid card">
+    <div class="container-fluid card" id="container">
+        @if(Session::has('successTip'))
+            <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+        @endif
         <table class="table table-hover table-striped text-nowrap card-body mt-2">
             <tr>
-                <th>ID</th>
+                <th>序号</th>
                 <th>类型</th>
                 <th>单价</th>
                 <th>单位</th>
                 <th>创建时间</th>
                 <th>操作</th>
             </tr>
+            <tr v-for="(method,i) in methods">
+                <td>@{{ i+1 }}</td>
+                <td>@{{ method.name }}</td>
+                <td>@{{ method.unit_price }}</td>
+                <td>@{{ method.unit_name }}</td>
+                <td>@{{ method.created_at }}</td>
+                <td>
+                    @can("作业类型-编辑")<a :href="'{{url('maintenance/processMethod')}}/'+method.id+'/edit'"><button class="btn btn-sm btn-outline-info">改</button></a>@endcan
+                    @can("作业类型-删除")<button class="btn btn-sm btn-outline-danger" @click="destroy(method.id,i,method.name)">删</button>@endcan
+                </td>
+            </tr>
         </table>
     </div>
 @stop
 
 @section("lastScript")
-
+    <script>
+        new Vue({
+            el:"#container",
+            data:{
+                methods : [
+                    @foreach($methods as $method)
+                    {
+                        id:"{{$method->id}}",
+                        name:"{{$method->name}}",
+                        unit_price:"{{$method->unit_price}}",
+                        unit_name:"{{$method->unit ? $method->unit->name : ''}}",
+                        created_at:"{{$method->created_at}}",
+                    },
+                    @endforeach
+                ],
+            },
+            methods:{
+                destroy(id,index,name){
+                    window.tempTip.confirm("确定要删除"+name+"吗?",()=>{
+                        window.axios.delete("{{url('maintenance/processMethod')}}/"+id)
+                            .then(res=>{
+                                if (res.data.success){
+                                    this.$delete(this.methods,index);
+                                    window.tempTip.setDuration(2000);
+                                    window.tempTip.showSuccess("删除"+name+"成功");
+                                    return;
+                                }
+                                window.tempTip.setDuration(3000);
+                                window.tempTip.show(res.data.data);
+                            }).catch(err=>{
+                            window.tempTip.setDuration(3000);
+                            window.tempTip.show("网络错误:"+err);
+                        })
+                    })
+                }
+            },
+        });
+    </script>
 @stop

+ 1 - 0
resources/views/maintenance/processMethod/menu.blade.php

@@ -9,6 +9,7 @@
                 <li class="nav-item">
                     <a class="nav-link" href="{{url('maintenance/processMethod/create')}}" :class="{active:isActive('create',3)}">录入</a>
                 </li> @endcan
+            {{$slot}}
         </ul>
     </div>
 </div>

+ 24 - 14
resources/views/maintenance/userOwnerGroup/create.blade.php

@@ -1,24 +1,34 @@
 @extends('layouts.app')
-@section('title')项目组-录入@endsection
+@section('title')项目组-录入更新@endsection
 
 @section('content')
     <div id="nav2">
         @component('maintenance.menu')@endcomponent
-        @component('maintenance.userOwnerGroup.menu')@endcomponent
+        @component('maintenance.userOwnerGroup.menu')
+            @if(isset($group))@can('项目组-编辑')
+            <li class="nav-item">
+                <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',4)}">编辑</a>
+            </li> @endcan @endif
+        @endcomponent
     </div>
     <div class="container-fluid card">
-       <form class="card-body offset-3" method="GET" action="{{url('')}}">
-            <div class="row">
-                <label for="name" class="col-2">小组名称</label>
-                <input type="text" id="name" name="name" class="form-control col-5">
-            </div>
-            <div class="row mt-4 offset-1">
-                <button type="submit" class="btn btn-success col-6">提交</button>
-            </div>
-       </form>
+        <div class="card-body offset-3 mt-2">
+            <form method="post" action="{{isset($group) ? url('maintenance/userOwnerGroup').'/'.$group->id : url('maintenance/userOwnerGroup')}}">
+                @csrf
+                @if(isset($group)) @method('PUT') @endif
+                <div class="row mt-3">
+                    <label class="col-2" for="name">项目组名称</label>
+                    <input class="form-control col-6 @error("name") is-invalid @enderror" id="name" name="name"
+                           value="{{old("name") ?? (isset($group) ? $group->name : '')}}">
+                    @error("name")<span class="offset-2 mt-0 invalid-feedback">
+                        <strong>{{$message}}</strong>
+                    </span>@enderror
+                </div>
+                <div class="row mt-3 offset-1">
+                    <button class="btn btn-success col-7">提交</button>
+                </div>
+            </form>
+        </div>
     </div>
 @stop
 
-@section("lastScript")
-
-@stop

+ 50 - 4
resources/views/maintenance/userOwnerGroup/index.blade.php

@@ -6,19 +6,65 @@
         @component('maintenance.menu')@endcomponent
         @component('maintenance.userOwnerGroup.menu')@endcomponent
     </div>
-    <div class="container-fluid card">
+    <div class="container-fluid card" id="container">
+        @if(Session::has('successTip'))
+            <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+        @endif
         <table class="table table-hover table-striped text-nowrap card-body mt-2">
             <tr>
-                <th>ID</th>
+                <th>序号</th>
                 <th>名称</th>
                 <th>创建时间</th>
                 <th>操作</th>
             </tr>
-
+            <tr v-for="(group,i) in groups">
+                <td>@{{ i+1 }}</td>
+                <td>@{{ group.name }}</td>
+                <td>@{{ group.created_at }}</td>
+                <td>
+                    @can("项目组-编辑")<a :href="'{{url('maintenance/userOwnerGroup')}}/'+group.id+'/edit'"><button class="btn btn-sm btn-outline-info">改</button></a>@endcan
+                    @can("项目组-删除")<button class="btn btn-sm btn-outline-danger" @click="destroy(group.id,i,group.name)">删</button>@endcan
+                </td>
+            </tr>
         </table>
     </div>
 @stop
 
 @section("lastScript")
-
+    <script>
+        new Vue({
+            el:"#container",
+            data:{
+                groups : [
+                    @foreach($groups as $group)
+                    {
+                        id:"{{$group->id}}",
+                        name:"{{$group->name}}",
+                        created_at:"{{$group->created_at}}",
+                    },
+                    @endforeach
+                ],
+            },
+            methods:{
+                destroy(id,index,name){
+                    window.tempTip.confirm("确定要删除"+name+"吗?",()=>{
+                        window.axios.delete("{{url('maintenance/userOwnerGroup')}}/"+id)
+                            .then(res=>{
+                                if (res.data.success){
+                                    this.$delete(this.groups,index);
+                                    window.tempTip.setDuration(2000);
+                                    window.tempTip.showSuccess("删除"+name+"成功");
+                                    return;
+                                }
+                                window.tempTip.setDuration(3000);
+                                window.tempTip.show(res.data.data);
+                            }).catch(err=>{
+                            window.tempTip.setDuration(3000);
+                            window.tempTip.show("网络错误:"+err);
+                        })
+                    })
+                }
+            },
+        });
+    </script>
 @stop

+ 1 - 0
resources/views/maintenance/userOwnerGroup/menu.blade.php

@@ -9,6 +9,7 @@
                 <li class="nav-item">
                     <a class="nav-link" href="{{url('maintenance/userOwnerGroup/create')}}" :class="{active:isActive('create',3)}">录入</a>
                 </li> @endcan
+            {{ $slot }}
         </ul>
     </div>
 </div>

+ 19 - 4
routes/web.php

@@ -82,9 +82,13 @@ Route::group(['prefix'=>'maintenance'],function(){
         Route::resource('waybillPriceModel','WaybillPriceModelsController');
 
         Route::group(['prefix'=>'storage'],function(){
-            Route::get('create','PriceModelController@storeCreate');
+            Route::get('create','PriceModelController@storageCreate');
+            Route::post('store','PriceModelController@storageStore');
+            Route::get('{id}/edit','PriceModelController@storageEdit');
+            Route::delete("{id}","PriceModelController@storageDestroy");
+            Route::post('update','PriceModelController@storageUpdate');
         });
-        Route::get('storage','PriceModelController@storeIndex');
+        Route::get('storage','PriceModelController@storageIndex');
 
         Route::group(['prefix'=>'operation'],function(){
             Route::get('create','PriceModelController@operationCreate');
@@ -125,7 +129,6 @@ Route::group(['prefix'=>'maintenance'],function(){
     Route::resource('userWorkgroup', 'UserWorkgroupController');
     Route::resource('laborCompany', 'LaborCompanyController');
     Route::resource('warehouse', 'WarehouseController');
-    Route::resource('jobType', 'JobTypeController');
     Route::resource('tutorial', 'TutorialController');
     Route::resource('userLabor','UserLaborController');
     Route::resource('paperBox', 'PaperBoxController');
@@ -503,15 +506,27 @@ Route::group(['prefix'=>'customer'],function(){
         Route::get('report','CustomerController@projectReport');
         Route::get('index','CustomerController@projectIndex');
         Route::get('create','CustomerController@projectCreate');
+        Route::group(['prefix'=>'area'],function(){
+            Route::match(['GET','POST'],'export','CustomerController@projectAreaExport');
+        });
         Route::get('area','CustomerController@projectArea');
         Route::get('{id}/edit','CustomerController@projectEdit');
         Route::post('store','CustomerController@projectStore');
         Route::post('seekOwner','CustomerController@seekOwner');
         Route::post('getOwnerPriceModel','CustomerController@getOwnerPriceModel');
+        Route::post('updateArea','CustomerController@updateArea');
     });
     Route::group(['prefix'=>'finance'],function(){
+        Route::group(['prefix'=>'instantBill'],function(){
+            Route::match(['GET','POST'],'export','CustomerController@financeInstantBillExport');
+        });
         Route::get('instantBill','CustomerController@financeInstantBill');
-        Route::get('billConfirmation','CustomerController@financeBillConfirmation');;
+        Route::group(['prefix'=>'billConfirmation'],function(){
+            Route::match(['GET','POST'],'export','CustomerController@financeBillConfirmationExport');
+        });
+        Route::get('billConfirmation','CustomerController@financeBillConfirmation');
+        Route::post('updateBillReport','CustomerController@updateBillReport');
+        Route::post('billConfirm','CustomerController@billConfirm');
     });
     Route::get('relating',function (){return view('customer.relating');});
 });

+ 5 - 0
serves/excelExportGo/logs/2020-11-04.log

@@ -0,0 +1,5 @@
+
+[ERROR]   15:26:32
+   /orm/query.go:11   SQL执行错误!(select owner_fee_details.*,(work_fee+logistic_fee) total, owners.name owner_name, customers.name customer_name, shops.name shop_name, process_methods.name process_method_name, logistics.name logistic_name from `owner_fee_details` left join `owners` on `owner_fee_details`.`owner_id` = `owners`.`id` left join `customers` on `owners`.`customer_id` = `customers`.`id` left join `shops` on `owner_fee_details`.`shop_id` = `shops`.`id` left join `process_methods` on `owner_fee_details`.`process_method_id` = `process_methods`.`id` left join `logistics` on `owner_fee_details`.`logistic_id` = `logistics`.`id` where `process_id` = '3,4' order by `id` desc)
+[ERROR]   15:28:59
+   /orm/query.go:11   SQL执行错误!(select owner_fee_details.*,(work_fee+logistic_fee) total, owners.name owner_name, customers.name customer_name, shops.name shop_name, process_methods.name process_method_name, logistics.name logistic_name from `owner_fee_details` left join `owners` on `owner_fee_details`.`owner_id` = `owners`.`id` left join `customers` on `owners`.`customer_id` = `customers`.`id` left join `shops` on `owner_fee_details`.`shop_id` = `shops`.`id` left join `process_methods` on `owner_fee_details`.`process_method_id` = `process_methods`.`id` left join `logistics` on `owner_fee_details`.`logistic_id` = `logistics`.`id` where `id` in ('3', '4') order by `id` desc)