|
|
@@ -24,10 +24,10 @@ use Maatwebsite\Excel\Facades\Excel;
|
|
|
|
|
|
class PriceModelController extends Controller
|
|
|
{
|
|
|
- public function storageIndex()
|
|
|
+ public function storageIndex(Request $request)
|
|
|
{
|
|
|
if(!Gate::allows('计费模型-仓储')){ return redirect('denied'); }
|
|
|
- $models = app('OwnerStoragePriceModelService')->paginate(["unit"]);
|
|
|
+ $models = app('OwnerStoragePriceModelService')->paginate($request->input("id"),["unit"]);
|
|
|
return response()->view('maintenance.priceModel.storage.index',compact("models"));
|
|
|
}
|
|
|
|
|
|
@@ -358,9 +358,9 @@ class PriceModelController extends Controller
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
- public function expressIndex(){
|
|
|
+ public function expressIndex(Request $request){
|
|
|
if(!Gate::allows('计费模型-快递-查询')){ return redirect('denied'); }
|
|
|
- $models = app('OwnerPriceExpressService')->paginate();
|
|
|
+ $models = app('OwnerPriceExpressService')->paginate($request->input("id"));
|
|
|
return response()->view('maintenance.priceModel.express.index',compact("models"));
|
|
|
}
|
|
|
|
|
|
@@ -426,8 +426,7 @@ class PriceModelController extends Controller
|
|
|
if(!Gate::allows('计费模型-快递-录入')){ return redirect('denied'); }
|
|
|
$logistics = app("LogisticService")->getSelection();
|
|
|
$owners = app("OwnerService")->getSelection();
|
|
|
- $units = app("UnitService")->getSelection();
|
|
|
- return response()->view('maintenance.priceModel.express.create',compact("logistics","owners","units"));
|
|
|
+ return response()->view('maintenance.priceModel.express.create',compact("logistics","owners"));
|
|
|
}
|
|
|
|
|
|
public function expressStore(Request $request)
|
|
|
@@ -439,8 +438,8 @@ class PriceModelController extends Controller
|
|
|
/** @var OwnerPriceExpress $model */
|
|
|
$model = app("OwnerPriceExpressService")->create([
|
|
|
"name" => $request->input("name"),
|
|
|
- "initial_weight_unit_id" => $request->input("initial_weight_unit_id"),
|
|
|
- "additional_weight_unit_id" => $request->input("additional_weight_unit_id"),
|
|
|
+ "initial_weight" => $request->input("initial_weight"),
|
|
|
+ "additional_weight" => $request->input("additional_weight"),
|
|
|
]);
|
|
|
$model->owners()->sync($request->input("owner_id"));
|
|
|
$model->logistics()->sync($request->input("logistic_id"));
|
|
|
@@ -454,8 +453,7 @@ class PriceModelController extends Controller
|
|
|
$model = app('OwnerPriceExpressService')->find($id)->append(["owner_id","logistic_id"]);
|
|
|
$owners = app("OwnerService")->getSelection();
|
|
|
$logistics = app('LogisticService')->getSelection();
|
|
|
- $units = app('UnitService')->getSelection();
|
|
|
- return response()->view('maintenance.priceModel.express.create',compact("owners","logistics","model","units"));
|
|
|
+ return response()->view('maintenance.priceModel.express.create',compact("owners","logistics","model"));
|
|
|
}
|
|
|
|
|
|
public function expressUpdate($id,Request $request)
|
|
|
@@ -467,8 +465,8 @@ class PriceModelController extends Controller
|
|
|
/** @var OwnerPriceExpress $model */
|
|
|
app("OwnerPriceExpressService")->update(["id"=>$id],[
|
|
|
"name" => $request->input("name"),
|
|
|
- "initial_weight_unit_id" => $request->input("initial_weight_unit_id"),
|
|
|
- "additional_weight_unit_id" => $request->input("additional_weight_unit_id"),
|
|
|
+ "initial_weight" => $request->input("initial_weight"),
|
|
|
+ "additional_weight" => $request->input("additional_weight"),
|
|
|
]);
|
|
|
$model = new OwnerPriceExpress();
|
|
|
$model->id = $id;
|
|
|
@@ -481,8 +479,8 @@ class PriceModelController extends Controller
|
|
|
{
|
|
|
return Validator::make($params,[
|
|
|
'name'=>['required',$id?"unique:owner_price_expresses,name,$id":'unique:owner_price_expresses,name'],
|
|
|
- 'initial_weight_unit_id'=>['required'],
|
|
|
- 'additional_weight_unit_id'=>['required'],
|
|
|
+ 'initial_weight'=>['required','numeric','min:0'],
|
|
|
+ 'additional_weight'=>['required','numeric','min:0'],
|
|
|
'owner_id'=>[function ($attribute, $value, $fail)use($id) {
|
|
|
$owners = app("OwnerPriceExpressService")->getExistOwnerName($value,$id);
|
|
|
if ($owners)$fail("(".implode(',',$owners).') 已经绑定计费模型');
|
|
|
@@ -496,8 +494,8 @@ class PriceModelController extends Controller
|
|
|
'unique' => ':attribute 已存在',
|
|
|
],[
|
|
|
'name' =>"名称",
|
|
|
- 'initial_weight_unit_id' =>"首重单位",
|
|
|
- 'additional_weight_unit_id' =>"续重单位",
|
|
|
+ 'initial_weight' =>"首重",
|
|
|
+ 'additional_weight' =>"续重",
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
@@ -508,10 +506,10 @@ class PriceModelController extends Controller
|
|
|
return ["success"=>true];
|
|
|
}
|
|
|
|
|
|
- public function logisticIndex()
|
|
|
+ public function logisticIndex(Request $request)
|
|
|
{
|
|
|
if(!Gate::allows('计费模型-物流-查询')){ return redirect('denied'); }
|
|
|
- $models = app("OwnerPriceLogisticService")->paginate()->append(["unit_range_json","other_unit_range_json"]);
|
|
|
+ $models = app("OwnerPriceLogisticService")->paginate($request->input("id"))->append(["unit_range_json","other_unit_range_json"]);
|
|
|
return response()->view('maintenance.priceModel.logistic.index',compact("models"));
|
|
|
}
|
|
|
|
|
|
@@ -595,15 +593,15 @@ class PriceModelController extends Controller
|
|
|
{
|
|
|
if(!Gate::allows('计费模型-快递-查询')){ return ["success"=>false,"data"=>"无权操作"]; }
|
|
|
$model = app("OwnerPriceExpressService")->find($id,[
|
|
|
- "owners","logistics","initialWeightUnit","additionalWeightUnit","details"=>function($query){
|
|
|
+ "owners","logistics","details"=>function($query){
|
|
|
/** @var Builder $query */
|
|
|
$query->with("province");
|
|
|
}]);
|
|
|
- $row = ["客户","首重单位","续重单位","承运商"];
|
|
|
+ $row = ["客户","首重","续重","承运商"];
|
|
|
$list = [[
|
|
|
implode(",",array_column($model->owners->toArray(),"name")),
|
|
|
- $model->initialWeightUnit ? $model->initialWeightUnit->name : '',
|
|
|
- $model->additionalWeightUnit ? $model->additionalWeightUnit->name : '',
|
|
|
+ $model->initial_weight,
|
|
|
+ $model->additional_weight,
|
|
|
implode(",",array_column($model->logistics->toArray(),"name")),
|
|
|
],[
|
|
|
"价格名称","省","首重价格","续重价格",
|
|
|
@@ -767,9 +765,9 @@ class PriceModelController extends Controller
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
- public function directLogisticIndex(){
|
|
|
+ public function directLogisticIndex(Request $request){
|
|
|
if(!Gate::allows('计费模型-直发-查询')){ return redirect('denied'); }
|
|
|
- $models = app("OwnerPriceDirectLogisticService")->paginate();
|
|
|
+ $models = app("OwnerPriceDirectLogisticService")->paginate($request->input("id"));
|
|
|
return response()->view('maintenance.priceModel.directLogistic.index',compact("models"));
|
|
|
}
|
|
|
|