|
|
@@ -265,6 +265,9 @@ class PriceModelController extends Controller
|
|
|
"priority" => $request->input("priority"),
|
|
|
"remark" => $request->input("remark"),
|
|
|
"feature" => $request->input("feature"),
|
|
|
+ "discount_count" => request("discount_count"),
|
|
|
+ "total_price" => request("total_price"),
|
|
|
+ "total_discount_price"=> request("total_discount_price"),
|
|
|
]);
|
|
|
//录入子表
|
|
|
$insert = [];
|
|
|
@@ -312,6 +315,9 @@ class PriceModelController extends Controller
|
|
|
"priority" => $request->input("priority"),
|
|
|
"remark" => $request->input("remark"),
|
|
|
"feature" => $request->input("feature"),
|
|
|
+ "discount_count" => request("discount_count"),
|
|
|
+ "total_price" => request("total_price"),
|
|
|
+ "total_discount_price"=> request("total_discount_price"),
|
|
|
]);
|
|
|
$service->destroyItem($id);
|
|
|
//录入子表
|
|
|
@@ -1041,15 +1047,19 @@ class PriceModelController extends Controller
|
|
|
if (count($errors)>0)$this->success(["errors"=>$errors]);
|
|
|
|
|
|
if (!request("owner_id"))$this->error("参数传递错误");
|
|
|
+ $operation = [
|
|
|
+ "name" => request("name"),
|
|
|
+ "operation_type" => request("operation_type"),
|
|
|
+ "strategy" => request("strategy"),
|
|
|
+ "feature" => request("feature"),
|
|
|
+ "remark" => request("remark"),
|
|
|
+ "discount_count" => request("discount_count"),
|
|
|
+ "total_price" => request("total_price"),
|
|
|
+ "total_discount_price"=> request("total_discount_price"),
|
|
|
+ ];
|
|
|
if (request("id")){
|
|
|
$model = app('OwnerPriceOperationService')->find(request("id"),["items"]);
|
|
|
- app('OwnerPriceOperationService')->findUpdate($model,[
|
|
|
- "name" => request("name"),
|
|
|
- "operation_type" => request("operation_type"),
|
|
|
- "strategy" => request("strategy"),
|
|
|
- "feature" => request("feature"),
|
|
|
- "remark" => request("remark"),
|
|
|
- ]);
|
|
|
+ app('OwnerPriceOperationService')->findUpdate($model,$operation);
|
|
|
$delete = [];//需要删除子项
|
|
|
$update = [["id","strategy","amount","unit_id","unit_price","feature"]];//需要更新子项
|
|
|
$insert = [];//需要新增子项
|
|
|
@@ -1077,14 +1087,8 @@ class PriceModelController extends Controller
|
|
|
if (count($update) > 1)app(BatchUpdateService::class)->batchUpdate("owner_price_operation_items",$update);
|
|
|
if ($insert)app("OwnerPriceOperationItemService")->insert($insert);
|
|
|
}else{
|
|
|
- DB::transaction(function ()use(&$model,$params){
|
|
|
- $model = app('OwnerPriceOperationService')->create([
|
|
|
- "name" => request("name"),
|
|
|
- "operation_type" => request("operation_type"),
|
|
|
- "strategy" => request("strategy"),
|
|
|
- "feature" => request("feature"),
|
|
|
- "remark" => request("remark"),
|
|
|
- ]);
|
|
|
+ DB::transaction(function ()use(&$model,$params,$operation){
|
|
|
+ $model = app('OwnerPriceOperationService')->create($operation);
|
|
|
foreach ($params["items"] as &$item){
|
|
|
$item["owner_price_operation_id"] = $model->id;
|
|
|
if (!isset($item["feature"]))$item["feature"] = null;
|