|
@@ -35,7 +35,7 @@ class PriceModelController extends Controller
|
|
|
public function storageIndex(Request $request)
|
|
public function storageIndex(Request $request)
|
|
|
{
|
|
{
|
|
|
if(!Gate::allows('计费模型-仓储')){ return redirect('denied'); }
|
|
if(!Gate::allows('计费模型-仓储')){ return redirect('denied'); }
|
|
|
- $models = app('OwnerStoragePriceModelService')->paginate($request->input("id"),["unit","owners"]);
|
|
|
|
|
|
|
+ $models = app('OwnerStoragePriceModelService')->paginate($request->input("id"),["unit","owners","timeUnit"]);
|
|
|
return response()->view('maintenance.priceModel.storage.index',compact("models"));
|
|
return response()->view('maintenance.priceModel.storage.index',compact("models"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -79,6 +79,7 @@ class PriceModelController extends Controller
|
|
|
"discount_type" => $request->input("discount_type"),
|
|
"discount_type" => $request->input("discount_type"),
|
|
|
"discount_value"=> $request->input("discount_value"),
|
|
"discount_value"=> $request->input("discount_value"),
|
|
|
"unit_id" => $request->input("unit_id"),
|
|
"unit_id" => $request->input("unit_id"),
|
|
|
|
|
+ "time_unit_id" => $request->input("time_unit_id"),
|
|
|
]);
|
|
]);
|
|
|
$model = new OwnerStoragePriceModel();
|
|
$model = new OwnerStoragePriceModel();
|
|
|
$model->id = $request->input("id");
|
|
$model->id = $request->input("id");
|
|
@@ -105,6 +106,7 @@ class PriceModelController extends Controller
|
|
|
'price'=>['required','numeric','min:0'],
|
|
'price'=>['required','numeric','min:0'],
|
|
|
'discount_type'=>['required'],
|
|
'discount_type'=>['required'],
|
|
|
'unit_id'=>['required','integer'],
|
|
'unit_id'=>['required','integer'],
|
|
|
|
|
+ 'time_unit_id'=>['required','integer'],
|
|
|
],[
|
|
],[
|
|
|
'required'=>':attribute 为必填项',
|
|
'required'=>':attribute 为必填项',
|
|
|
'min'=>':attribute 不得小于0',
|
|
'min'=>':attribute 不得小于0',
|
|
@@ -118,6 +120,7 @@ class PriceModelController extends Controller
|
|
|
'discount_type' =>"减免类型",
|
|
'discount_type' =>"减免类型",
|
|
|
'discount_value'=>"减免值",
|
|
'discount_value'=>"减免值",
|
|
|
'unit_id' =>"单位",
|
|
'unit_id' =>"单位",
|
|
|
|
|
+ 'time_unit_id' =>"计时单位",
|
|
|
]);
|
|
]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1005,6 +1008,7 @@ class PriceModelController extends Controller
|
|
|
"discount_type" => request("discount_type"),
|
|
"discount_type" => request("discount_type"),
|
|
|
"discount_value" => request("discount_value") ?? 0,
|
|
"discount_value" => request("discount_value") ?? 0,
|
|
|
"unit_id" => request("unit_id"),
|
|
"unit_id" => request("unit_id"),
|
|
|
|
|
+ "time_unit_id" => request("time_unit_id"),
|
|
|
];
|
|
];
|
|
|
if (request("id"))app('OwnerStoragePriceModelService')->update(["id"=>request("id")],$values);
|
|
if (request("id"))app('OwnerStoragePriceModelService')->update(["id"=>request("id")],$values);
|
|
|
else{
|
|
else{
|
|
@@ -1296,7 +1300,13 @@ class PriceModelController extends Controller
|
|
|
{
|
|
{
|
|
|
$owner = new Owner();
|
|
$owner = new Owner();
|
|
|
$owner->id = request("id");
|
|
$owner->id = request("id");
|
|
|
- $owner->load(["ownerStoragePriceModels","ownerPriceOperations.items","ownerPriceExpresses"=>function($query){
|
|
|
|
|
|
|
+ $owner->load(["ownerStoragePriceModels","ownerPriceOperations"=>function($query){
|
|
|
|
|
+ /** @var Builder $query */
|
|
|
|
|
+ $query->with(["items"=>function($query){
|
|
|
|
|
+ /** @var Builder $query */
|
|
|
|
|
+ $query->orderByRaw("CASE strategy WHEN '起步' THEN 1 WHEN '默认' THEN 2 WHEN '特征' THEN 3 END");
|
|
|
|
|
+ }]);
|
|
|
|
|
+ },"ownerPriceExpresses"=>function($query){
|
|
|
/** @var Builder $query */
|
|
/** @var Builder $query */
|
|
|
$query->with(["details","logistics"]);
|
|
$query->with(["details","logistics"]);
|
|
|
},"ownerPriceLogistics"=>function($query){
|
|
},"ownerPriceLogistics"=>function($query){
|
|
@@ -1310,6 +1320,9 @@ class PriceModelController extends Controller
|
|
|
$operation["featureFormat"] = $operation->featureFormat;
|
|
$operation["featureFormat"] = $operation->featureFormat;
|
|
|
foreach ($operation->items as &$item){
|
|
foreach ($operation->items as &$item){
|
|
|
$item["featureFormat"] = $item->featureFormat;
|
|
$item["featureFormat"] = $item->featureFormat;
|
|
|
|
|
+ if ($operation["operation_type"]==='出库' && $item["strategy"] == "起步"){
|
|
|
|
|
+ $item["type"] = $item["amount"] ? 0 : 1;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
$this->success($owner);
|
|
$this->success($owner);
|