|
|
@@ -634,6 +634,45 @@ class PriceModelController extends Controller
|
|
|
return ["success"=>false,"data"=>"导入发生错误,数据无响应"];
|
|
|
}
|
|
|
|
|
|
+ public function logisticUpdateDetail(Request $request)
|
|
|
+ {
|
|
|
+ if(!Gate::allows('计费模型-物流-编辑')){ return ["success"=>false,"data"=>"无权操作"]; }
|
|
|
+ $detail = $request->input("detail");
|
|
|
+ if ($detail["id"]){
|
|
|
+ app('OwnerPriceLogisticService')->updateDetail(["id"=>$detail["id"]],[
|
|
|
+ "unit_price" => $detail["unit_price"],
|
|
|
+ "delivery_fee" => $detail["delivery_fee"],
|
|
|
+ "initial_fee" => $detail["initial_fee"],
|
|
|
+ "initial_amount" => $detail["initial_amount"],
|
|
|
+ "rate" => $detail["rate"],
|
|
|
+ ]);
|
|
|
+ }else{
|
|
|
+ $row = app('OwnerPriceLogisticService')->isExistDetail([
|
|
|
+ "owner_price_logistic_id"=>$request->input("id"),
|
|
|
+ "unit_id"=>$detail["unit_id"],
|
|
|
+ "range"=>$detail["range"],
|
|
|
+ "province_id"=>$detail["province_id"],
|
|
|
+ "city_id"=>$detail["city_id"],
|
|
|
+ ]);
|
|
|
+ if ($row>0)return ["success"=>false,"data"=>"已存在该计费模型"];
|
|
|
+ /** @var OwnerPriceExpressProvince $detail */
|
|
|
+ $detail = app('OwnerPriceLogisticService')->createDetail([
|
|
|
+ "owner_price_logistic_id"=>$request->input("id"),
|
|
|
+ "unit_id"=>$detail["unit_id"],
|
|
|
+ "range"=>$detail["range"],
|
|
|
+ "province_id"=>$detail["province_id"],
|
|
|
+ "city_id"=>$detail["city_id"],
|
|
|
+ "unit_price" => $detail["unit_price"],
|
|
|
+ "delivery_fee" => $detail["delivery_fee"],
|
|
|
+ "initial_fee" => $detail["initial_fee"],
|
|
|
+ "initial_amount" => $detail["initial_amount"],
|
|
|
+ "rate" => $detail["rate"],
|
|
|
+ ]);
|
|
|
+ $detail->load("province","unit","city");
|
|
|
+ }
|
|
|
+ return ["success"=>true,"data"=>$detail];
|
|
|
+ }
|
|
|
+
|
|
|
private function logisticValidator(array $params,$id = null)
|
|
|
{
|
|
|
return Validator::make($params,[
|